Re: [rtc-linux] Re: [PATCH] rtc: Make rtc_update_irq callable with irqs enabled

From: David Brownell
Date: Thu Apr 23 2009 - 15:45:46 EST


On Thursday 23 April 2009, Alessandro Zummo wrote:
>
> > If you're talking about a different patch, please forward...
>
>  no patch, just theory.
>
>  the question is, do we need IRQs disabled when
>  calling rtc_update_irq?

If the spinlock is *ever* acquired with IRQs disabled,
it must *always* be acquired that way.

The typical use is ... from IRQ context, which will in
some cases mean IRQs disabled. QED.


>  and if yes, why? to prevent what?

Consider: one context grabs spinlock with IRQs enabled.
IRQ arrives. That context tries to grab that same lock,
from the same CPU. ==> Self-deadlock.

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