public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: linux-pm@lists.osdl.org
Subject: Re: Wakeup requests during a system sleep transition
Date: Fri, 11 Nov 2005 18:29:13 -0800	[thread overview]
Message-ID: <200511111829.13371.david-b@pacbell.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0511081415490.4438-100000@iolanthe.rowland.org>

[-- Attachment #1: Type: text/plain, Size: 3471 bytes --]

On Tuesday 08 November 2005 11:43 am, Alan Stern wrote:
> A question has come up recently in private conversations concerning remote 
> wakeup requests arriving while a system sleep transition is in progress.  
> How should they be handled?
> 
> There are at least three possibilities:
> 
>     (a) Carry out the wakeup request (i.e., resume the requesting device)
> 	and then abort the system sleep when the device's parent is told
> 	to suspend and it sees that its children aren't all suspended.

This probably makes the most sense to me ...


>     (b) Carry out the wakeup request, then sometime later try to recover
> 	by re-suspending the device that was just resumed, and continue
> 	the sleep transition.
> 
>     (c) Ignore the wakeup request and proceed with the sleep transition.
> 
> (a) is very simple and doesn't require any extra code, since drivers
> should already be checking to make sure that all the children are
> suspended before suspending their devices.  When the sleep transition is
> aborted, we can just return -ERESTARTSYS and force the user to try again
> -- exactly the same as would happen with any other interrupted system
> call.

That is, it requires faults on suspend to be handled reasonably.
Not a new requirement ... but quite possibly one that's not always
being satisfied.  And certainly one that's awkward to test.


> (b) is not a good solution, IMO.  It involves a pretty hairy recovery
> scheme that's not well defined.  It runs the risk of leaving some devices
> unsuspended while suspending their parents, or leaving data structures out
> of sync with the actual hardware state.  Furthermore I don't see any
> advantage in making the kernel do the re-suspend over making userspace
> restart the entire sleep transition, as in (a).

Although I'm not sure I'd see the point to having userspace try to
suspend again ... user said to wake up, after all!!

In general, (b) sounds complex and error prone.  Two things that
are IMO worth avoiding in the kernel.


> (c) seems like a reasonable approach.  It does, however, have a couple of
> problems.  First, drivers can't (currently) tell the difference between an
> overall system sleep and a device-specific runtime suspend.  Since we
> certainly _don't_ want to ignore device-wakeup requests during a runtime
> suspend, there's no way for a driver to ignore them during a system sleep
> transition.
> 
> The second thing to consider about (c) is that ignoring a wakeup request
> might not make it go away.  It will depend on the exact nature of the
> hardware and the type of request of course, but there's a good chance that
> the request will persist until the system finally goes to sleep.  At that
> point the request will immediately wake the system right back up.  The
> overall effect is the same as with (a) -- the system is awake at the end
> -- but you've wasted a lot of time and effort to get there.

Both are reasons I'd prefer (a).


> Now it's true that sometimes there will be no choice.  Once tasks are 
> frozen, there's no way to resume a device since doing so requires a 
> process context.  Then we'd be forced to adopt (c). 

On the other hand, a clean failure of the suspend would restart those
tasks nicely... I don't see that as an issue.


> However there are  
> situations where tasks are _not_ frozen during a sleep transition.  
> Suspend-To-RAM on PPC, for example.  What should happen in such cases?

Use (a).  ;)

- Dave

 
> Alan Stern
> 
> 

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2005-11-12  2:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-08 19:43 Wakeup requests during a system sleep transition Alan Stern
2005-11-12  2:29 ` David Brownell [this message]
2005-11-12  2:54   ` Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2005-11-14 14:23 Preece Scott-PREECE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200511111829.13371.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-pm@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox