Messages in this thread | | | Subject | Re: [Fwd: problem involving wait_on_bh] | Date | Sun, 19 Dec 1999 15:37:08 +0100 (MET) | From | (Rogier Wolff) |
| |
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/
| |