mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Oliver Neukum <oliver@neukum.org>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Woodruff, Richard" <r-woodruff2@ti.com>,
	"Arjan van de Ven" <arjan@infradead.org>,
	"Kyle Moffett" <kyle@moffetthome.net>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"pm list" <linux-pm@lists.linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Pavel Machek" <pavel@ucw.cz>,
	"Nigel Cunningham" <nigel@nigel.suspend2.net>,
	"Matthew Garrett" <mjg59@srcf.ucam.org>,
	"mark gross" <mgross@linux.intel.com>,
	"Uli Luckas" <u.luckas@road.de>,
	"Igor Stoppa" <igor.stoppa@nokia.com>,
	"Brian Swetland" <swetland@google.com>,
	"Len Brown" <lenb@kernel.org>
Subject: Re: [RFD] Automatic suspend
Date: Sat, 21 Feb 2009 00:40:48 +0100	[thread overview]
Message-ID: <200902210040.50344.rjw@sisk.pl> (raw)
In-Reply-To: <200902210012.08088.oliver@neukum.org>

On Saturday 21 February 2009, Oliver Neukum wrote:
> Am Freitag 20 Februar 2009 16:56:59 schrieb Rafael J. Wysocki:
> 
> > OK, so what about the following approach:
> >
> > * Keep the decision making logic (power manager etc.) in user space. 
> > Reasons: - It may be arbitrarily complicated
> 
> Therefore something functionally equivalent to wakelocks
> is needed.
> 
> >   - It may include such things as s2ram quirks or hal quirks needed for
> > some graphics adapters
> 
> If you can't do that I'd say the situation is hopeless.
> You need full support for all devices including graphics
> cards.

We can't do the quirks from the kernel and that's one of the reasons why I
think user space should start automatic suspend (it can do the quirks if
necessary).

> > * Have a per-process (per-task or per-thread group, but the former would be
> >   easier IMO) "I_do_not_want_automatic_suspend_to_occur" flag.
> 
> I think you got the default logic inverted.

Well, it may be "suspend_possible_right_now" just as well. :-)
 
> > * Add a new callback, say ->acknowledge(), to the set of each driver's PM
> >   operations, that will be called to check if the driver has anything
> > against automatic suspend (true - suspend can happen right now, false -
> > suspend can't happen).
> >
> > * Introduce /sys/power/sleep that will work like /sys/power/state, but:
> >   - First, it will call ->acknowledge() for each driver (via bus types) to
> >     check if any of them wants to postpone the suspend (this will prevent
> > tasks from being frozen unnecessarily if it is known in advance that the
> > suspend should not happen at the moment).
> 
> Ideally most devices should be already suspended, so I am not
> sure a new callback is really needed. In any cases it is an optimization
> only.

Yes, it is, but an important one (the total time of freezing and thawing tasks
can be substantial).

> >   - Next, it will check the "I_do_not_want_automatic_suspend_to_occur" flag
> >     of each process and the suspend will be aborted if it is true for any
> > of them (quite frankly, I think that should be integrated with the freezer,
> > in particular the tasks that have TIF_FREEZE set shouldn't be able to set
> > this flag and it should be checked in the freezer loop for every task with
> > TIF_FREEZE unset).
> 
> Why in this order?

Because the freezing of tasks takes time and it would be a bad idea to do it
unnecessarily.

> >   - Next, it will proceed with suspending just like /sys/power/state does
> > (the drivers that missed the opportunity to abort the suspend by returning
> > 'false' from ->acknowledge() can still abort the suspend by failing their
> > ->suspend() routines).
> >
> > Then, the decision making logic will be able to use /sys/power/sleep
> > whenever it wishes to and the kernel will be able to refuse to suspend if
> > it's not desirable at the moment.
> 
> I think everything that uses a "trigger" logic from user space is not
> a good idea. This will necessary introduce a race between the decision
> and the execution during which circumstances can change.

Well, in this particulare case if the circumstances change in the meantime,
the kernel will just refuse to suspend.  Also, even if the kernel starts
automatic suspend, it _still_ is possible that the conditions change in the
meantime (for example, one of the tasks may enter a state in which it wouldn't
like to the suspend to happen just after the operation is started and before
it's frozen).

> So it seems to me that an allow/disallow system from user space
> would be better.

I don't really see the benefit, but I can easily see drawbacks (the handling
of graphics that requires user space quirks, for instance).

Thanks,
Rafael

  reply	other threads:[~2009-02-20 23:41 UTC|newest]

Thread overview: 195+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 23:10 Rafael J. Wysocki
2009-02-16  0:44 ` Arjan van de Ven
2009-02-16  2:12   ` Benjamin Herrenschmidt
2009-02-16  2:20     ` Arjan van de Ven
2009-02-16  3:23       ` Benjamin Herrenschmidt
2009-02-16  3:30         ` Arjan van de Ven
2009-02-16 23:05         ` Pavel Machek
2009-02-16  7:06       ` Oliver Neukum
2009-02-16 15:40         ` Arjan van de Ven
2009-02-16 16:48           ` Oliver Neukum
2009-02-16 17:31             ` Arjan van de Ven
2009-02-16 20:08               ` Kyle Moffett
2009-02-16 20:28                 ` Arjan van de Ven
2009-02-16 20:39                 ` Alan Stern
2009-02-16 20:45                   ` Arjan van de Ven
2009-02-16 21:32                     ` Woodruff, Richard
2009-02-16 21:52                       ` Arjan van de Ven
2009-02-16 22:36                         ` Woodruff, Richard
2009-02-16 22:59                           ` Arjan van de Ven
2009-02-16 23:19                             ` Rafael J. Wysocki
2009-02-16 23:23                               ` Matthew Garrett
2009-02-17 10:12                                 ` Oliver Neukum
2009-02-17 13:58                                 ` Mark Brown
2009-02-17 14:20                                 ` Brian Swetland
2009-02-17 14:24                                   ` Matthew Garrett
2009-02-17 14:56                                     ` Oliver Neukum
2009-02-17 14:46                                   ` Arjan van de Ven
2009-02-17 14:51                                     ` Matthew Garrett
2009-02-17 14:56                                       ` Arjan van de Ven
2009-02-17 15:32                                         ` Woodruff, Richard
2009-02-18  0:04                                           ` Arjan van de Ven
2009-02-18  0:18                                             ` Woodruff, Richard
2009-02-18  5:35                                               ` Arjan van de Ven
2009-02-18  0:52                                             ` mark gross
2009-02-18  5:11                                             ` Arve Hjønnevåg
2009-02-18  5:55                                               ` Arjan van de Ven
2009-02-18 15:15                                         ` Matthew Garrett
2009-02-18 15:20                                           ` Woodruff, Richard
2009-02-17 14:58                                       ` Igor Stoppa
2009-02-17 15:28                                     ` Brian Swetland
2009-02-18  0:55                                       ` mark gross
2009-02-18  2:40                                       ` Benjamin Herrenschmidt
2009-02-18 17:48                                         ` Jesse Barnes
2009-02-18 17:52                                           ` Matthew Garrett
2009-02-18 18:01                                             ` Jesse Barnes
2009-02-18 22:05                                             ` Benjamin Herrenschmidt
2009-03-01 22:51                                       ` Pavel Machek
2009-02-27 10:00                                   ` Pavel Machek
2009-02-18  0:45                                 ` mark gross
2009-02-20  5:35                                 ` Arve Hjønnevåg
2009-02-20 15:27                                   ` Arjan van de Ven
2009-02-20 18:22                                 ` Pavel Machek
2009-02-20 18:26                                   ` Matthew Garrett
2009-02-20 20:49                                     ` Rafael J. Wysocki
2009-02-20 22:43                                       ` Arve Hjønnevåg
2009-02-16 23:41                               ` Arjan van de Ven
2009-02-16 23:08                           ` Rafael J. Wysocki
2009-02-17  3:09                             ` Alan Stern
2009-02-17 23:21                               ` Rafael J. Wysocki
2009-02-18  4:46                                 ` Arve Hjønnevåg
2009-02-18 21:17                                   ` Rafael J. Wysocki
2009-02-18 22:35                                     ` Arve Hjønnevåg
2009-02-18 22:44                                       ` Oliver Neukum
2009-02-18 23:04                                       ` Rafael J. Wysocki
2009-02-18 23:31                                         ` Alan Stern
2009-02-19 12:56                                           ` Rafael J. Wysocki
2009-02-19 14:59                                             ` Alan Stern
2009-02-19 21:15                                               ` Rafael J. Wysocki
2009-02-19 21:56                                                 ` Brian Swetland
2009-02-19 22:08                                                 ` Alan Stern
2009-02-19 22:21                                                   ` Rafael J. Wysocki
2009-02-19 22:58                                                     ` Oliver Neukum
2009-02-20 10:46                                                       ` Rafael J. Wysocki
2009-02-20 22:05                                                         ` Oliver Neukum
2009-02-20 22:44                                                           ` Rafael J. Wysocki
2009-02-20 23:11                                                           ` Arve Hjønnevåg
2009-02-20 23:20                                                             ` Oliver Neukum
2009-02-21  1:59                                                               ` Arve Hjønnevåg
2009-02-20  2:39                                                   ` Arve Hjønnevåg
2009-02-20 10:49                                                     ` Rafael J. Wysocki
2009-02-20 11:26                                                       ` Arve Hjønnevåg
2009-02-20 15:56                                                         ` Rafael J. Wysocki
2009-02-20 16:07                                                           ` Kyle Moffett
2009-02-20 20:56                                                             ` Rafael J. Wysocki
2009-02-20 21:02                                                               ` Rafael J. Wysocki
2009-02-20 23:03                                                           ` Arve Hjønnevåg
2009-02-20 23:57                                                             ` Rafael J. Wysocki
2009-02-21  1:08                                                               ` Arve Hjønnevåg
2009-02-21  9:47                                                                 ` Rafael J. Wysocki
2009-02-21 10:32                                                                   ` Arve Hjønnevåg
2009-02-21 20:20                                                                     ` Rafael J. Wysocki
2009-02-23 23:13                                                                       ` Arve Hjønnevåg
2009-02-23 23:53                                                                         ` Rafael J. Wysocki
2009-02-24  0:02                                                                           ` Arve Hjønnevåg
2009-02-27 10:12                                                                   ` Pavel Machek
2009-02-27 10:09                                                               ` Pavel Machek
2009-02-27 14:22                                                                 ` Rafael J. Wysocki
2009-02-27 14:29                                                                   ` Matthew Garrett
2009-02-27 20:54                                                                     ` Rafael J. Wysocki
2009-02-27 22:09                                                                       ` Arve Hjønnevåg
2009-02-27 22:55                                                                         ` Rafael J. Wysocki
2009-02-27 20:40                                                                   ` Pavel Machek
2009-02-27 20:55                                                                     ` Rafael J. Wysocki
2009-02-27 22:56                                                                       ` Arve Hjønnevåg
2009-02-27 23:44                                                                         ` Pavel Machek
2009-02-28  3:04                                                                           ` Arve Hjønnevåg
2009-02-28 10:18                                                                         ` Rafael J. Wysocki
2009-02-28 21:57                                                                           ` Arve Hjønnevåg
2009-02-28 22:53                                                                             ` Rafael J. Wysocki
2009-02-28 23:38                                                                               ` Arve Hjønnevåg
2009-03-01 23:17                                                                                 ` Rafael J. Wysocki
2009-03-02 23:48                                                                                   ` Arve Hjønnevåg
2009-03-03 22:39                                                                                     ` Rafael J. Wysocki
2009-03-03 23:38                                                                                       ` Arve Hjønnevåg
2009-03-04  0:49                                                                                         ` Pavel Machek
2009-03-01  0:06                                                                               ` Arve Hjønnevåg
2009-03-01  6:28                                                                                 ` Benjamin Herrenschmidt
2009-03-01  9:11                                                                                   ` Rafael J. Wysocki
2009-03-01  9:20                                                                                 ` Rafael J. Wysocki
2009-03-03  1:22                                                                                   ` Arve Hjønnevåg
2009-03-03 13:51                                                                                     ` Pavel Machek
2009-03-04  0:06                                                                                       ` Arve Hjønnevåg
2009-03-04  0:47                                                                                         ` Pavel Machek
2009-03-01 23:08                                                                                 ` Pavel Machek
2009-03-03 13:57                                                                             ` Pavel Machek
2009-03-03 23:51                                                                               ` Arve Hjønnevåg
2009-02-20 23:12                                                           ` Oliver Neukum
2009-02-20 23:40                                                             ` Rafael J. Wysocki [this message]
2009-02-20 23:45                                                               ` Matthew Garrett
2009-02-21  9:52                                                                 ` Rafael J. Wysocki
2009-02-21 16:52                                                               ` Alan Stern
2009-02-21 21:14                                                                 ` Rafael J. Wysocki
2009-02-27 10:16                                                                   ` Pavel Machek
2009-02-27 14:46                                                                     ` Alan Stern
2009-02-27 20:58                                                                       ` Rafael J. Wysocki
2009-02-22 14:03                                               ` Pavel Machek
2009-02-23 14:04                                                 ` Oliver Neukum
2009-02-27 10:18                                                   ` Pavel Machek
2009-02-27 15:22                                                     ` Oliver Neukum
2009-03-05 16:54                                                       ` Pavel Machek
2009-02-27 17:09                                                     ` Chris Friesen
2009-02-27 20:46                                                       ` Pavel Machek
2009-03-05 13:48                                           ` Pavel Machek
2009-03-01 22:56                                   ` Pavel Machek
2009-03-02  8:24                                     ` Oliver Neukum
2009-03-02 14:34                                       ` Pavel Machek
2009-03-02 15:13                                       ` Arjan van de Ven
2009-02-16 23:20               ` Oliver Neukum
2009-02-20 18:05                 ` Pavel Machek
2009-02-16  6:23   ` Roland Dreier
2009-02-16 15:38     ` Arjan van de Ven
2009-02-16 22:47     ` Pavel Machek
2009-02-16  7:02   ` Oliver Neukum
2009-02-16 21:48   ` Rafael J. Wysocki
2009-02-16 21:52     ` Peter Zijlstra
2009-02-16 21:53     ` Arjan van de Ven
2009-02-16 22:12       ` Rafael J. Wysocki
2009-02-16 22:40         ` Alan Stern
2009-02-16 22:56           ` Arjan van de Ven
2009-02-16 23:28             ` Rafael J. Wysocki
2009-02-17  2:43             ` Alan Stern
2009-02-17  2:57               ` Arjan van de Ven
2009-02-17  3:26                 ` Alan Stern
2009-02-16 23:02           ` Rafael J. Wysocki
2009-02-17  2:56             ` Alan Stern
2009-02-17 23:26               ` Rafael J. Wysocki
2009-02-18  8:53                 ` Oliver Neukum
2009-02-18 14:51                   ` Arjan van de Ven
2009-02-18 15:05                     ` Oliver Neukum
2009-02-18 15:10                       ` Alan Stern
2009-02-18 15:55                         ` Oliver Neukum
2009-02-18 16:39                           ` Alan Stern
2009-02-18 17:10                             ` Oliver Neukum
2009-02-18 15:09                     ` Alan Stern
2009-02-16 22:51     ` Pavel Machek
2009-02-16 22:55       ` Arjan van de Ven
2009-02-16 23:00       ` Rafael J. Wysocki
2009-02-16 23:18         ` Pavel Machek
2009-02-16 23:29       ` Oliver Neukum
2009-02-16 22:58 ` Pavel Machek
2009-02-16 23:13   ` Matthew Garrett
2009-02-16 23:22     ` Pavel Machek
2009-02-16 23:26       ` Matthew Garrett
2009-02-17 14:14         ` Brian Swetland
2009-02-17 14:19           ` Matthew Garrett
2009-02-17 21:57     ` mark gross
2009-02-17 22:04       ` Matthew Garrett
2009-02-17 22:19         ` Jesse Barnes
2009-02-17 23:28           ` Woodruff, Richard
2009-02-18  0:34           ` mark gross
2009-02-18 17:30       ` Chris Ball
2009-02-16 23:26   ` Rafael J. Wysocki
2009-02-22 13:46     ` Pavel Machek
2009-02-18  0:27 ` mark gross
2009-02-18 21:11   ` 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=200902210040.50344.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=arjan@infradead.org \
    --cc=arve@android.com \
    --cc=benh@kernel.crashing.org \
    --cc=igor.stoppa@nokia.com \
    --cc=kyle@moffetthome.net \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mgross@linux.intel.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=nigel@nigel.suspend2.net \
    --cc=oliver@neukum.org \
    --cc=pavel@ucw.cz \
    --cc=r-woodruff2@ti.com \
    --cc=stern@rowland.harvard.edu \
    --cc=swetland@google.com \
    --cc=u.luckas@road.de \
    /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

Powered by JetHome