public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: markgross@thegnar.org, <linux-kernel@vger.kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, <arve@android.com>,
	<amit.kucheria@linaro.org>, <farrowg@sg.ibm.com>,
	"Dmitry Fink (Palm GBU)" <Dmitry.Fink@palm.com>,
	<linux-pm@lists.linux-foundation.org>, <khilman@ti.com>,
	Magnus Damm <damm@opensource.se>, <mjg@redhat.com>,
	<peterz@infradead.org>
Subject: Re: [markgross@thengar.org: [RFC] wake up notifications and suspend blocking (aka more wakelock stuff)]
Date: Mon, 17 Oct 2011 08:37:17 +1100	[thread overview]
Message-ID: <20111017083717.0bd5626c@notabene.brown> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1110152136460.19724-100000@netrider.rowland.org>

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

On Sat, 15 Oct 2011 21:49:44 -0400 (EDT) Alan Stern
<stern@rowland.harvard.edu> wrote:


> All right, let's make things a little more complicated.

Let's call it "realistic".   It is good to have some realism to make sure our
abstract discussions actually mean something.

> 
> Here's what actually happens when a USB keyboard generates a wakeup 
> request.  The system wakes up, of course, but there's no particular 
> indication of the cause.  In particular, the usbhid driver has no way 
> to know directly that the keyboard was the reason for the wakeup.
> 
> In addition, usbhid can't poll keyboards to see if they have an event
> to report.  (In theory it could -- the HID protocol allows for this --
> but many keyboards don't support that part of the protocol properly.)  
> It has to wait until the keyboard gets around to reporting the event, 
> which can take 10 ms or more.
> 
> Taken together, this means usbhid must activate a wakeup_source every
> time it wakes up.  If a keyboard event report is received reasonably
> quickly then good, it can deactivate the wakeup_source at the right
> time.  But if not, all the driver can do is time out the wakeup_source
> after some delay.  I don't see any way to avoid it.

I have to agree with you there.
This is similar to Rafael's example of a Wake-on-LAN packet arriving.  At
that point there is nothing you can do except wait a little while expecting
more information.

You could see this as a case where the wake-up event isn't even visible to
the kernel, so there is obviously no way to make it visible to user-space.

Or you could see it as a wake-up event that is expected to be delivered over
a long period of time (many msecs).  The kernel gathers the wake-up event,
makes it visible to user-space (once it actually arrives), and then releases
the wakeup_source.

So it is a good example and highlights the difficulty of defining exactly
what a wake-up event it, and of what it means to be "visible".

I think it still fits in your rephrasing of my question which - if I rephrase
it as a requirement - is roughly,

  A wakeup-event that needs to be handled by user-space must be visible to
  user-space before the driver deactivates the wakeup_source.

A requirement which, in this case, means the driver needs to hold  the
wakeup_source for an extended time using a timeout, just as you say.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2011-10-16 21:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 16:44 [markgross@thengar.org: [RFC] wake up notifications and suspend blocking (aka more wakelock stuff)] mark gross
2011-10-08 11:14 ` NeilBrown
2011-10-08 18:16   ` mark gross
2011-10-08 18:57     ` Rafael J. Wysocki
2011-10-08 20:07       ` Alan Stern
2011-10-13  3:07         ` mark gross
2011-10-13 15:06           ` Alan Stern
2011-10-14 13:23             ` mark gross
2011-10-13  2:59       ` mark gross
2011-10-08 22:31     ` NeilBrown
2011-10-13  3:48       ` mark gross
2011-10-13  5:35         ` NeilBrown
2011-10-13 15:16           ` Alan Stern
2011-10-14 21:47             ` NeilBrown
2011-10-15 18:45               ` Alan Stern
2011-10-15 22:25                 ` NeilBrown
2011-10-16  1:49                   ` Alan Stern
2011-10-16 21:37                     ` NeilBrown [this message]
2011-10-24  1:18                       ` mark gross
2011-10-24  1:50                         ` NeilBrown
2011-10-25  4:50                           ` mark gross
2011-10-25 15:14                             ` Alan Stern
2011-10-25  7:05                           ` Brian Swetland
2011-10-14 14:01           ` mark gross
2011-10-15 14:05             ` mark gross
2011-10-15 22:12               ` NeilBrown

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=20111017083717.0bd5626c@notabene.brown \
    --to=neilb@suse.de \
    --cc=Dmitry.Fink@palm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=arve@android.com \
    --cc=damm@opensource.se \
    --cc=farrowg@sg.ibm.com \
    --cc=john.stultz@linaro.org \
    --cc=khilman@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=markgross@thegnar.org \
    --cc=mjg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rjw@sisk.pl \
    --cc=stern@rowland.harvard.edu \
    /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