Re: Problems with arch/i386/kernel/apm.c

Patrick Mochel (mochel@transmeta.com)
Tue, 12 Jun 2001 16:48:31 -0700 (PDT)


On Mon, 11 Jun 2001, Alan Cox wrote:

> > > needed. What I am really desiring to know is if there are any devices
> > > that depend on the apm::send_event(APM_NORMAL_RESUME) happening while
> > > interrupts are disabled.
> >
> > Good spotting... If any devices depend on what you describe, I would
> > argue that their drivers should handle that not the core apm code...
>
> The drivers can't handle it at the moment. I've been talking to many people
> about this all hitting this sort of driver problem.
>
> I think the fix is to keep two classes of power management objects and do
> the following
>
> Call each 'nonirq' suspend function
> (aborting if need be)
> cli()
> Call each irq blocked suspend function
> suspend

It shouldn't be necessary to keep two classes of PM objects; instead walk
the device tree twice on suspend.

The first one is an opportunity for the driver to save any device state; a
method to notify the driver that it's going to sleep (as some PPC people
requested); or to do what it needs to with interrupts enabled.

This also gives the system a graceful way to abort the process should any
of the drivers complain that it absolutely cannot suspend (none of the
devices will actually be powered off at that point).

We then disable interrupts and walk the tree again, actually shutting off
devices. This way, no special cases are made, and no partitioning of the
power management objects is needed.

> resume:
> call each irq blocked resume function
> sti();
> call each nonirq resume

Is this really necessary? We should (note _should_) be able to enable
interrupts, then walk the device tree to resume everything.

Linus confirmed this assumption, but it may turn out to not be the case.
If that is so, then it will be easy enough to do a two stage walk of the
tree, like in suspend - one to power on the device and reinitialize it,
the next to restore state and continue on once interrupts have been
enabled.

-pat

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