From: Ulf Hansson <ulf.hansson@linaro.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux PCI <linux-pci@vger.kernel.org>,
linux-usb@vger.kernel.org, Kevin Hilman <khilman@linaro.org>
Subject: Re: [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend
Date: Thu, 14 Nov 2013 17:40:55 +0100 [thread overview]
Message-ID: <CAPDyKFqYOnfWKH7BFRem5T5yGmJrOWBTDhZwoExuemMf0HQ7Ag@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1311141055470.1439-100000@iolanthe.rowland.org>
On 14 November 2013 16:59, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Thu, 14 Nov 2013, Ulf Hansson wrote:
>
>> > The reason for doing things the way they are is to avoid races between
>> > system PM callbacks and runtime PM callbacks. We don't want to have a
>> > runtime_resume routine powering up a device at the same time as a
>> > suspend routine is powering it down.
>>
>> I believe I understand why the PM core prevent this. Some subsystems
>> and drivers depends on this behaviour, but I wonder if we should
>> consider this as common cases or more like special cases?
>>
>> For those drivers that potentially could rely on runtime PM (and it's
>> callbacks) to inactivate the device during system suspend, and thus
>> don't have issues with races you describe above, the current behaviour
>> in the PM core adds unnecessary complexity for these drivers to handle
>> system suspend.
>
> What unnecessary complexity?
>
> Bear in mind that drivers _cannot_ rely on runtime PM to inactivate a
> device during system suspend. The user can always prevent a device
> from going into runtime suspend by writing "on" to the
> /sys/.../power/control file.
Good that you brought this up. From my point of view I think the sysfs
for runtime PM could be debated whether it should exist at all, at
least in it's current form.
Anyway, if userspace decides to prevent runtime_suspend, I guess it
will have take the consequences for it as well. :-)
>
>> Drivers/buses/power_domains that handles runtime PM enabled devices,
>> will, as you also have pointed out earlier, need to implement the
>> .suspend callback (suspend_late or suspend_noirq might work as well)
>> and the corresponding .resume callback. This just for the sake of
>> making sure all their runtime enabled devices gets fully inactivated
>> during system suspend.
>>
>> I wonder if we somehow should move the responsibility of preventing
>> "runtime suspend" as a part of the system suspend, down to the driver
>> to decide instead of the PM core?
>
> No, I don't think so. It would mean that every driver's suspend
> routine would have to do a pm_runtime_get of some sort. It's better to
> just leave the single runtime_get call in the PM core.
In the end I suppose what case that is most common should win. :-) At
the same time, we should go slowly forward and it is probably not
realistic to convert each and every driver in one go.
So as a way forward, I am thinking of a similar approach as you
suggested with the "generic" suspend_late. But instead add a new
runtime PM API, which intent is to let drivers to specify for PM core,
if it should care to prevent the runtime suspend from happen during
system system - or not. Could that work?
Kind regards
Ulf Hansson
>
> Alan Stern
>
next prev parent reply other threads:[~2013-11-14 16:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 16:29 [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend Ulf Hansson
2013-11-13 19:16 ` Alan Stern
2013-11-13 22:21 ` Rafael J. Wysocki
2013-11-14 13:21 ` Ulf Hansson
2013-11-14 15:59 ` Alan Stern
2013-11-14 16:40 ` Ulf Hansson [this message]
2013-11-14 17:57 ` Alan Stern
2013-11-15 8:44 ` Ulf Hansson
2013-11-15 9:29 ` Bjørn Mork
2013-11-15 10:34 ` Ulf Hansson
2013-11-15 15:22 ` Alan Stern
2013-11-18 13:27 ` Ulf Hansson
2013-11-18 15:17 ` Alan Stern
2013-11-19 12:21 ` Ulf Hansson
2013-11-19 13:21 ` Rafael J. Wysocki
2013-11-19 15:35 ` Alan Stern
2013-11-19 16:45 ` Kevin Hilman
2013-11-19 18:03 ` Alan Stern
2013-11-19 18:43 ` Kevin Hilman
2013-11-21 9:00 ` Ulf Hansson
2013-11-21 15:54 ` Alan Stern
2013-11-22 8:19 ` Ulf Hansson
2013-11-22 12:06 ` Rafael J. Wysocki
2013-11-20 10:52 ` Ulf Hansson
[not found] ` <20131120112303.GA5123@amd.pavel.ucw.cz>
2013-11-20 11:53 ` Rafael J. Wysocki
2013-11-20 12:43 ` Ulf Hansson
2013-11-20 16:58 ` Alan Stern
2013-11-20 16:55 ` Alan Stern
2013-11-13 22:13 ` Rafael J. Wysocki
2013-11-14 14:32 ` Ulf Hansson
2013-11-14 15:55 ` Alan Stern
2013-11-21 9:11 ` Ulf Hansson
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=CAPDyKFqYOnfWKH7BFRem5T5yGmJrOWBTDhZwoExuemMf0HQ7Ag@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@linaro.org \
--cc=len.brown@intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--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).