From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: Question about expected behavior when PM runtime is disabled
Date: Tue, 14 Jun 2011 22:01:35 +0200 [thread overview]
Message-ID: <201106142201.35264.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1106140942370.2102-100000@iolanthe.rowland.org>
On Tuesday, June 14, 2011, Alan Stern wrote:
> On Mon, 13 Jun 2011, Rafael J. Wysocki wrote:
>
> > On Monday, June 13, 2011, Alan Stern wrote:
> > > On Mon, 13 Jun 2011, Rafael J. Wysocki wrote:
> > >
> > > > > I think we need to have the PM core call pm_runtime_get_noresume()
> > > > > before invoking the resume_noirq (or thaw_noirq or restore_noirq)
> > > > > callback, and then call pm_runtime_put_sync() after invoking the
> > > > > complete callback. This would solve your race: The put_sync would
> > > > > invoke the runtime_idle method, which would start another runtime
> > > > > suspend or autosuspend.
> > > > >
> > > > > (It used to be that the PM core called pm_runtime_get_noresume()
> > > > > earlier on, before the prepare callback. This also solved your race,
> > > > > but it caused other problems and so was changed.)
> > > > >
> > > > > It's true that subsystems could do this for themselves, but then they'd
> > > > > _all_ have to do it. So we might as well put it in the PM core.
> > > > >
> > > > > Rafael, what do you think?
> > > >
> > > > Yes, we can do that.
> > > >
> > > > I even suspect that all subsystems will end up calling pm_runtime_disable()
> > > > somewhere in the system suspend code path and pm_runtime_enable() during
> > > > system resume. It might be a good idea to do that in the core too, after
> > > > calling the subsystem's .suspend() and before calling its .resume(),
> > > > respectively.
> > >
> > > Will that bring back Kevin's problems? There was a specific commit:
> > > "PM: Allow pm_runtime_suspend() to succeed during system suspend". If
> > > the core disables runtime PM, won't he be right back where he was
> > > before?
> >
> > Not exactly, because that commit removed the pm_runtime_get_noresume()
> > done before .prepare(), which was too early. As I said before, I don't
> > see anything wrong with running pm_runtime_ helpers from .prepare() or
> > .complete(). However, to me, it is highly doubtful if there is any valid
> > reason for calling them after .suspend() has been executed. In fact, I
> > think that .suspend() should ensure that they won't be executed for the
> > given device after it has returned, so doing pm_runtime_disable() in the
> > core at this point makes sense.
> >
> > We really shouldn't allow any runtime PM callbacks to race with
> > .suspend_noirq() and .resume_noirq(), because allowing that to happen would
> > be asking for breakage.
>
> Then you suggest:
>
> Call pm_runtime_disable after .suspend;
>
> Call pm_runtime_get_noresume and pm_runtime_enable before
> .resume;
>
> Call pm_runtime_put_sync after .complete.
>
> Right?
Yes, that would be resonable IMO.
Thanks,
Rafael
next prev parent reply other threads:[~2011-06-14 20:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-10 22:54 Question about expected behavior when PM runtime is disabled Kenneth Heitke
2011-06-11 16:12 ` Alan Stern
2011-06-13 18:42 ` Kenneth Heitke
2011-06-13 19:28 ` Alan Stern
2011-06-13 19:51 ` Rafael J. Wysocki
2011-06-13 20:33 ` Alan Stern
2011-06-13 21:20 ` Rafael J. Wysocki
2011-06-14 13:47 ` Alan Stern
2011-06-14 20:01 ` Rafael J. Wysocki [this message]
2011-06-17 15:08 ` Alan Stern
2011-06-17 19:29 ` Rafael J. Wysocki
2011-06-20 23:21 ` Kevin Hilman
2011-06-20 23:27 ` 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=201106142201.35264.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-pm@lists.linux-foundation.org \
--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