From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"Linux-pm mailing list" <linux-pm@lists.linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Arjan van de Ven <arjan@infradead.org>
Subject: Re: [RFC] Run-time PM framework (was: Re: [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6))
Date: Sun, 5 Jul 2009 23:47:54 +0200 [thread overview]
Message-ID: <200907052347.55717.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0907041938580.10275-100000@netrider.rowland.org>
On Sunday 05 July 2009, Alan Stern wrote:
> On Sat, 4 Jul 2009, Rafael J. Wysocki wrote:
>
> > > As for whether or not we should actually call cancel_work... Which is
> > > more expensive: Calling cancel_work when no work is pending, or letting
> > > the work item run when it doesn't have anything to do? Probably the
> > > latter.
> >
> > Agreed, but that doesn't affect functionality. We can get the desired
> > functionality without the cancel_work() patch and then optimize things along
> > with that patch. This way it'll be easier to demontrate the benefit of it.
>
> Good idea.
>
> > That almost entirely depends on the bus type. For PCI and probably PNP as well
> > there's a notion of ACPI low power states and there are AML methods to put the
> > devices into these states. Unfortunately, the ACPI low power state to put the
> > device into depends on the target sleep state of the system, so these devices
> > will probably have to be put into D0 before system suspend anyway.
> >
> > I think that the bus type can handle this as long as it knows the state the
> > device is in before system suspend. So, the only thing the core should do is
> > to block the execution of run-time PM framework functions during system
> > sleep and resume. The state it leaves the device in shouldn't matter.
> >
> > So, I think we can simply freeze the workqueue, set the 'disabled' bit for each
> > device and wait for all run-time PM operations on it in progress to complete.
> >
> > In the 'disabled' state the bus type or driver can modify the run-time PM
> > status to whatever they like anyway. Perhaps we can provide a helper to
> > change 'request type' to RPM_REQ_NONE.
>
> The only modification that really makes sense is like you said, going
> back to full power in preparation for the platform suspend operation.
> Therefore perhaps we should allow pm_runtime_resume to work even when
> rpm_disabled is set. And if we're going to cancel pending suspend and
> idle requests, then rpm_request would normally be RPM_REQ_NONE anyway.
After we've disabled run-time PM with pm_runtime_disable(), the bus type
and driver can do whatever they like with the device, we don't care. However,
they need to make sure that the state of the device will match its run-time PM
status when its run-time PM is enabled again.
> Which leaves only the question of what to do when a resume request is
> pending...
I think the pm_runtime_disable() can carry out a synchronous wake-up if it
sees a pending resume request. That would make sense in general, IMO, becuase
having a resume request pending usually means there's I/O to process and it's
better to allow the device to process that I/O before disabling the run-time
PM of it.
To put it differently, if there's a resume request pending, the run-time PM of
the device should be disabled while in the 'active' state rather than while in
the 'suspended' state.
Now, if we do that, the problem of run-time resume requests pending while
entering a system sleep state can be solved. Namely, we can make
pm_runtime_disable() return a result that will be -EBUSY if a pending resume
request is found by it and 0 otherwise. Then, that result can be used by
dpm_prepare() to decide whether to continue suspend or to terminate it if
the device is a wake-up one.
> > So, I guess we have the majority of things clarified and perhaps its time to
> > write a patch for further discussion. :-)
>
> Go ahead!
In fact I've already done that, but I need to have a final look at it to check
if there are no obvious mistakes in there.
Best,
Rafael
next prev parent reply other threads:[~2009-07-05 21:47 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 23:21 [PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 3) Rafael J. Wysocki
2009-06-23 17:00 ` Rafael J. Wysocki
2009-06-23 17:10 ` Alan Stern
2009-06-24 0:08 ` Rafael J. Wysocki
2009-06-24 0:36 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 4) Rafael J. Wysocki
2009-06-24 19:24 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 5) Rafael J. Wysocki
2009-06-24 21:30 ` Alan Stern
2009-06-25 16:49 ` [linux-pm] " Alan Stern
2009-06-25 21:58 ` Rafael J. Wysocki
2009-06-25 23:17 ` Rafael J. Wysocki
2009-06-26 18:06 ` Alan Stern
2009-06-26 20:46 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6) Rafael J. Wysocki
2009-06-26 21:13 ` Alan Stern
2009-06-26 22:32 ` Rafael J. Wysocki
2009-06-27 1:25 ` Alan Stern
2009-06-27 14:51 ` Alan Stern
2009-06-27 21:51 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 7) Rafael J. Wysocki
2009-06-28 10:25 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6) Rafael J. Wysocki
2009-06-28 21:07 ` Alan Stern
2009-06-29 0:15 ` Rafael J. Wysocki
2009-06-29 3:05 ` Alan Stern
2009-06-29 14:09 ` Rafael J. Wysocki
2009-06-29 14:29 ` Alan Stern
2009-06-29 14:54 ` Rafael J. Wysocki
2009-06-29 15:27 ` Alan Stern
2009-06-29 15:55 ` Rafael J. Wysocki
2009-06-29 16:10 ` Alan Stern
2009-06-29 16:39 ` Rafael J. Wysocki
2009-06-29 17:29 ` Alan Stern
2009-06-29 18:25 ` Rafael J. Wysocki
2009-06-29 19:25 ` Alan Stern
2009-06-29 21:04 ` Rafael J. Wysocki
2009-06-29 22:00 ` Alan Stern
2009-06-29 22:50 ` Rafael J. Wysocki
2009-06-30 15:10 ` Alan Stern
2009-06-30 22:30 ` [RFC] Run-time PM framework (was: Re: [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6)) Rafael J. Wysocki
2009-07-01 15:35 ` Alan Stern
2009-07-01 22:19 ` Rafael J. Wysocki
2009-07-02 15:42 ` Rafael J. Wysocki
2009-07-02 15:55 ` Alan Stern
2009-07-02 17:50 ` Rafael J. Wysocki
2009-07-02 19:53 ` Alan Stern
2009-07-02 23:05 ` Rafael J. Wysocki
2009-07-03 20:58 ` Alan Stern
2009-07-03 23:57 ` Rafael J. Wysocki
2009-07-04 3:12 ` Alan Stern
2009-07-04 21:27 ` Rafael J. Wysocki
2009-07-05 14:50 ` Alan Stern
2009-07-05 21:47 ` Rafael J. Wysocki [this message]
2009-06-26 21:49 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 5) Rafael J. Wysocki
2009-06-25 14:57 ` Magnus Damm
2009-06-26 22:02 ` 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=200907052347.55717.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=arjan@infradead.org \
--cc=gregkh@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mingo@elte.hu \
--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