From: Neil Brown <neilb@suse.de>
To: "Arve Hjønnevåg" <arve@android.com>
Cc: linux-doc@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Andi Kleen <ak@linux.intel.com>,
Florian Mickler <florian@mickler.org>,
Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
Len Brown <len.brown@intel.com>, Greg KH <gregkh@suse.de>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Thomas Gleixner <tglx@linutronix.de>,
tytso@mit.edu, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Kernel development list <linux-kernel@vger.kernel.org>,
James Bottomley <James.Bottomley@suse.de>,
Tejun Heo <tj@kernel.org>,
Bernd Petrovitsch <bernd@petrovitsch.priv.at>,
Andrew Morton <akpm@linux-foundation.org>,
Wu Fengguang <fengguang.wu@intel.com>
Subject: Just fix the bug - Re: [PATCH 1/8] PM: Opportunistic suspend support.
Date: Fri, 28 May 2010 13:50:21 +1000 [thread overview]
Message-ID: <20100528135021.3b6acb0b@notabene.brown> (raw)
In-Reply-To: <AANLkTilk7FX1Y0uWKyMEpf8uxFPBae3X0hGdLLa5oNUa@mail.gmail.com>
On Thu, 27 May 2010 02:07:21 -0700
Arve Hjønnevåg <arve@android.com> wrote:
> >
> >> of it into pm QoS stuff and if one day someone solves the rogue app
> >> problem, we can migrate over.
> >
> > If it's so important for Android and no one else, Android can carry it
> > out of tree.
> >
>
> This is not only important for Android. If you use suspend on a
> current Linux system you run the risk of loosing wakeup events. If you
> have wakeup events that you cannot afford to lose your only option is
> to never suspend. On some hardware (e.g. x86) the cost of not
> suspending is always huge, on other hardware (many ARM SOCs) the cost
> is only huge if your apps behave poorly.
>
So here is my suggestion.
Rather than trying to push a feature that is clearly meeting lots of
resistance, the Android devs should state the problem as a bug that needs
fixing. As you have.
Upstream is a lot more receptive of fixing bugs than adding features.
In this case the bug is that you cannot suspend without the risk of losing
wakeup events. This is a real bug that for your use case is a serious
bug. I've toyed with several ways of fixing this but the one that seems most
promising is to note that in the kernel the suspend process is two-stage with
a 'prepare' followed by a 'suspend'. Userspace cannot make that distinction
and so ends up with a race.
Maybe userspace should be able to say "prepare to suspend" with the meaning
that after a successful return, any event which would cause a wakeup sets a
flag so that the final suspend returns immediately (without actually going to
the lower power state).
Then your opportunistic suspend could be entirely in userspace where you
wouldn't have to fight with the kernel crowd :-)
The suspend-daemon would:
Wait for all user-space suspend blocks to be dropped.
Tell the kernel to "prepare to suspend".
Tell all userspace programs which have registered for the message that they
should prepare to suspend. They have the opportunity at this point to
take out a new suspend block if they notice an event that has
just arrived
Wait for all those programs to acknowledge
If there are no new suspend blocks, tell the kernel to suspend
else tell the kernel to abort the suspend.
This (I think) allows race-free opportunistic suspend in user-space where
you can do all the accounting you need.
I don't fully understand your requirements for accounting of devices drivers
rejecting or blocking a suspend, so I cannot say precisely how that would fit
in. Maybe you just need to know - whenever the 'suspend request' completes -
what the wakeup events were. It shouldn't be too hard to export that to
user-space via sysfs.
I won't propose an exact enhancement to the user-space interface for
requesting a suspend, but I suspect it should expose each of
suspend_prepare
suspend_devices_and_enter
suspend_finish
(or close analogues there-of) to user-space. It is tempting to map those to
"open-for-write", "write", "close", but I'm not sure that suspend_prepare
would be appropriate if the app was about to write "disk" - it is a pity that
both suspend and hibernate use the same sysfs file.
So just fix the bug, and everyone will be happy :-)
Thanks,
NeilBrown
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
next prev parent reply other threads:[~2010-05-28 3:50 UTC|newest]
Thread overview: 63+ 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 ` Neil Brown [this message]
2010-05-28 4:57 ` Just fix the bug - " 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
[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
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=20100528135021.3b6acb0b@notabene.brown \
--to=neilb@suse.de \
--cc=James.Bottomley@suse.de \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=arve@android.com \
--cc=bernd@petrovitsch.priv.at \
--cc=dmitry.torokhov@gmail.com \
--cc=fengguang.wu@intel.com \
--cc=florian@mickler.org \
--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=penberg@cs.helsinki.fi \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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