From: mark gross <640e9920@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: Wu Fengguang <fengguang.wu@intel.com>,
Andi Kleen <ak@linux.intel.com>,
markgross@thegnar.org, Len Brown <len.brown@intel.com>,
linux-doc@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>,
Greg KH <gregkh@suse.de>,
Kernel development list <linux-kernel@vger.kernel.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
James Bottomley <James.Bottomley@suse.de>,
Tejun Heo <tj@kernel.org>,
tytso@mit.edu,
Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/8] PM: Opportunistic suspend support.
Date: Sun, 30 May 2010 13:32:17 -0700 [thread overview]
Message-ID: <20100530203217.GD25545__38607.5595430613$1275251663$gmane$org@gvim.org> (raw)
In-Reply-To: <20100530180846.408e50be@notabene.brown>
On Sun, May 30, 2010 at 06:08:46PM +1000, Neil Brown wrote:
> On Fri, 28 May 2010 21:04:53 -0700
> Arve Hjønnevåg <arve@android.com> wrote:
>
> > On Fri, May 28, 2010 at 7:52 PM, mark gross <640e9920@gmail.com> wrote:
> > > On Thu, May 27, 2010 at 05:23:54PM +1000, Neil Brown wrote:
> > >> On Wed, 26 May 2010 14:20:51 +0100
> > >> Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > >>
> > >> > On Wed, May 26, 2010 at 02:57:45PM +0200, Peter Zijlstra wrote:
> > >> >
> > >> > > I fail to see why. In both cases the woken userspace will contact a
> > >> > > central governing task, either the kernel or the userspace suspend
> > >> > > manager, and inform it there is work to be done, and please don't
> > >> > > suspend now.
> > >> >
> > >> > Thinking about this, you're right - we don't have to wait, but that does
> > >> > result in another problem. Imagine we get two wakeup events
> > >> > approximately simultaneously. In the kernel-level universe the kernel
> > >> > knows when both have been handled. In the user-level universe, we may
> > >> > have one task schedule, bump the count, handle the event, drop the count
> > >> > and then we attempt a suspend again because the second event handler
> > >> > hasn't had an opportunity to run yet. We'll then attempt a suspend and
> > >> > immediately bounce back up. That's kind of wasteful, although it'd be
> > >> > somewhat mitigated by checking that right at the top of suspend entry
> > >> > and returning -EAGAIN or similar.
> > >> >
> > >>
> > >> (I'm coming a little late to this party, so excuse me if I say something that
> > >> has already been covered however...)
> > >>
> > >> The above triggers a sequence of thoughts which (When they settled down) look
> > >> a bit like this.
> > >>
> > >> At the hardware level, there is a thing that we could call a "suspend
> > >> blocker". It is an interrupt (presumably level-triggered) that causes the
> > >> processor to come out of suspend, or not to go into it.
> > >>
> > >> Maybe it makes sense to export a similar thing from the kernel to user-space.
> > >> When any event happens that would wake the device (and drivers need to know
> > >> about these already), it would present something to user-space to say that
> > >> the event happened.
> > >>
> > >> When user-space processes the event, it clears the event indicator.
> > >
> > > we did I proposed making the suspend enabling a oneshot type of thing
> > > and all sorts of weak arguments came spewing forth. I honestly couldn't
> > > tell if I was reading valid input or fanboy BS.
> > >
> >
> > Can you be more specific? If you are talking about only letting
> > drivers abort suspend, not block it, then the main argument against
> > that is that you are forcing user-space to poll until the driver stops
> > aborting suspend (which according to people arguing against us using
> > suspend would make the power-manager a "bad" process). Or are you
> > talking about blocking the request from user-space until all other
> > suspend-blockers have been released and then doing a single suspend
> > cycle before returning. This would not be as bad, but it would force
> > the user-space power manager to be multi-threaded since it now would
> > have way to cancel the request. Either way, what problem are you
> > trying to solve by making it a one-shot request?
> >
Sorry about missing Avr's email, I've been fighting with getting my
email forwarding working right.
The problems I want to solve with the one-shot styled interface are:
1) of having to sprinkle suspend blocking sections from isr up to
usermode and get them right.
2) provide a platform / architecture independent framework supporting
other low power modes.
I've just posted a patch that expresses what I was trying to express.
Its hard to take design over email without tossing code back and forth.
It's my turn to toss some code.
>
> Simply aborting the suspend cannot work as you rightly say - the suspend
> daemon would then spin until other user-space processes get into action.
Not if you have sensible event messaging to the user-space processes.
I've posted a patch that attempts to add some messaging.
> Simply blocking while there are any unhandled 'wakeup events' - then aborting
> if there were any - is how I think it should work. However as it
> doesn't work that way now I don't think it is safe to make it work that way
> unconditionally. If we did we could find that existing configurations always
> block suspend indefinitely with would clearly be a regression.
>
> I think we still need some sort of "suspend_prepare". This would have two
> particular effects.
> 1/ it sets the start time for interpreting the word "were" above. i.e. the
> suspend would abort of there were any unhandled wakeup events since the
> "suspend_prepare" was issued.
> 2/ It would allow unhandled wakeup events to abort the suspend. If no
> suspend_prepare had been issued, then only "new" wakeup events would
> be allowed to abort the suspend (i.e. the old racy version of suspend).
>
> So the suspend daemon does:
>
> wait for there to be no user-space suspend blocks
> issue suspend_prepare
> check there are still no suspend blocks
> if there are, loop (possibly issue suspend_abort if needed)
> issue suspend request
> loop
>
> processes that handle wakeup events would
>
> poll for event to be available
> request suspend-block
> consume event
> release suspend-block
> loop
In my mind I'm thinking of something like:
attempt low power entry (suspend)
if blocked, get -EBUSY back
select on block_file until block is released
retry suspend
else // entered low power and exited
read wake_event
do something with event; typically wait a bit and loop.
--mgross
>
> (where consuming the event would quite possibly cause some other
> suspend-block to become active - e.g. it might request that the display
> be unlocked which would block suspends for a time).
>
> NeilBrown
next prev parent reply other threads:[~2010-05-30 20:32 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44L0.1005251647530.1634-100000@iolanthe.rowland.org>
2010-05-25 21:44 ` [PATCH 1/8] PM: Opportunistic suspend support Rafael J. Wysocki
[not found] ` <201005252344.37639.rjw@sisk.pl>
2010-05-25 22:33 ` Arve Hjønnevåg
2010-05-26 8:42 ` Peter Zijlstra
[not found] ` <AANLkTimL5rU5lALezEZVCwdcZL85tVahhsTibdpq9s-Y@mail.gmail.com>
2010-05-26 8:42 ` Peter Zijlstra
[not found] ` <1274863342.5882.4850.camel@twins>
2010-05-26 8:53 ` Peter Zijlstra
2010-05-26 9:23 ` Florian Mickler
[not found] ` <20100526112303.3fef15a4@schatten.dmk.lab>
2010-05-26 9:33 ` Peter Zijlstra
[not found] ` <1274866402.5882.5051.camel@twins>
2010-05-26 9:54 ` Arve Hjønnevåg
[not found] ` <AANLkTil9ZtMFxTfE6ITiFNOl4S1k3Lvdp5BPgGX7LJhw@mail.gmail.com>
2010-05-26 10:06 ` Peter Zijlstra
[not found] ` <1274868384.5882.5169.camel@twins>
2010-05-26 10:17 ` Arve Hjønnevåg
[not found] ` <AANLkTimHGpRAZklIwXu6wEbA3coKXJvCVLxj2twerkCw@mail.gmail.com>
2010-05-26 10:21 ` Peter Zijlstra
[not found] ` <1274869262.5882.5222.camel@twins>
2010-05-26 10:29 ` Pekka Enberg
2010-05-26 10:30 ` Arve Hjønnevåg
[not found] ` <AANLkTilp1zWqvmUzGjEX3x9OBsdXdvNEG-znTjVvoM-b@mail.gmail.com>
2010-05-26 10:35 ` Pekka Enberg
2010-05-26 11:16 ` Vitaly Wool
[not found] ` <AANLkTik9LINPmabJfVi0jfVs5sjVS_1l00WpnVTFEuLV@mail.gmail.com>
2010-05-26 16:18 ` James Bottomley
[not found] ` <1274890736.4467.574.camel@mulgrave.site>
2010-05-26 16:28 ` Peter Zijlstra
[not found] ` <1274891308.1674.1766.camel@laptop>
2010-05-26 16:38 ` Kevin Hilman
2010-05-26 16:54 ` James Bottomley
2010-05-26 16:59 ` Pavel Machek
[not found] ` <1274892847.4467.674.camel@mulgrave.site>
2010-05-26 17:00 ` Peter Zijlstra
[not found] ` <1274893228.1674.1772.camel@laptop>
2010-05-26 17:14 ` James Bottomley
[not found] ` <1274894042.4467.727.camel@mulgrave.site>
2010-05-26 17:23 ` Peter Zijlstra
2010-05-26 17:28 ` Pavel Machek
[not found] ` <1274894602.1674.1780.camel@laptop>
2010-05-26 17:33 ` James Bottomley
[not found] ` <1274895188.4467.783.camel@mulgrave.site>
2010-05-26 17:42 ` Pavel Machek
[not found] ` <20100526174258.GF9069@elf.ucw.cz>
2010-05-26 18:09 ` James Bottomley
[not found] ` <20100526172824.GA9069@elf.ucw.cz>
2010-05-26 19:15 ` Florian Mickler
[not found] ` <20100526211542.1bfa2564@schatten.dmk.lab>
2010-05-26 22:10 ` Rafael J. Wysocki
2010-05-27 8:13 ` Bernd Petrovitsch
[not found] ` <20100526165919.GB2089@elf.ucw.cz>
2010-05-26 17:01 ` Peter Zijlstra
[not found] ` <1274893309.1674.1773.camel@laptop>
2010-05-26 17:24 ` James Bottomley
[not found] ` <1274894685.4467.758.camel@mulgrave.site>
2010-05-26 17:51 ` Thomas Gleixner
[not found] ` <alpine.LFD.2.00.1005261948290.2995@localhost.localdomain>
2010-05-26 18:23 ` James Bottomley
[not found] ` <1274898180.4467.925.camel@mulgrave.site>
2010-05-26 18:50 ` Valdis.Kletnieks
[not found] ` <15650.1274899857@localhost>
2010-05-26 20:06 ` James Bottomley
2010-05-27 8:17 ` Bernd Petrovitsch
[not found] ` <1274948234.14002.27.camel@thorin>
2010-05-27 9:07 ` Arve Hjønnevåg
[not found] ` <AANLkTilk7FX1Y0uWKyMEpf8uxFPBae3X0hGdLLa5oNUa@mail.gmail.com>
2010-05-28 3:50 ` Just fix the bug - " Neil Brown
2010-05-28 4:57 ` Arve Hjønnevåg
2010-05-28 6:06 ` Neil Brown
2010-05-28 6:37 ` Arve Hjønnevåg
2010-05-28 13:35 ` Pavel Machek
2010-05-28 14:26 ` Florian Mickler
2010-05-26 22:25 ` Rafael J. Wysocki
2010-05-26 22:13 ` Rafael J. Wysocki
2010-05-26 17:25 ` Pekka Enberg
[not found] ` <AANLkTinv5C-TO48ZMP0ZV-ne7VbCAhXlARhYOJmhYoRa@mail.gmail.com>
2010-05-26 17:40 ` James Bottomley
[not found] ` <1274895611.4467.805.camel@mulgrave.site>
2010-05-26 18:07 ` Pekka Enberg
2010-05-27 7:34 ` Neil Brown
[not found] ` <1274863987.5882.4892.camel@twins>
2010-05-26 12:49 ` Matthew Garrett
[not found] ` <20100526124929.GA32580@srcf.ucam.org>
2010-05-26 12:57 ` Peter Zijlstra
[not found] ` <1274878665.27810.354.camel@twins>
2010-05-26 13:20 ` Matthew Garrett
[not found] ` <20100526132051.GA1834@srcf.ucam.org>
2010-05-26 22:03 ` Rafael J. Wysocki
2010-05-27 7:23 ` Neil Brown
[not found] ` <20100527172354.43e46cef@notabene.brown>
2010-05-29 2:52 ` mark gross
[not found] ` <20100529025215.GB11600@gvim.org>
2010-05-29 4:04 ` Arve Hjønnevåg
[not found] ` <AANLkTimVhC3X68uN3krrkkAAAK4a4D5yTK1V8i_x_Vfy@mail.gmail.com>
2010-05-30 8:08 ` Neil Brown
[not found] ` <20100530180846.408e50be@notabene.brown>
2010-05-30 19:52 ` Rafael J. Wysocki
2010-05-30 20:32 ` mark gross [this message]
[not found] ` <201005302152.14166.rjw@sisk.pl>
2010-05-30 23:03 ` Neil Brown
[not found] ` <20100531090329.786fce79@notabene.brown>
2010-05-31 5:56 ` Neil Brown
[not found] ` <20100530203217.GD25545@gvim.org>
2010-05-31 10:03 ` Arve Hjønnevåg
[not found] <AANLkTikFwznonORd42piWZvBv3oqqSj9odC9Jaud8o3x@mail.gmail.com>
2010-05-27 0:47 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1005262044001.6349-100000@netrider.rowland.org>
2010-05-27 0:52 ` Arve Hjønnevåg
[not found] ` <AANLkTingAiO8dkwnInc993PTyA63rV-WRvBIRlB2ChXs@mail.gmail.com>
2010-05-27 14:09 ` Alan Stern
2010-05-27 18:13 ` Dmitry Torokhov
[not found] ` <20100527181333.GA8297@core.coreip.homeip.net>
2010-05-27 20:00 ` Rafael J. Wysocki
2010-05-27 23:36 ` Arve Hjønnevåg
[not found] ` <AANLkTilu5us2sYmm_f422Z2gJ34ZmIF808yYRPXkLjme@mail.gmail.com>
2010-05-27 23:48 ` Dmitry Torokhov
[not found] ` <20100527234841.GA8645@core.coreip.homeip.net>
2010-05-27 23:52 ` Arve Hjønnevåg
[not found] <201005262351.59626.rjw@sisk.pl>
2010-05-26 22:12 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1005261759100.1328-100000@iolanthe.rowland.org>
2010-05-26 22:47 ` Rafael J. Wysocki
2010-05-26 23:09 ` Arve Hjønnevåg
[not found] <Pine.LNX.4.44L0.1005260946430.1961-100000@iolanthe.rowland.org>
2010-05-26 21:51 ` Rafael J. Wysocki
[not found] <Pine.LNX.4.44L0.1005251359580.1634-100000@iolanthe.rowland.org>
2010-05-25 18:24 ` Dmitry Torokhov
[not found] ` <201005251124.58017.dmitry.torokhov@gmail.com>
2010-05-25 18:35 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1005251428090.1634-100000@iolanthe.rowland.org>
2010-05-25 18:47 ` Dmitry Torokhov
[not found] ` <20100525184740.GA4248@core.coreip.homeip.net>
2010-05-25 19:05 ` Alan Stern
2010-05-25 22:23 ` Arve Hjønnevåg
[not found] ` <AANLkTik7eKNIqMFGVl6OzpqBnhvjet9puUQDCRkrabkg@mail.gmail.com>
2010-05-25 22:32 ` Dmitry Torokhov
[not found] ` <20100525223220.GC4928@core.coreip.homeip.net>
2010-05-25 22:37 ` Arve Hjønnevåg
[not found] ` <AANLkTinnSH_egFYowkOQiYHL87QfIH332i1__OaTem-s@mail.gmail.com>
2010-05-25 22:55 ` Dmitry Torokhov
2010-05-25 22:59 ` Kevin Hilman
[not found] ` <87ljb7io58.fsf@deeprootsystems.com>
2010-05-26 0:04 ` Arve Hjønnevåg
[not found] ` <20100525225544.GA5331@core.coreip.homeip.net>
2010-05-25 23:13 ` Arve Hjønnevåg
[not found] ` <AANLkTikaoXH5T4FJ5sY9OnAyjhaY8wa7rH6S7_k9F_m8@mail.gmail.com>
2010-05-25 23:26 ` Dmitry Torokhov
[not found] ` <20100525232625.GB5331@core.coreip.homeip.net>
2010-05-25 23:54 ` Arve Hjønnevåg
[not found] ` <AANLkTimdGWKbUTkgTZEUGNPrXVzZ6CYwbbKQ7C3X7Ek_@mail.gmail.com>
2010-05-26 0:26 ` Dmitry Torokhov
[not found] ` <20100526002612.GC5331@core.coreip.homeip.net>
2010-05-26 0:36 ` Arve Hjønnevåg
2010-05-26 13:59 ` Alan Stern
2010-05-25 19:47 ` Rafael J. Wysocki
[not found] ` <201005252147.22358.rjw@sisk.pl>
2010-05-25 19:53 ` Dmitry Torokhov
[not found] ` <20100525195300.GA4455@core.coreip.homeip.net>
2010-05-25 20:21 ` Rafael J. Wysocki
[not found] ` <201005252221.55888.rjw@sisk.pl>
2010-05-25 20:44 ` Dmitry Torokhov
2010-05-25 21:00 ` Alan Stern
[not found] ` <20100525204405.GE4455@core.coreip.homeip.net>
2010-05-25 21:04 ` Vitaly Wool
2010-05-25 21:15 ` Rafael J. Wysocki
2010-05-25 23:00 ` Kevin Hilman
2010-05-26 8:43 ` Peter Zijlstra
[not found] <20100525165756.GA2979@core.coreip.homeip.net>
2010-05-25 18:08 ` Alan Stern
[not found] <AANLkTikz2UcDv6BZQ9Hq2MdowuAK1y_PBBPPXMEkDmNa@mail.gmail.com>
2010-05-25 1:34 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1005242130290.8440-100000@netrider.rowland.org>
2010-05-25 16:57 ` Dmitry Torokhov
[not found] <1274482015-30899-2-git-send-email-arve@android.com>
2010-05-22 2:47 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1005212226180.20028-100000@netrider.rowland.org>
2010-05-25 1:05 ` Arve Hjønnevåg
[not found] <1274482015-30899-1-git-send-email-arve@android.com>
2010-05-21 22:46 ` Arve Hjønnevåg
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='20100530203217.GD25545__38607.5595430613$1275251663$gmane$org@gvim.org' \
--to=640e9920@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=fengguang.wu@intel.com \
--cc=gregkh@suse.de \
--cc=jbarnes@virtuousgeek.org \
--cc=len.brown@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=markgross@thegnar.org \
--cc=neilb@suse.de \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=tytso@mit.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