Re: Attempted summary of suspend-blockers LKML thread

Rafael J. Wysocki
2010-08-06T22:04:43Z

On Friday, August 06, 2010, Alan Stern wrote:
> On Thu, 5 Aug 2010, Arve Hjønnevåg wrote:
...
> But what sorts of things qualify as wakeup events? Right now, the code
> handles only events coming by way of the PME# signal (or its platform
> equivalent). But that signal usually gets activated only when a PCI
> device is in a low-power mode; if the device is at full power then it
> simply generates an IRQ. It's the same event, but reported to the
> kernel in a different way. So consider...
>
> Case 1: The system is suspending and the PCI device has already been
> placed in D3hot when an event occurs. PME# is activated,
> the wakeup event is reported, the suspend is aborted, and the
> system won't try to suspend again for at least 100 ms. Good.
>
> Case 2: The system is running normally and the PCI device is at full
> power when an event occurs. PME# isn't activated and
> pm_wakeup_event doesn't get called. Then when the system
> tries to suspend 25 ms later, there's nothing to prevent it
> even though the event is still being processed. Bad.
>
> In case 2 the race has not been resolved. It seems to me that the
> only proper solution is to call pm_wakeup_event for _every_ PCI
> interrupt. This may be too much to add to a hot path, but what's the
> alternative?

Arguably not every PCI interrupt should be regarded as a wakeup event, so
I think we can simply say in the cases when that's necessary the driver should
be responsible for using pm_wakeup_event() or pm_stay_awake() / pm_relax() as
appropriate.

My patch only added it to the bus-level code which covered the PME-based
wakeup events that _cannot_ be handled by device drivers.

Thanks,
Rafael