Re: Attempted summary of suspend-blockers LKML thread

From: Brian Swetland
Date: Thu Aug 05 2010 - 10:30:00 EST


On Thu, Aug 5, 2010 at 7:22 AM, <david@xxxxxxx> wrote:
>
> Ok, it is now sounding to me like there are two different (but somewhat
> related) purposes that wakelocks are being used for
>
> 1. deciding if the system should go to sleep now or not (what most of the
> discussion has been about)
>
> 2. narrowing the race between going to sleep and wakeup events.
>
> I'm not sure it's possible to completely eliminate the race, even with
> wakelocks there is some time between the time you last check if the wakelock
> is set and when the hardware finishes responding to your commands to go to
> sleep (Unless you can set a level-based interrupt that will wake you up as
> soon as you finish going to sleep)

The transition into sleep is race-free in the wakelock model -- either
the wakeup event happens during the kernel suspend (and grabs a
wakelock), in which case suspend is aborted (and not attempted again
until there are once again no more wakelocks held), or the system
fully suspends to its lowest power mode until a wakeup event brings it
back out again. Entry to lowest power mode must abort if a wakeup
event/interrupt occurs while it's in process -- exactly how the
handoff happens here is hardware dependent but in practice this is
doable on just about any modern system.

Brian
--
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/