linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.linux-foundation.org, linux-omap@vger.kernel.org,
	Kevin Hilman <khilman@ti.com>,
	Magnus Damm <magnus.damm@gmail.com>,
	Paul Walmsley <paul@pwsan.com>
Subject: Re: [linux-pm] calling runtime PM from system PM methods
Date: Fri, 17 Jun 2011 21:47:13 +0200	[thread overview]
Message-ID: <201106172147.13189.rjw@sisk.pl> (raw)
In-Reply-To: <201106170048.37072.rjw@sisk.pl>

On Friday, June 17, 2011, Rafael J. Wysocki wrote:
> On Thursday, June 16, 2011, Alan Stern wrote:
> > On Wed, 15 Jun 2011, Kevin Hilman wrote:
> > 
> > > "Rafael J. Wysocki" <rjw@sisk.pl> writes:
> > > 
> > > > On Wednesday, June 15, 2011, Kevin Hilman wrote:
> > > 
> > > [...]
> > > 
> > > >>
> > > >> From a device driver perspective, system PM is just runtime
> > > >> PM where the "idleness" was forced and only a subset of possible wakeup
> > > >> sources are enabled.
> > > >
> > > > Oh well, I wonder how much of a difference would make you think those things
> > > > are really different. ;-)
> > > 
> > > Seeing a description of the differences would help.  So far the list is
> > > rather short: wakeups and forcibly quieting the hardware.
> > 
> > Another difference is that the user can forbid runtime power management 
> > of any device through the power/control attribute, independently of 
> > system sleeps.
> > 
> > Yet another difference arises because during system PM, the PM
> > workqueue is frozen.  If a driver relies on asynchronous runtime PM
> > then nothing will happen.  This may not apply to you, but it applies to
> > plenty of other drivers.
> > 
> > > I guess I still don't see why system PM cannot be viewed as a special
> > > case of runtime PM, so how about a specific question: From a device
> > > driver perspective, how is system PM anything other than
> > > manually/forcibly creating the right conditions for a runtime PM
> > > transition to happen?
> > 
> > What you're missing is that runtime PM has two separate aspects: a 
> > hardware/power aspect and an administrative aspect.  In terms of 
> > hardware/power it is very similar to system PM, but in administrative 
> > terms it is quite different.
> > 
> > Another thing you need to realize: Rafael is open to the idea that
> > subsystems may be designed specifically to allow drivers to use runtime
> > PM during their ->suspend and ->resume callbacks.  However in the
> > period between ->suspend returning and ->resume being called, runtime
> > PM should _not_ be used.  In particular, this includes the times when
> > ->suspend_noirq and ->resume_noirq are called -- and these are the
> > routines which are often expected to do the real work of setting the
> > device's power state.
> 
> To be precise, my opinion is that calling pm_runtime_suspend() or
> pm_runtime_put_sync() from a driver's .suspend() callback always is a bad
> idea, because it leads to unnecessary complications and doesn't guarantee
> that the desired action will take place at all.  That said I don't really
> think that the PM core should actively prevent that from being done,
> because it's not a direct correctness issue.  Using the runtime PM framework
> after suspend_device_irqs() has run is a different problem, though, and
> in my opinion the PM core should prevent that from being done, this way or
> another.

Having considered that a bit more I see that, in fact, commit
e8665002477f0278f84f898145b1f141ba26ee26 (PM: Allow pm_runtime_suspend() to
succeed during system suspend) has introduced at least one regression.
Namely, the PCI bus type runs pm_runtime_resume() in its .prepare()
callback to guarantee that devices will be in a well known state before
the PCI .suspend() and .suspend_noirq() callbacks are executed.
Unfortunately, after commit e8665002477f0278f84f898145b1f141ba26ee26 this
isn't valid any more, because devices can be runtime-suspend after the
pm_runtime_resume() in .prepare() has run.

USB seems to do something similar in choose_wakeup().

So, either the both of these subsystems should be modified to use
pm_runtime_get_sync() and then pm_runtime_put_<something>() some time
during resume, or we should revert commit e8665002477f0278f84f898145b1f141ba26ee26.

Quite frankly, which shouldn't be a surprise to anyone at this point, I'd
prefer to revert that commit for 3.0.

Thanks,
Rafael

  reply	other threads:[~2011-06-17 19:46 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02  0:05 calling runtime PM from system PM methods Kevin Hilman
2011-06-02 14:18 ` [linux-pm] " Alan Stern
2011-06-02 17:10   ` Kevin Hilman
2011-06-02 18:38     ` Alan Stern
2011-06-06 18:29     ` Rafael J. Wysocki
2011-06-06 19:16       ` Alan Stern
2011-06-06 22:25       ` Kevin Hilman
2011-06-07 13:55         ` Alan Stern
2011-06-07 21:32         ` Rafael J. Wysocki
2011-06-07 22:34           ` Kevin Hilman
2011-06-08 22:50           ` Kevin Hilman
2011-06-09  5:29             ` Magnus Damm
2011-06-09 13:56             ` Alan Stern
2011-06-10 14:36               ` Mark Brown
2011-06-10 14:51                 ` Alan Stern
2011-06-10 15:21                   ` Mark Brown
2011-06-10 15:45                     ` Alan Stern
2011-06-10 15:57                       ` Mark Brown
2011-06-10 17:17                         ` Alan Stern
2011-06-10 17:31                           ` Mark Brown
2011-06-10 18:38                             ` Rafael J. Wysocki
2011-06-10 18:42                               ` Mark Brown
2011-06-10 20:27                                 ` Rafael J. Wysocki
2011-06-10 21:27                                   ` Alan Stern
2011-06-11 11:42                                   ` Mark Brown
2011-06-11 20:56                                     ` Rafael J. Wysocki
2011-06-13 12:22                                       ` [linux-pm] " Mark Brown
2011-06-10 18:49                 ` Rafael J. Wysocki
2011-06-10 18:54                   ` Mark Brown
2011-06-10 20:45                     ` Rafael J. Wysocki
2011-06-10 23:52               ` Kevin Hilman
2011-06-11 16:42                 ` Alan Stern
2011-06-11 22:46                   ` Rafael J. Wysocki
2011-06-12 15:59                     ` Alan Stern
2011-06-12 18:27                       ` Rafael J. Wysocki
2011-06-15 21:54                     ` Kevin Hilman
2011-06-16  0:01                       ` Rafael J. Wysocki
2011-06-16  1:17                         ` Kevin Hilman
2011-06-16 14:27                           ` Alan Stern
2011-06-16 22:48                             ` Rafael J. Wysocki
2011-06-17 19:47                               ` Rafael J. Wysocki [this message]
2011-06-17 20:04                                 ` Alan Stern
2011-06-17 21:29                                   ` Rafael J. Wysocki
2011-06-18 11:08                                     ` Rafael J. Wysocki
2011-06-18 15:31                                       ` Alan Stern
2011-06-18 21:01                                         ` Rafael J. Wysocki
2011-06-18 23:57                                           ` Rafael J. Wysocki
2011-06-19  1:42                                             ` Alan Stern
2011-06-19 14:04                                               ` Rafael J. Wysocki
2011-06-19 15:01                                                 ` Alan Stern
2011-06-19 19:36                                                   ` Rafael J. Wysocki
2011-06-20 14:39                                                     ` Alan Stern
2011-06-20 19:53                                                       ` Rafael J. Wysocki
2011-06-16 22:30                           ` Rafael J. Wysocki
2011-06-10 23:14           ` Kevin Hilman
2011-06-11 16:27             ` Alan Stern
2011-06-11 23:13             ` Rafael J. Wysocki
2011-06-06 18:01 ` 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=201106172147.13189.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=magnus.damm@gmail.com \
    --cc=paul@pwsan.com \
    --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).