All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark gross <640e9920@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: markgross@thegnar.org, "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-pm@lists.linux-foundation.org,
	"Matthew Garrett" <mjg59@srcf.ucam.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Arve Hjønnevåg" <arve@android.com>, "Neil Brown" <neilb@suse.de>,
	"mark gross" <640e9920@gmail.com>
Subject: Re: [RFC][PATCH] PM: Avoid losing wakeup events during suspend
Date: Sun, 20 Jun 2010 22:55:22 -0700	[thread overview]
Message-ID: <20100621055522.GE9735@gvim.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1006202223440.29532-100000@netrider.rowland.org>

On Sun, Jun 20, 2010 at 10:33:01PM -0400, Alan Stern wrote:
> On Sun, 20 Jun 2010, mark gross wrote:
> 
> > > Indeed, the same problem arises if the event isn't delivered to
> > > userspace until after userspace is frozen.  Of course, the underlying
> > > issue here is that the kernel has no direct way to know when userspace
> > > has finished processing an event.  Userspace would have to tell it,
> > > which generally would mean rewriting some large number of user
> > > programs.
> > 
> > Suspend blockers don't solve this, and the large number of user programs
> > isn't a big number.  /me thinks its 1 or 2 services.
> 
> On Android, perhaps.  What about on other systems?

This is just speculation but, I would expect other systems would have
the graphics, input, telephony, and any PM services wake_count / wake
event ware.  

I can't imagine (at the moment) anything else that would care.

> 
> > > In what way is this better than suspend blockers?
> > 
> > 1) I don't think suspend blockers really solve or effectively articulate
> > the suspend wake event race problem.
> 
> Why not?

For starters the suspend block patch is about suspend blocking, at least
at first before competing ideas starting coming out and this race issue
was offered up as an excuse to not consider the alternative ideas, then
suddenly suspend blocking became a wake event notification mechanism
implementation that was baked into the implementation.  The arguments
are still a blur and irritating to recall / look up again.

But, the point I'm trying to make is that wake event serialization /
event handling suddenly became a big FUD-pie tightly bound to a specific
feature for suspend blocking (or was is auto suspending?  Its a magical
solution to all the PM problems in the kernel.  I'm being sarcastic.)  

Its much better to call out the issue and provide a clean targeted
solution to it without binding it to some other solution to a different
problem.

> 
> > 2) the partial solution suspend blocker offer for the suspend race is
> > tightly bound to the suspend blocker implementation and not useful in
> > more general contexts.
> 
> I don't understand.  Can you explain further?
> 
> > > One advantage of the suspend-blocker approach is that it essentially
> > > uses a single tool to handle both kinds of races (event not fully
> > > handled by the kernel, or event not fully handled by userspace).  
> > > Things aren't quite this simple, because of the need for a special API
> > > to implement userspace suspend blockers, but this does avoid the need
> > > for a power-manager process.
> > 
> > I don't think suspend-blocker handles both kinds of races as well as you
> > seem to think.
> 
> Can you give any counterexamples?

I knew you'd ask such a thing.  Do you have any correctness proofs of it
working right?

Lets consider the RIL incoming call race:
1) user mode initiates an "opportunistic suspend" or whatever we call
this these days by writing to some sys interface.
2) a call comes in (multi-threaded cpu) just after the write.
3) the caif driver grabs a blocker, stopping the in flight suspend in the
nick of time.  But, when should it release it without racing?  How does
one implement that kernel code such that its portable to non-android user
mode stacks? 

> 
> >  A single tool that conflates multiple kernel facilities
> > is not an advantage.  It limits applications outside of the scope of
> > doing it the "android way".
> 
> I don't see that necessarily as a drawback.  You might just as well say
> that the entire Linux kernel limits applications to doing things the
> "Unix" way.  Often have fewer choices is an advantage.

I disagree with your analogy.  One problem one solution with minimal
coupling to other implementation details is nice.  Two problems with one
solution dependent on the system wide architecture bound to a user mode
PM design is fragile and not portable.
 
> > Where do you get the idea that there isn't a need for a centralized PM
> > process in Android?  Thats not true.
> 
> I didn't get that idea from anywhere.  Sorry if I gave the wrong
> impression -- I meant that non-Android systems would need to implement
> a centralized power-manager process, along with all the necessary
> changes to other programs.
> 
> (Incidentally, even on Android the centralized PM process does not 
> handle _all_ of the userspace/kernel wakelock interactions.)
>

Yeah, I've been told that too.  I've grepped for where the wake_unlock
sysfs interfaces are hit from user mode android (eclair) and I would
like some help in identifying those guys. Maybe its in the FroYo code I
don't get to look at yet?

There is libhardware_legacy/power/power.c and  an out of tree kernel
broadcom bcm4329 driver under hardware/broadcom but that doesn't count
as it looks like a kernel driver to me.

--mgross 


  parent reply	other threads:[~2010-06-21  5:55 UTC|newest]

Thread overview: 151+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-19 22:05 [RFC][PATCH] PM: Avoid losing wakeup events during suspend Rafael J. Wysocki
2010-06-20  5:52 ` mark gross
2010-06-20  5:52 ` mark gross
2010-06-20 12:49   ` Rafael J. Wysocki
2010-06-20 23:13     ` mark gross
2010-06-20 23:13     ` mark gross
2010-06-20 12:49   ` Rafael J. Wysocki
2010-06-20 16:28 ` Alan Stern
2010-06-20 16:28 ` Alan Stern
2010-06-20 21:50   ` Rafael J. Wysocki
2010-06-21  2:23     ` Alan Stern
2010-06-21  2:23     ` Alan Stern
2010-06-21  5:32       ` Florian Mickler
2010-06-21  5:32       ` Florian Mickler
2010-06-21 15:23         ` Alan Stern
2010-06-21 20:38           ` Florian Mickler
2010-06-21 22:18             ` Alan Stern
2010-06-21 22:18             ` Alan Stern
2010-06-21 22:40               ` Rafael J. Wysocki
2010-06-21 22:48                 ` Rafael J. Wysocki
2010-06-21 22:48                 ` Rafael J. Wysocki
2010-06-22  0:50                 ` Arve Hjønnevåg
2010-06-22  0:50                 ` Arve Hjønnevåg
2010-06-22 10:21                 ` Rafael J. Wysocki
2010-06-22 10:21                 ` Rafael J. Wysocki
2010-06-22 14:35                   ` Alan Stern
2010-06-22 15:35                     ` Rafael J. Wysocki
2010-06-22 19:55                       ` Alan Stern
2010-06-22 19:55                       ` Alan Stern
2010-06-22 20:58                         ` Rafael J. Wysocki
2010-06-22 20:58                         ` Rafael J. Wysocki
2010-06-22 19:59                       ` [update] " Rafael J. Wysocki
2010-06-24 14:16                         ` Andy Lutomirski
2010-06-24 14:16                         ` Andy Lutomirski
2010-06-24 14:45                           ` Alan Stern
2010-06-24 14:45                           ` Alan Stern
2010-06-24 14:48                           ` Rafael J. Wysocki
2010-06-24 15:21                             ` Andy Lutomirski
2010-06-24 15:21                             ` Andy Lutomirski
2010-06-24 14:48                           ` Rafael J. Wysocki
2010-06-22 19:59                       ` Rafael J. Wysocki
2010-06-22 20:34                         ` Alan Stern
2010-06-22 20:34                         ` Alan Stern
2010-06-22 21:41                           ` Rafael J. Wysocki
2010-06-23  2:12                             ` Alan Stern
2010-06-23  2:12                             ` Alan Stern
2010-06-23 10:09                               ` Rafael J. Wysocki
2010-06-23 10:09                               ` Rafael J. Wysocki
2010-06-23 15:21                                 ` Alan Stern
2010-06-23 15:21                                 ` Alan Stern
2010-06-23 22:17                                   ` Rafael J. Wysocki
2010-06-23 22:17                                   ` Rafael J. Wysocki
2010-06-24 13:13                                     ` [update 2] " Rafael J. Wysocki
2010-06-24 15:06                                       ` Rafael J. Wysocki
2010-06-24 15:35                                         ` Alan Stern
2010-06-24 15:35                                         ` Alan Stern
2010-06-24 23:00                                           ` [update 3] " Rafael J. Wysocki
2010-06-24 23:00                                           ` Rafael J. Wysocki
2010-06-25 14:42                                             ` Alan Stern
2010-06-25 14:42                                             ` Alan Stern
2010-06-25 20:33                                               ` Rafael J. Wysocki
2010-06-25 20:33                                               ` Rafael J. Wysocki
2010-06-24 15:06                                       ` [update 2] " Rafael J. Wysocki
2010-06-24 15:44                                       ` Alan Stern
2010-06-24 15:44                                       ` Alan Stern
2010-06-24 16:19                                         ` Rafael J. Wysocki
2010-06-24 17:09                                           ` Alan Stern
2010-06-24 23:06                                             ` Rafael J. Wysocki
2010-06-24 23:06                                             ` Rafael J. Wysocki
2010-06-25 15:09                                               ` Alan Stern
2010-06-25 15:09                                               ` Alan Stern
2010-06-25 20:37                                                 ` Rafael J. Wysocki
2010-06-25 20:57                                                   ` Alan Stern
2010-06-25 20:57                                                   ` Alan Stern
2010-06-25 20:37                                                 ` Rafael J. Wysocki
2010-06-25  6:40                                             ` Florian Mickler
2010-06-25  6:40                                             ` Florian Mickler
2010-06-25 13:28                                               ` Rafael J. Wysocki
2010-06-25 13:28                                               ` Rafael J. Wysocki
2010-06-24 17:09                                           ` Alan Stern
2010-06-24 16:19                                         ` Rafael J. Wysocki
2010-06-24 13:13                                     ` Rafael J. Wysocki
2010-06-22 21:41                           ` [update] " Rafael J. Wysocki
2010-06-22 15:35                     ` Rafael J. Wysocki
2010-06-22 14:35                   ` Alan Stern
2010-06-22 23:00                   ` mark gross
2010-06-22 23:00                     ` mark gross
2010-06-21 22:40               ` Rafael J. Wysocki
2010-06-21 20:38           ` Florian Mickler
2010-06-21 15:23         ` Alan Stern
2010-06-21 16:54         ` Alan Stern
2010-06-21 20:40           ` Florian Mickler
2010-06-21 20:40           ` Florian Mickler
2010-06-21 21:18           ` Rafael J. Wysocki
2010-06-21 21:18           ` Rafael J. Wysocki
2010-06-21 22:27             ` Alan Stern
2010-06-21 22:27             ` Alan Stern
2010-06-21 16:54         ` Alan Stern
2010-06-21  6:13       ` mark gross
2010-06-21  6:13       ` mark gross
2010-06-21 12:10         ` tytso
2010-06-21 12:10         ` tytso
2010-06-21 12:22           ` Alan Cox
2010-06-21 12:22             ` Alan Cox
2010-06-21 12:26             ` Florian Mickler
2010-06-21 12:26             ` Florian Mickler
2010-06-21 12:26             ` Florian Mickler
2010-06-21 13:42             ` tytso
2010-06-21 14:01               ` Alan Cox
2010-06-21 14:01                 ` Alan Cox
2010-06-21 13:42             ` tytso
2010-06-22  1:07           ` mark gross
2010-06-22  1:07           ` mark gross
2010-06-21 16:01         ` Alan Stern
2010-06-21 16:01         ` Alan Stern
2010-06-22  1:25           ` mark gross
2010-06-22  2:24             ` Alan Stern
2010-06-22  2:24             ` Alan Stern
2010-06-22  1:25           ` mark gross
2010-06-21 21:58       ` Rafael J. Wysocki
2010-06-21 21:58       ` Rafael J. Wysocki
2010-06-20 21:50   ` Rafael J. Wysocki
2010-06-20 22:58   ` mark gross
2010-06-21  2:33     ` Alan Stern
2010-06-21  2:33     ` Alan Stern
2010-06-21  4:04       ` [linux-pm] " David Brownell
2010-06-21  4:04         ` David Brownell
2010-06-21  6:02         ` [linux-pm] " David Brownell
2010-06-21  6:02         ` David Brownell
2010-06-21 15:06         ` Alan Stern
2010-06-21 15:06         ` [linux-pm] " Alan Stern
2010-06-21  5:55       ` mark gross [this message]
2010-06-21 12:39         ` Florian Mickler
2010-06-21 12:39         ` Florian Mickler
2010-06-21 15:57         ` Alan Stern
2010-06-21 15:57         ` Alan Stern
2010-06-22  1:58           ` mark gross
2010-06-22  2:46             ` Alan Stern
2010-06-22  2:46             ` Alan Stern
2010-06-22  9:24               ` Rafael J. Wysocki
2010-06-22  9:24               ` Rafael J. Wysocki
2010-06-22  6:18             ` Florian Mickler
2010-06-22  6:18             ` Florian Mickler
2010-06-22 23:22               ` mark gross
2010-06-22 23:22               ` mark gross
2010-06-22  9:29             ` Rafael J. Wysocki
2010-06-22  9:29               ` Rafael J. Wysocki
2010-06-22  1:58           ` mark gross
2010-06-21  5:55       ` mark gross
2010-06-20 22:58   ` mark gross
2010-06-19 22:05 Rafael J. Wysocki

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=20100621055522.GE9735@gvim.org \
    --to=640e9920@gmail.com \
    --cc=arve@android.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=markgross@thegnar.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=neilb@suse.de \
    --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.