From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: 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-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Kevin Hilman <khilman@linaro.org>
Subject: Re: [PATCH 0/5] PM: Enable option of re-use runtime PM callbacks at system suspend
Date: Fri, 29 Nov 2013 15:02:07 +0100 [thread overview]
Message-ID: <4064706.R9zKA4hcfi@vostro.rjw.lan> (raw)
In-Reply-To: <3006899.CPLMC2kU1a@vostro.rjw.lan>
On Friday, November 29, 2013 02:52:20 PM Rafael J. Wysocki wrote:
> On Friday, November 29, 2013 10:32:06 AM Ulf Hansson wrote:
[...]
> > For the same reasons, I believe we should trust drivers/subsystems, to
> > understand when it makes sense for them to re-use all of the runtime
> > PM callbacks during system suspend and not just the .runtime_suspend
> > callback.
> >
> > That is in principle what I and Alan, who came up with this idea, are
> > suggesting.
>
> The problem with it is, as I said, the subsystem-level code you're calling
> back through pm_generic_suspend_late_runtime() (and the other resume function)
> has to be implemented in a specific way for things to work. So it goes like
> this: "OK, now I'm not runtime-suspended, so I need to do something about that.
> Why don't I call back to the layer above me that has just called me (and that
> surely won't do anything after I return, right?), so that it does the right
> thing (which it surely will do, of course?) and calls my runtime PM callback
> as expected".
>
> And now suppose that your subsystem-level callbacks look like this (pseudo code):
>
> a_suspend_late(dev)
> {
> if (successful(pm_generic_suspend_late(dev)))
> do_X(dev);
> }
>
> a_runtime_suspend(dev)
> {
> if (successful(pm_generic_runtime_suspend(dev)))
> do_Y(dev);
> }
>
> Then, if the driver uses your pm_generic_suspend_late_runtime(), the actually
> executed code will be (assuming dev is not runtime-suspended):
>
> a_suspend_late(dev)
> driver->suspend_late(dev)
> a_runtime_suspend(dev)
> driver->runtime_suspend(dev)
> do_Y(dev)
> do_X(dev)
>
> So what if do_X(dev) after do_Y(dev) doesn't actually work?
>
> And what you actually want is
>
> driver->runtime_suspend(dev)
> do_Y(dev)
That should have been
driver->runtime_suspend(dev)
do_X(dev)
because do_Y(dev) is for runtime suspend. Sorry.
And of course, the subsystem-level code you're developing the driver for may not
do the do_X(dev) thing at all, in which case all will work. But what if someone
tries to use the driver with a different subsystem-level code (like a new PM
domain)?
Rafael
next prev parent reply other threads:[~2013-11-29 13:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 15:34 Ulf Hansson
2013-11-27 15:34 ` [PATCH 1/5] PM / Sleep: Add pm_generic functions to re-use runtime PM callbacks Ulf Hansson
2013-12-03 23:15 ` Rafael J. Wysocki
2013-12-03 23:41 ` Rafael J. Wysocki
2013-12-04 11:00 ` Ulf Hansson
2013-11-27 15:34 ` [PATCH 2/5] PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM Ulf Hansson
2013-11-27 15:34 ` [PATCH 3/5] PM / Runtime: Add second macro for definition of runtime PM callbacks Ulf Hansson
2013-11-27 15:34 ` [PATCH 4/5] PM / Sleep: Add macro to define common late/early system " Ulf Hansson
2013-11-27 15:35 ` [PATCH 5/5] drm/exynos: Convert to suspend_late/resume_early callbacks for fimc Ulf Hansson
2013-11-27 20:42 ` [PATCH 0/5] PM: Enable option of re-use runtime PM callbacks at system suspend Rafael J. Wysocki
2013-11-28 9:58 ` Ulf Hansson
2013-11-28 21:16 ` Rafael J. Wysocki
2013-11-29 9:32 ` Ulf Hansson
2013-11-29 9:35 ` Ulf Hansson
2013-11-29 13:52 ` Rafael J. Wysocki
2013-11-29 14:02 ` Rafael J. Wysocki [this message]
2013-11-29 15:30 ` Alan Stern
2013-11-29 21:20 ` Rafael J. Wysocki
2013-12-02 15:50 ` Ulf Hansson
2013-12-05 21:46 ` Len Brown
2013-12-05 22:21 ` Alan Stern
2013-12-06 0:53 ` Pavel Machek
2013-12-02 15:21 ` 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=4064706.R9zKA4hcfi@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@linaro.org \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
/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
all inboxes | Powered by JetHome®