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

From: Atsushi Nemoto
Date: Fri Apr 24 2009 - 12:49:06 EST


On Fri, 24 Apr 2009 13:13:34 +0200, Alessandro Zummo <alessandro.zummo@xxxxxxxxxxxx> wrote:
> > >  use spin_lock() in the IRQ handler and spin_lock_irq/irq_save
> > >  in the setup functions.
> >
> > I think you're describing how the *current* scheme is supposed
> > to work ... except that some IRQ handlers aren't calling the
> > rtc_update_irq() routine with IRQs blocked.
> >
> > Yes, that current scheme works ... modulo those buggy handlers.
>
> ok, but why it's necessary to disable the interrupts? Only because
> the specs says so or because there's a locking issue I'm missing?

Here is a possible example:

1. RTC alarm interrupt handler takes rtc->irq_lock by spin_lock()
2. A timer interrupt handler calls rtc_uie_timer() for UIE emulation
3. rtc_uie_timer() waits on rtc->irq_lock .... deadlock!

This sort of deadlock can happen if a spin lock was used by multple
interrupt handlers.

---
Atsushi Nemoto
--
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/