<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/power/runtime.c, branch v3.12.10</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/base/power/runtime.c?h=v3.12.10</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/base/power/runtime.c?h=v3.12.10'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-06-03T19:49:52Z</updated>
<entry>
<title>PM / Runtime: Rework the "runtime idle" helper routine</title>
<updated>2013-06-03T19:49:52Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2013-06-03T19:49:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=45f0a85c8258741d11bda25c0a5669c06267204a'/>
<id>urn:sha1:45f0a85c8258741d11bda25c0a5669c06267204a</id>
<content type='text'>
The "runtime idle" helper routine, rpm_idle(), currently ignores
return values from .runtime_idle() callbacks executed by it.
However, it turns out that many subsystems use
pm_generic_runtime_idle() which checks the return value of the
driver's callback and executes pm_runtime_suspend() for the device
unless that value is not 0.  If that logic is moved to rpm_idle()
instead, pm_generic_runtime_idle() can be dropped and its users
will not need any .runtime_idle() callbacks any more.

Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
ata_port_runtime_idle(), respectively, as well as a few drivers'
ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
been returned by the .runtime_idle() callback executed by it.

To reduce overall code bloat, make the changes described above.

Tested-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Tested-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Reviewed-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Asyncronous idle|suspend parent devices at removal</title>
<updated>2013-04-12T11:34:57Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2013-04-12T09:41:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=db28dfac99983e70b5a93b6c81c43d2c74fde20d'/>
<id>urn:sha1:db28dfac99983e70b5a93b6c81c43d2c74fde20d</id>
<content type='text'>
For irq safe devices return the runtime reference for the parent
by using the asyncronous runtime PM API. Thus we don't have to
wait for it to become idle|suspended. Instead we can move on and
handle the next device in queue.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>pm / runtime: force memory allocation with no I/O during Runtime PM callbcack</title>
<updated>2013-02-24T01:50:16Z</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2013-02-23T00:34:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=db88175f41a29c1ffff1a6938a7969d206a47326'/>
<id>urn:sha1:db88175f41a29c1ffff1a6938a7969d206a47326</id>
<content type='text'>
Apply the introduced memalloc_noio_save() and memalloc_noio_restore() to
force memory allocation with no I/O during runtime_resume/runtime_suspend
callback on device with the flag of 'memalloc_noio' set.

Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: David Decotigny &lt;david.decotigny@google.com&gt;
Cc: Tom Herbert &lt;therbert@google.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Oliver Neukum &lt;oneukum@suse.de&gt;
Cc: Jiri Kosina &lt;jiri.kosina@suse.com&gt;
Cc: Mel Gorman &lt;mel@csn.ul.ie&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.cz&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Cc: Greg KH &lt;greg@kroah.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pm / runtime: introduce pm_runtime_set_memalloc_noio()</title>
<updated>2013-02-24T01:50:16Z</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2013-02-23T00:34:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e823407f7b11fa06ba8e7a2801eb9ed11268a7ec'/>
<id>urn:sha1:e823407f7b11fa06ba8e7a2801eb9ed11268a7ec</id>
<content type='text'>
Introduce the flag memalloc_noio in 'struct dev_pm_info' to help PM core
to teach mm not allocating memory with GFP_KERNEL flag for avoiding
probable deadlock.

As explained in the comment, any GFP_KERNEL allocation inside
runtime_resume() or runtime_suspend() on any one of device in the path
from one block or network device to the root device in the device tree
may cause deadlock, the introduced pm_runtime_set_memalloc_noio() sets
or clears the flag on device in the path recursively.

Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Oliver Neukum &lt;oneukum@suse.de&gt;
Cc: Jiri Kosina &lt;jiri.kosina@suse.com&gt;
Cc: Mel Gorman &lt;mel@csn.ul.ie&gt;
Cc: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.cz&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Cc: Greg KH &lt;greg@kroah.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: David Decotigny &lt;david.decotigny@google.com&gt;
Cc: Tom Herbert &lt;therbert@google.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: let rpm_resume() succeed if RPM_ACTIVE, even when disabled, v2</title>
<updated>2012-09-22T19:15:08Z</updated>
<author>
<name>Kevin Hilman</name>
<email>khilman@ti.com</email>
</author>
<published>2012-09-21T22:47:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6f3c77b040fc24708228607bba504878de5236d1'/>
<id>urn:sha1:6f3c77b040fc24708228607bba504878de5236d1</id>
<content type='text'>
There are several drivers where the return value of
pm_runtime_get_sync() is used to decide whether or not it is safe to
access hardware and that don't provide .suspend() callbacks for system
suspend (but may use late/noirq callbacks.)  If such a driver happens
to call pm_runtime_get_sync() during system suspend, after the core
has disabled runtime PM, it will get the error code and will decide
that the hardware should not be accessed, although this may be a wrong
conclusion, depending on the state of the device when runtime PM was
disabled.

Drivers might work around this problem by using a test like:

   ret = pm_runtime_get_sync(dev);
   if (!ret || (ret == -EACCES &amp;&amp; driver_private_data(dev)-&gt;suspended)) {
      /* access hardware */
   }

where driver_private_data(dev)-&gt;suspended is a flag set by the
driver's .suspend() method (that would have to be added for this
purpose).  However, that potentially would need to be done by multiple
drivers which means quite a lot of duplicated code and bloat.

To avoid that we can use the observation that the core sets
dev-&gt;power.is_suspended before disabling runtime PM and use that
instead of the driver's private flag.  Still, potentially many drivers
would need to repeat that same check in quite a few places, so it's
better to let the core do it.

Then we can be a bit smarter and check whether or not runtime PM was
disabled by the core only (disable_depth == 1) or by someone else in
addition to the core (disable_depth &gt; 1).  In the former case
rpm_resume() can return 1 if the runtime PM status is RPM_ACTIVE,
because it means the device was active when the core disabled runtime
PM.  In the latter case it should still return -EACCES, because it
isn't clear why runtime PM has been disabled.

Tested on AM3730/Beagle-xM where a wakeup IRQ firing during the late
suspend phase triggers runtime PM activity in the I2C driver since the
wakeup IRQ is on an I2C-connected PMIC.

[rjw: Modified whitespace to follow the file's convention.]

Signed-off-by: Kevin Hilman &lt;khilman@ti.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Check device PM QoS setting before "no callbacks" check</title>
<updated>2012-08-17T17:36:36Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2012-08-15T19:32:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=55d7ec4520e86d735d178c15d7df33d507bd43c6'/>
<id>urn:sha1:55d7ec4520e86d735d178c15d7df33d507bd43c6</id>
<content type='text'>
If __dev_pm_qos_read_value(dev) returns a negative value,
rpm_suspend() should return -EPERM for dev even if its
power.no_callbacks flag is set.  For this to happen, the device's
power.no_callbacks flag has to be checked after the PM QoS check,
so move the PM QoS check to rpm_check_suspend_allowed() (this will
make it cover idle notifications as well as runtime suspend too).

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>PM / Runtime: Clear power.deferred_resume on success in rpm_suspend()</title>
<updated>2012-08-17T17:36:36Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2012-08-15T19:31:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=58a34de7b1a920d287d17d2ca08bc9aaf7e6d35b'/>
<id>urn:sha1:58a34de7b1a920d287d17d2ca08bc9aaf7e6d35b</id>
<content type='text'>
The power.deferred_resume can only be set if the runtime PM status
of device is RPM_SUSPENDING and it should be cleared after its
status has been changed, regardless of whether or not the runtime
suspend has been successful.  However, it only is cleared on
suspend failure, while it may remain set on successful suspend and
is happily leaked to rpm_resume() executed in that case.

That shouldn't happen, so if power.deferred_resume is set in
rpm_suspend() after the status has been changed to RPM_SUSPENDED,
clear it before calling rpm_resume().  Then, it doesn't need to be
cleared before changing the status to RPM_SUSPENDING any more,
because it's always cleared after the status has been changed to
either RPM_SUSPENDED (on success) or RPM_ACTIVE (on failure).

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set</title>
<updated>2012-08-17T17:36:35Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2012-08-15T19:31:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7f321c26c04807834fef4c524d2b21573423fc74'/>
<id>urn:sha1:7f321c26c04807834fef4c524d2b21573423fc74</id>
<content type='text'>
For devices whose power.no_callbacks flag is set, rpm_resume()
should return 1 if the device's parent is already active, so that
the callers of pm_runtime_get() don't think that they have to wait
for the device to resume (asynchronously) in that case (the core
won't queue up an asynchronous resume in that case, so there's
nothing to wait for anyway).

Modify the code accordingly (and make sure that an idle notification
will be queued up on success, even if 1 is to be returned).

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>PM / Runtime: Remove device fields related to suspend time, v2</title>
<updated>2012-05-01T19:28:38Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2012-04-29T20:54:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=76e267d822f2913893ad210ba431607aa8e2af94'/>
<id>urn:sha1:76e267d822f2913893ad210ba431607aa8e2af94</id>
<content type='text'>
After the previous changes in default_stop_ok() and
default_power_down_ok() for PM domains, there are two fields in
struct dev_pm_info that aren't necessary any more,  suspend_time
and max_time_suspended_ns.

Remove those fields along with all of the code that accesses them,
which simplifies the runtime PM framework quite a bit.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: don't forget to wake up waitqueue on failure</title>
<updated>2012-03-26T20:46:52Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2012-03-26T20:46:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f2791d733a2f06997b573d1a3cfde21e6f529826'/>
<id>urn:sha1:f2791d733a2f06997b573d1a3cfde21e6f529826</id>
<content type='text'>
This patch (as1535) fixes a bug in the runtime PM core.  When a
runtime suspend attempt completes, whether successfully or not, the
device's power.wait_queue is supposed to be signalled.  But this
doesn't happen in the failure pathway of rpm_suspend() when another
autosuspend attempt is rescheduled.  As a result, a task can get stuck
indefinitely on the wait queue (I have seen this happen in testing).

The patch fixes the problem by moving the wake_up_all() call up near
the start of the failure code.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
</feed>
