lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 29 Nov 2013 15:02:07 +0100
From:	"Rafael J. Wysocki" <rjw@...ysocki.net>
To:	Ulf Hansson <ulf.hansson@...aro.org>
Cc:	Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Alan Stern <stern@...land.harvard.edu>,
	Kevin Hilman <khilman@...aro.org>
Subject: Re: [PATCH 0/5] PM: Enable option of re-use runtime PM callbacks at system suspend

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ