public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Bartłomiej Zimoń" <uzi18@o2.pl>
Cc: Andy Walls <awalls@radix.net>,
	Daniel Borkmann <danborkmann@googlemail.com>,
	linux-kernel@vger.kernel.org,
	pm list <linux-pm@lists.linux-foundation.org>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [suspend/resume] Re: userspace notification from module
Date: Sun, 3 Jan 2010 00:29:22 +0100	[thread overview]
Message-ID: <201001030029.22449.rjw@sisk.pl> (raw)
In-Reply-To: <7cf4f51f.5fc2a5cd.4b3fc3ad.c849c@o2.pl>

On Saturday 02 January 2010, Bartłomiej Zimoń wrote:
> 
> Dnia 2 stycznia 2010 22:01 "Rafael J. Wysocki" <rjw@sisk.pl> napisał(a):
> 
> > On Saturday 02 January 2010, Bartłomiej Zimoń wrote:
> > > Dnia 2 stycznia 2010 16:56 	Daniel Borkmann <danborkmann@googlemail.com> napisał(a):
> > > > Hi Andy,
> > > > 
> > > > 2010/1/2 Andy Walls <awalls@radix.net>:
> > > > > Why not:
> > > > >
> > > > > a. write a module that implements a device node that supports poll(),
> > > > > and
> > > > >
> > > > > b. have a user space process select() on the fd for read or exception
> > > > > notification
> > > > >
> > > > > ?
> > > > 
> > > > This is, of course, another possible solution that is more "cleaner"
> > > > than the one with the signals.
> > > > Then, your userspace program would have another thread polling for the
> > > > device node. Question is which timeout would be appropriate to be "CPU
> > > > friendly" and to keep notification latency short?
> > > > 
> > > 
> > > Just need as fast as possible solution and on the other hand acceptable for kernel sources.
> > > Usually programs needs just to disconnect something or set one flag.
> > > Even if program will have no time for this it could be enough just to send this precious info.
> > 
> > Perhaps I don't understand correctly what you're trying to achieve, but at the
> > moment suspend is always started from user space, this way or another, and on
> > the majority (all?) of the modern distros pm-utils is involved in that.
> > So, why don't you provide a pm-utils hook for your process (like, for example,
> > NetworkManager)?
> > 
> 
> Thanks for Your answare.
> Some points of my idea:
> - don't think everyone want to use pm-utils (didn't say it is bad)

That certainly is true, but I think these people won't have a problem setting
up their suspend scripts to trigger the notification anyway. :-)

Point is, suspend hooks are used anyway by almost everyone (due to graphics,
networking, faulty drivers), so I think you could just use this mechanism, be it
pm-utils or something else.

To put it in a different way, you apparently want the kernel to notify the user
space of an event originating from the user space and my question is why not
to set up the user space to generate the notification without relying on the
kernel to do that.

> - this code is standard for all implementation of suspend/hibernate/resume

I guess you mean the existing kernel-side suspend/hibernate code.

Sure, it is, but your module is going to export the kernel's internal interface
outside the kernel, turning it into a real API and that is a _big_ _deal_.  The
reason why it is a big deal is that while we often change the kernel's internal
interfaces, we don't change APIs.  Once created, an API (I mean a real
userland-kernel interface) is very difficult to change, because that most often
leads to regressions which are quite nasty from the user's point of view.

So, basically, you want us to declare that the kernel's internal
suspend/hibernate notification mechanism won't change in the future, which is
not something I'm going to do at this point.  Moreover, it hasn't been designed
as an API and I don't think it's really suitable for this purpose.

At least, that requires some more discussion, so please tell us why you need
the kernel to notify the user space about suspend/hibernation.  IOW, what's the
final purpose of this?  [Added some CCs.]

> - it is small
> - it have less overhead, dont need dbus and all rest services.

That could have been a good argument if those services had not been used
already, but that's not the case.

> - could be even used partialy by pm-utils
> - it is perfect just to notify about event

OK, but why exactly do _you_ need that to happen?

There's one important drawback of making the kernel generate the notification.
Namely, even if your userspace task is notified by the kernel of a PM event,
that doesn't mean it'll have the time to act upon that, because the kernel will
attempt to freeze it right after the notification has been sent.  This means
you'd need a way to make the kernel wait for your user space process to finish
it's job before continuing the suspend/hibernate process.  Otherwise it's not
going to be very useful.

Rafael

  parent reply	other threads:[~2010-01-02 23:29 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-02 13:29 userspace notification from module Bartłomiej Zimoń
2010-01-02 14:04 ` Daniel Borkmann
2010-01-02 14:27   ` [suspend/resume] " Bartłomiej Zimoń
2010-01-02 15:11     ` Oliver Neukum
     [not found]     ` <6f52f5b81001020713j5435cfadr1143806a9026adc2@mail.gmail.com>
2010-01-02 15:15       ` Daniel Borkmann
2010-01-02 15:40         ` Andy Walls
2010-01-02 15:56           ` Daniel Borkmann
2010-01-02 18:26             ` Bartłomiej Zimoń
2010-01-02 21:01               ` Rafael J. Wysocki
     [not found]                 ` <7cf4f51f.5fc2a5cd.4b3fc3ad.c849c@o2.pl>
2010-01-02 23:29                   ` Rafael J. Wysocki [this message]
     [not found]                     ` <65e5aef6.33251eb4.4b3fecf4.a2f99@o2.pl>
2010-01-03  9:30                       ` Daniel Borkmann
2010-01-03 10:06                         ` Daniel Borkmann
     [not found]                           ` <43bd3f9d.71702a8b.4b407900.b542@o2.pl>
2010-01-03 21:49                             ` Rafael J. Wysocki
2010-01-04 13:38                               ` Stefan Seyfried
2010-01-03 21:33                         ` Rafael J. Wysocki
2010-01-03 21:29                       ` Rafael J. Wysocki
     [not found]                         ` <24fb84fa.38887c91.4b411ffd.e7f1f@o2.pl>
2010-01-03 23:30                           ` Rafael J. Wysocki
2010-01-03 23:35                             ` Bartłomiej Zimoń
2010-01-03 23:45                               ` Rafael J. Wysocki
2010-01-04  0:51                                 ` Bartłomiej Zimoń
2010-01-04  1:06                                   ` Bartłomiej Zimoń
2010-01-04 19:43                                   ` Rafael J. Wysocki
2010-01-05  9:07                                     ` [linux-pm] " Anders Eriksson
     [not found]                                       ` <7e89c5d.77f82021.4b43a8d7.127e1@o2.pl>
2010-01-05 21:23                                         ` Rafael J. Wysocki
2010-01-05 22:12                                           ` Bartłomiej Zimoń
2010-01-05 23:03                                             ` Rafael J. Wysocki
     [not found]                                               ` <1ab86ec9.7bc73105.4b43cd45.c2747@o2.pl>
2010-01-06 14:35                                                 ` Anders Eriksson
2010-01-06 20:37                                                   ` [linux-pm] [suspend/resume] Re: userspace notific ation " Bartłomiej Zimoń
2010-01-06 20:49                                                     ` Roland Dreier
2010-01-06 20:56                                                       ` Roland Dreier
2010-01-15 20:02                                                   ` [linux-pm] [suspend/resume] Re: userspace notification " Pavel Machek
2010-01-05 21:26                                       ` Stefan Seyfried
     [not found]                                         ` <11f818a7.4b53f68a.4b43bb9b.b3a7f@o2.pl>
2010-01-05 23:05                                           ` Rafael J. Wysocki
2010-01-04 12:46                                 ` Daniel Borkmann
2010-01-04 19:45                                   ` Rafael J. Wysocki
2010-01-03 17:20                     ` Bartłomiej Zimoń
2010-01-03 21:50                       ` Rafael J. Wysocki
2010-01-09 10:32                 ` Pavel Machek
2010-01-09 13:40                   ` Rafael J. Wysocki
2010-01-15 20:03                     ` Pavel Machek
2010-01-15 22:14                       ` Rafael J. Wysocki
2010-01-16  3:00                         ` Eric Miao
2010-01-16 17:00                           ` Stanislav Brabec
2010-01-16 18:12                             ` Pavel Machek
2010-01-16 22:05                               ` Rafael J. Wysocki
2010-01-16 22:19                                 ` Pavel Machek
2010-01-16 22:25                                   ` Pavel Machek
2010-01-16 22:31                                     ` Rafael J. Wysocki
2010-01-16 22:26                                   ` Rafael J. Wysocki
2010-01-17 13:07                                     ` Pavel Machek
2010-01-17 13:26                                       ` Russell King - ARM Linux
2010-01-19  5:15                                         ` Pavel Machek
2010-01-16 22:32                                 ` Russell King - ARM Linux
2010-01-16 18:12                           ` Pavel Machek
2010-01-16 18:12                         ` Pavel Machek
2010-01-16 22:07                           ` Rafael J. Wysocki
2010-01-16 22:14                             ` Pavel Machek
2010-01-16 22:21                               ` Rafael J. Wysocki
2010-01-02 21:20               ` Bartłomiej Zimoń
2010-01-02 14:31   ` Bartłomiej Zimoń
  -- strict thread matches above, loose matches on Subject: below --
2010-01-02 22:34 Bartłomiej Zimoń
2010-01-03  8:31 Bartłomiej Zimoń
2010-01-03 11:06 Bartłomiej Zimoń
2010-01-03 23:17 Bartłomiej Zimoń

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=201001030029.22449.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=awalls@radix.net \
    --cc=danborkmann@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=stern@rowland.harvard.edu \
    --cc=uzi18@o2.pl \
    /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