From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Ohad Ben-Cohen <ohad@wizery.com>,
linux-mmc@vger.kernel.org, Magnus Damm <damm@opensource.se>,
Simon Horman <horms@verge.net.au>,
Linux PM mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH/RFC] MMC: remove unbalanced pm_runtime_suspend()
Date: Thu, 21 Apr 2011 20:00:29 +0200 [thread overview]
Message-ID: <201104212000.29754.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1104210945470.1939-100000@iolanthe.rowland.org>
On Thursday, April 21, 2011, Alan Stern wrote:
> On Wed, 20 Apr 2011, Rafael J. Wysocki wrote:
>
> > On Wednesday, April 20, 2011, Alan Stern wrote:
> > > On Wed, 20 Apr 2011, Rafael J. Wysocki wrote:
> > >
> > > > On Wednesday, April 20, 2011, Alan Stern wrote:
> > > > > On Wed, 20 Apr 2011, Guennadi Liakhovetski wrote:
> > > > ...
> > > > > Ah, now I see the problem. It looks like we did not give sufficient
> > > > > thought to the case where a device starts off (and therefore should
> > > > > finish up) in a powered-down state. Calling pm_runtime_put_sync()
> > > > > after unbinding the device driver seems a little futile -- with no
> > > > > driver, the subsystem may not be able to power-down the device!
> > > > >
> > > > > Rafael, how do you think we should handle this? Get rid of the
> > > > > pm_runtime_get_no_resume() and pm_runtime_put_sync() calls in
> > > > > dd.c:__device_release_driver()?
> > > >
> > > > I think we need pm_runtime_barrier() in there. Otherwise we risk
> > > > removing the driver while there's a runtime PM request pending.
> > > >
> > > > But we can move the pm_runtime_put_sync() before driver_sysfs_remove().
> > >
> > > What happens if another runtime PM request is queued between the
> > > put_sync() and the remove callback? We may need a safe way to prevent
> > > async runtime PM requests while still allowing synchronous requests.
> >
> > What about making a rule that it is invalid to schedule a future suspend
> > or queue a resume request of a device whose driver is being removed?
> >
> > Arguably, we can't prevent people from shooting themselves in the foot this
> > way or another and I'm not sure if this particular case is worth additional
> > handling.
>
> After thinking about this, I tend to agree. The synchronization
> issues, combined with the unknown needs of the driver, make this very
> difficult to handle in the PM core.
>
> Here's another possible approach: If a driver wants to leave its device
> in a powered-down state after unbinding then it can invoke its own
> runtime_suspend callback directly, in the following way:
>
> ... unregister all child devices below dev ...
> pm_runtime_disable(dev);
> if (dev->power.runtime_status != RPM_SUSPENDED) {
> pm_set_suspended(dev);
> my_runtime_suspend_callback(dev);
> }
I think this would work too, but then possibly many drivers would have to
do the same thing in their "remove" routines.
> There may be issues regarding coordination with the subsystem or the
> power domain; at the moment it's not clear what should be done. Maybe
> the runtime-PM core should include an API for directly invoking the
> appropriate callbacks.
If we choose this approach, then yes, we should provide a suitable API, but
I'm still thinking it would be simpler to move the pm_runtime_put_sync() before driver_sysfs_remove() and make the rule as I said previously. :-)
Rafael
next prev parent reply other threads:[~2011-04-21 17:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 10:46 [PATCH/RFC] MMC: remove unbalanced pm_runtime_suspend() Guennadi Liakhovetski
2011-04-19 12:44 ` Ohad Ben-Cohen
2011-04-19 13:23 ` Guennadi Liakhovetski
2011-04-19 14:16 ` Ohad Ben-Cohen
2011-04-19 14:26 ` Alan Stern
2011-04-19 22:59 ` Guennadi Liakhovetski
2011-04-20 14:22 ` Alan Stern
2011-04-20 14:50 ` Guennadi Liakhovetski
2011-04-20 15:12 ` Alan Stern
2011-04-20 20:06 ` Rafael J. Wysocki
2011-04-20 21:16 ` Alan Stern
2011-04-20 21:44 ` Rafael J. Wysocki
2011-04-21 13:58 ` Alan Stern
2011-04-21 18:00 ` Rafael J. Wysocki [this message]
2011-04-21 18:36 ` Alan Stern
2011-04-21 20:05 ` Rafael J. Wysocki
2011-04-21 21:48 ` Alan Stern
2011-04-21 22:06 ` Rafael J. Wysocki
2011-04-22 15:20 ` Alan Stern
2011-04-22 20:22 ` Rafael J. Wysocki
2011-04-22 20:25 ` Rafael J. Wysocki
2011-04-22 21:20 ` Alan Stern
2011-04-22 22:11 ` Rafael J. Wysocki
2011-04-25 10:29 ` [linux-pm] " Rafael J. Wysocki
2011-04-26 10:44 ` Guennadi Liakhovetski
2011-04-26 11:51 ` Rafael J. Wysocki
2011-04-28 22:12 ` 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=201104212000.29754.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=damm@opensource.se \
--cc=g.liakhovetski@gmx.de \
--cc=horms@verge.net.au \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=ohad@wizery.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).