All of lore.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: Sun, 16 Oct 2011 09:25:56 +1100	[thread overview]
Message-ID: <20111016092556.07d6e415@notabene.brown> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1110151435080.15129-100000@netrider.rowland.org>

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

On Sat, 15 Oct 2011 14:45:37 -0400 (EDT) Alan Stern
<stern@rowland.harvard.edu> wrote:

> On Sat, 15 Oct 2011, NeilBrown wrote:
> 
> > On Thu, 13 Oct 2011 11:16:23 -0400 (EDT) Alan Stern
> > <stern@rowland.harvard.edu> wrote:
> > 
> > > On Thu, 13 Oct 2011, NeilBrown wrote:
> > > 
> > > > Nope, but I'm keen for you to convince me.  Identify a wakeup event that
> > > > cannot be made visible to poll (or to user-space by some other
> > > > mechanism) before the wakeup_source needs to be deactivated.  Or if I've
> > > > misunderstood what sort of notification is problematic, help me understand.
> > > 
> > > Here's an example (just for kicks, not completely relevant to your
> > > discussion): A USB keyboard key release.  Unlike key presses, key
> > > releases need not generate input events.  If no processes are
> > > monitoring the raw keyboard event queue then the release is not visible
> > > to userspace at all, hence not visible before the wakeup_source needs
> > > to be deactivated.
> > > 
> > > Alan Stern
> > 
> > As you say, not completely relevant.
> > 
> > If a tree falls in a forest with no one to here, does it make a sound?
> > 
> > similarly if an event happens that no-one is looking for, is it visible?
> > It doesn't really matter.
> 
> That's a different question, but I'll answer it anyway: Yes, it does
> matter.  If the kernel is unable to _know_ that nobody is looking for
> an event, it has to _assume_ that somebody is.  Then what should happen 
> if it turns out that nobody really is looking for it?

Same answer - it doesn't really matter.
In every case, the kernel's responsibility is to make the sure the event is
visible to any watching user-space process before it releases the
wakeup_source.
What user-space does then is up to user-space.
If no-one is watching the kernel is free to drop it at any stage - as soon as
it discovers no-one is watching.
When the input layer gets an event, it iterated through a list of fds which
are open on the event source and queues it to each one.  This list might be
empty - no big deal.  It was still a wakeup_event.  If we were suspended, the
write to /sys/power/state will now complete, the suspend daemon will go back
around its loop, nothing will seem to be happening, so the system will go
back to sleep.

> 
> > So at most this is a case of "is not made visible" rather than "cannot be
> > made visible".
> 
> In this case it's the same thing.  How can a key release be made 
> visible?

/dev/input/eventX??  the evdev driver presents key-down and key-up events
separately.

> 
> > The key-release just needs to clear the "key is pressed" state so that
> > auto-repeat stops and if it was a modifier, the modification is discarded.
> > That is all trivially done in some kernel driver while the wakeup_source is
> > active.
> 
> In other words, if the event is discarded from within the kernel then 
> the wakeup_source can be deactivated at that time.  That's fine -- but 
> it indicates that your original request above was phrased wrongly.  You 
> should have asked for an example of a wakeup_source which the kernel 
> must not deactivate without a userspace handshake, but which cannot be 
> made visible by poll or some other similar mechanism.

Yes, I agree that is more precise statement of what I was trying to say - and
precision is important here.

Thanks!

NeilBrown


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

  reply	other threads:[~2011-10-15 22:26 UTC|newest]

Thread overview: 27+ 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 [this message]
2011-10-16  1:49                   ` Alan Stern
2011-10-16 21:37                     ` NeilBrown
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 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=20111016092556.07d6e415@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.