lkml.org 
[lkml]   [1999]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Fwd: problem involving wait_on_bh]
Date
From
Alan Cox wrote:
> > > disable_irq() while holding a lock used in the irq handler
> >
> > My experience with locks and SMP is that you hang the machine if you
> > forget to unlock a lock (e.g. because of an error exit) and an
> > interrupt (trying to aquire the lock) happens.
>
> The disable_irq one is very distinctive and an easy trap to fall into
>
> you end up doing
>
>
> irq_begins
> grab_lock_irqsave()
> grab_lock()
> [spins]
> disable_irq()
> [spins waiting for irq exit]

Ah, but I was talking about the much worse, but just as deadly (only
one CPU required):

grab_lock_irqsave()

if (error) {
/* Missing "spin_unlock_irqrestore" */
return;
}

[...]

irq_begins
grab_lock ()



The moral of YOUR story is to always use

spinlock_irqsave

which does the "cli ()" BEFORE grabbing the lock. (instead of thinking
that there is something that can be done with interrupts enabled, but
wiht the lock taken) right?

Roger.

--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
"I didn't say it was your fault. I said I was going to blame it on you."

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.041 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site