From: NeilBrown <neilb@suse.de>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
mark gross <markgross@thegnar.org>,
LKML <linux-kernel@vger.kernel.org>,
John Stultz <john.stultz@linaro.org>,
Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [RFC][PATCH 0/2] PM / Sleep: Extended control of suspend/hibernate interfaces
Date: Tue, 18 Oct 2011 10:36:31 +1100 [thread overview]
Message-ID: <20111018103631.6943a97a@notabene.brown> (raw)
In-Reply-To: <201110180002.30932.rjw@sisk.pl>
[-- Attachment #1: Type: text/plain, Size: 4633 bytes --]
On Tue, 18 Oct 2011 00:02:30 +0200 "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> On Monday, October 17, 2011, NeilBrown wrote:
> > On Sun, 16 Oct 2011 00:10:40 +0200 "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> ...
> > >
> > > > But I think it is very wrong to put some hack in the kernel like your
> > > > suspend_mode = disabled
> > >
> > > Why is it wrong and why do you think it is a "hack"?
> >
> > I think it is a "hack" because it is addressing a specific complaint rather
> > than fixing a real problem.
>
> I wonder why you think that there's no real problem here.
>
> The problem I see is that multiple processes can use the suspend/hibernate
> interfaces pretty much at the same time (not exactly in parallel, becuase
> there's some locking in there, but very well there may be two different
> processes operating /sys/power/state independently of each other), while
> the /sys/power/wakeup_count interface was designed with the assumption that
> there will be only one such process in mind.
Multiple process can write to your mail box at the same time. But some how
they don't. This isn't because the kernel enforces anything, but because all
the relevant programs have an agreed protocol by which they arbitrate access.
One upon a time this involved creating a lock file with O_CREAT|O_EXCL.
These days it is fcntl locking. But it is still advisory.
In the same way - we stop multiple processes from suspending/hibernating at
the same time by having an agreed protocol by which they share access to the
resource. The kernel does not need to be explicitly involved in this.
...
> > > Well, I used to think that it's better to do things in user space. Hence,
> > > the hibernate user space interface that's used by many people. And my
> > > experience with that particular thing made me think that doing things in
> > > the kernel may actually work better, even if they _can_ be done in user space.
> > >
> > > Obviously, that doesn't apply to everything, but sometimes it simply is worth
> > > discussing (if not trying). If it doesn't work out, then fine, let's do it
> > > differently, but I'm really not taking the "this should be done in user space"
> > > argument at face value any more. Sorry about that.
> >
> > :-) I have had similar mixed experiences. Sometimes it can be a lot easier
> > to get things working if it is all in the kernel.
> > But I think that doing things in user-space leads to a lot more flexibility.
> > Once you have the interfaces and designs worked out you can then start doing
> > more interesting things and experimenting with ideas more easily.
> >
> > In this case, I think the *only* barrier to a simple solution in user-space
> > is the pre-existing software that uses the 'old' kernel interface. It seems
> > that interfacing with that is as easy as adding a script or two to pm-utils.
>
> Well, assuming that we're only going to address the systems that use PM utils.
I suspect (and claim without proof :-) that any system will have some single
user-space thing that is responsible for initiating suspend.
Every time I look at one I see a whole host of things that need to be done
just before suspend, and other things just after resume.
They used to be in /etc/apm/event.d. Now there are
in /usr/lib/pm-utils/sleep.d. I think they were in /etc/acpid once.
I've seen one thing that uses shared-library modules instead of shell scripts
on the basis that it avoids forking and goes fast (and it probably does).
But I doubt there is any interesting system where writing to /sys/power/state
is the *only* thing you need to do for a clean suspend.
So all systems will have some user-space infrastructure to support suspend,
and we just need to hook in to that.
>
> > With that problem solved, experimenting is much easier in user-space than in
> > the kernel.
>
> Somehow, I'm not exactly sure if we should throw all kernel-based solutions away
> just yet.
My rule-of-thumb is that we should reserve kernel space for when
a/ it cannot be done in user space
b/ it cannot be done efficient in user space
c/ it cannot be done securely in user space
I don't think any of those have been demonstrated yet. If/when they are it
would be good to get those kernel-based solutions out of the draw (so yes:
keep them out of the rubbish bin).
So I'd respond with "I'm not at all sure that we should throw away an
all-userspace solution just yet". Particularly because many of us seem to
still be working to understand what all the issues really are.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2011-10-17 23:36 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 19:45 [RFC][PATCH 0/2] PM / Sleep: Extended control of suspend/hibernate interfaces Rafael J. Wysocki
2011-10-13 19:49 ` [RFC][PATCH 1/2] PM / Sleep: Add mechanism to disable suspend and hibernation Rafael J. Wysocki
2011-10-13 19:50 ` [RFC][PATCH 2/2] PM / Sleep: Introduce cooperative suspend/hibernate mode Rafael J. Wysocki
2011-10-13 22:58 ` John Stultz
2011-10-14 22:49 ` Rafael J. Wysocki
2011-10-15 0:04 ` John Stultz
2011-10-15 21:29 ` Rafael J. Wysocki
2011-10-17 16:48 ` John Stultz
2011-10-17 18:19 ` Alan Stern
2011-10-17 19:08 ` John Stultz
2011-10-17 20:07 ` Alan Stern
2011-10-17 20:34 ` John Stultz
2011-10-17 20:38 ` Rafael J. Wysocki
2011-10-17 21:20 ` John Stultz
2011-10-17 21:19 ` NeilBrown
2011-10-17 21:43 ` John Stultz
2011-10-17 23:06 ` NeilBrown
2011-10-17 23:14 ` NeilBrown
2011-10-17 21:13 ` Rafael J. Wysocki
2011-10-14 5:52 ` [RFC][PATCH 0/2] PM / Sleep: Extended control of suspend/hibernate interfaces NeilBrown
2011-10-14 16:00 ` Alan Stern
2011-10-14 21:07 ` NeilBrown
2011-10-15 18:34 ` Alan Stern
2011-10-15 21:43 ` NeilBrown
2011-10-15 22:10 ` Rafael J. Wysocki
2011-10-16 2:49 ` Alan Stern
2011-10-16 14:51 ` Alan Stern
2011-10-16 20:32 ` Rafael J. Wysocki
2011-10-17 15:33 ` Alan Stern
2011-10-17 21:10 ` Rafael J. Wysocki
2011-10-17 21:27 ` Rafael J. Wysocki
2011-10-18 17:30 ` Alan Stern
2011-10-16 22:34 ` NeilBrown
2011-10-17 14:45 ` Alan Stern
2011-10-17 22:49 ` NeilBrown
2011-10-17 23:47 ` John Stultz
2011-10-18 2:13 ` NeilBrown
2011-10-18 17:11 ` Alan Stern
2011-10-18 22:55 ` NeilBrown
2011-10-19 16:19 ` Alan Stern
2011-10-20 0:17 ` NeilBrown
2011-10-20 14:29 ` Alan Stern
2011-10-21 5:05 ` NeilBrown
2011-10-21 5:23 ` lsusd - The Linux SUSpend Daemon NeilBrown
2011-10-21 16:07 ` Alan Stern
2011-10-21 22:34 ` NeilBrown
2011-10-22 2:00 ` Alan Stern
2011-10-22 16:31 ` Alan Stern
2011-10-23 3:31 ` NeilBrown
2011-10-23 8:21 ` NeilBrown
2011-10-23 12:48 ` Rafael J. Wysocki
2011-10-23 23:04 ` NeilBrown
2011-10-23 16:17 ` Alan Stern
2011-10-21 20:10 ` david
2011-10-21 22:09 ` NeilBrown
2011-10-26 14:31 ` Jan Engelhardt
2011-10-27 4:34 ` NeilBrown
2011-10-31 15:11 ` [RFC][PATCH 0/2] PM / Sleep: Extended control of suspend/hibernate interfaces Richard Hughes
2011-10-16 20:26 ` Rafael J. Wysocki
2011-10-16 23:48 ` NeilBrown
2011-10-17 15:43 ` Alan Stern
2011-10-17 22:02 ` Rafael J. Wysocki
2011-10-17 23:36 ` NeilBrown [this message]
2011-10-22 22:07 ` Rafael J. Wysocki
2011-10-23 2:57 ` NeilBrown
2011-10-23 13:16 ` Rafael J. Wysocki
2011-10-23 23:44 ` NeilBrown
2011-10-24 10:23 ` Rafael J. Wysocki
2011-10-25 2:52 ` NeilBrown
2011-10-25 7:47 ` Valdis.Kletnieks
2011-10-25 8:35 ` Rafael J. Wysocki
2011-10-23 15:50 ` Alan Stern
2011-10-27 21:06 ` Rafael J. Wysocki
2011-10-28 0:02 ` NeilBrown
2011-10-28 8:27 ` Rafael J. Wysocki
2011-10-28 15:08 ` Alan Stern
2011-10-28 17:26 ` Rafael J. Wysocki
2011-10-31 19:55 ` Ming Lei
2011-10-31 21:15 ` NeilBrown
2011-10-31 21:23 ` Ming Lei
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=20111018103631.6943a97a@notabene.brown \
--to=neilb@suse.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=markgross@thegnar.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;
as well as URLs for NNTP newsgroup(s).