Re: [Update, rev. 5] Re: [RFC][PATCH 1/4] PM: Rework handling of interrupts during suspend-resume (rev. 4)

Ingo Molnar
2009-03-05T10:35:24Z

* Rafael J. Wysocki <rjw@sisk.pl> wrote:

> On Tuesday 03 March 2009, Arve Hjønnevåg wrote:
> > On Mon, Mar 2, 2009 at 3:27 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > > On Tuesday 03 March 2009, Arve Hjønnevåg wrote:
> > >> On Mon, Mar 2, 2009 at 3:13 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > >> > On Tuesday 03 March 2009, Arve Hjønnevåg wrote:
> > >> >> On Sun, Mar 1, 2009 at 2:24 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> [--snip--]
> > > Can you show me a _single_ _driver_ currently in the tree doing something
> > > like you describe in suspend_late and resume_early? If you can't, then please
> > > give up.
> >
> > I don't know if any drivers call disable_irq or enable_irq in their
> > suspend hooks, but your change also allow timers, and I assume kernel
> > threads, to run during this phase.
> >
> > There are several drivers (keypad drivers in particular), in tree and
> > out of tree, that call enable_irq from timers, and disable_irq from
> > their interrupt handler. If you also apply your later change to
> > disable non boot cpus after suspend_device_irqs, then on smp systems
> > the interrupt handler may run at the same time as suspend_device_irqs.
> > If suspend_device_irqs gets the spinlock first, then IRQ_SUSPENDED
> > gets set. If another suspend/resume cycle happens before the timer
> > runs, you will incorrectly enable the interrupt.
>
> Well, unfortunately this is a valid point IMO. I've been thinking for quite a
> while how to fix it nicely, but I'm not sure if there is a nice fix.
>
> Below is an updated patch, hopefully everyone will be fine with it.
>
> Ingo, is making __enable_irq() an extern function acceptable?

Sure, that's fine - it's a genirq internal function still
between kernel/irq/manage.c and kernel/irq/pm.c.

Ingo