<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/power/runtime.c, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-09-16T00:59:58Z</updated>
<entry>
<title>PM / runtime: Use _rcuidle for runtime suspend tracepoints</title>
<updated>2016-09-16T00:59:58Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2016-04-26T17:42:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=778935778c3b88e5152a88765850009006ef2e32'/>
<id>urn:sha1:778935778c3b88e5152a88765850009006ef2e32</id>
<content type='text'>
Further testing with false negatives suppressed by commit 293e2421fe25
("rcu: Remove superfluous versions of rcu_read_lock_sched_held()")
identified a few more unprotected uses of RCU from the idle loop.
Because RCU actively ignores idle-loop code (for energy-efficiency
reasons, among other things), using RCU from the idle loop can result
in too-short grace periods, in turn resulting in arbitrary misbehavior.

The affected function is rpm_suspend().

The resulting lockdep-RCU splat is as follows:

------------------------------------------------------------------------

Warning from omap3

===============================
[ INFO: suspicious RCU usage. ]
4.6.0-rc5-next-20160426+ #1112 Not tainted
-------------------------------
include/trace/events/rpm.h:63 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

RCU used illegally from idle CPU!
rcu_scheduler_active = 1, debug_locks = 0
RCU used illegally from extended quiescent state!
1 lock held by swapper/0/0:
 #0:  (&amp;(&amp;dev-&gt;power.lock)-&gt;rlock){-.-...}, at: [&lt;c052ee24&gt;] __pm_runtime_suspend+0x54/0x84

stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1112
Hardware name: Generic OMAP36xx (Flattened Device Tree)
[&lt;c0110308&gt;] (unwind_backtrace) from [&lt;c010c3a8&gt;] (show_stack+0x10/0x14)
[&lt;c010c3a8&gt;] (show_stack) from [&lt;c047fec8&gt;] (dump_stack+0xb0/0xe4)
[&lt;c047fec8&gt;] (dump_stack) from [&lt;c052d7b4&gt;] (rpm_suspend+0x604/0x7e4)
[&lt;c052d7b4&gt;] (rpm_suspend) from [&lt;c052ee34&gt;] (__pm_runtime_suspend+0x64/0x84)
[&lt;c052ee34&gt;] (__pm_runtime_suspend) from [&lt;c04bf3bc&gt;] (omap2_gpio_prepare_for_idle+0x5c/0x70)
[&lt;c04bf3bc&gt;] (omap2_gpio_prepare_for_idle) from [&lt;c01255e8&gt;] (omap_sram_idle+0x140/0x244)
[&lt;c01255e8&gt;] (omap_sram_idle) from [&lt;c0126b48&gt;] (omap3_enter_idle_bm+0xfc/0x1ec)
[&lt;c0126b48&gt;] (omap3_enter_idle_bm) from [&lt;c0601db8&gt;] (cpuidle_enter_state+0x80/0x3d4)
[&lt;c0601db8&gt;] (cpuidle_enter_state) from [&lt;c0183c74&gt;] (cpu_startup_entry+0x198/0x3a0)
[&lt;c0183c74&gt;] (cpu_startup_entry) from [&lt;c0b00c0c&gt;] (start_kernel+0x354/0x3c8)
[&lt;c0b00c0c&gt;] (start_kernel) from [&lt;8000807c&gt;] (0x8000807c)

------------------------------------------------------------------------

Reported-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / runtime: Add _rcuidle suffix to allow rpm_idle() use from idle</title>
<updated>2016-08-31T01:00:59Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2016-04-26T20:03:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d7737ce964d944dd07e25b0f569edcd550ede18c'/>
<id>urn:sha1:d7737ce964d944dd07e25b0f569edcd550ede18c</id>
<content type='text'>
This commit appends a few _rcuidle suffixes to fix the following
RCU-used-from-idle bug:

&gt; ===============================
&gt; [ INFO: suspicious RCU usage. ]
&gt; 4.6.0-rc5-next-20160426+ #1116 Not tainted
&gt; -------------------------------
&gt; include/trace/events/rpm.h:95 suspicious rcu_dereference_check() usage!
&gt;
&gt; other info that might help us debug this:
&gt;
&gt;
&gt; RCU used illegally from idle CPU!
&gt; rcu_scheduler_active = 1, debug_locks = 0
&gt; RCU used illegally from extended quiescent state!
&gt; 1 lock held by swapper/0/0:
&gt;  #0:  (&amp;(&amp;dev-&gt;power.lock)-&gt;rlock){-.-...}, at: [&lt;c052cc2c&gt;] __rpm_callback+0x58/0x60
&gt;
&gt; stack backtrace:
&gt; CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1116
&gt; Hardware name: Generic OMAP36xx (Flattened Device Tree)
&gt; [&lt;c0110290&gt;] (unwind_backtrace) from [&lt;c010c3a8&gt;] (show_stack+0x10/0x14)
&gt; [&lt;c010c3a8&gt;] (show_stack) from [&lt;c047fd68&gt;] (dump_stack+0xb0/0xe4)
&gt; [&lt;c047fd68&gt;] (dump_stack) from [&lt;c052d5d0&gt;] (rpm_suspend+0x580/0x768)
&gt; [&lt;c052d5d0&gt;] (rpm_suspend) from [&lt;c052ec58&gt;] (__pm_runtime_suspend+0x64/0x84)
&gt; [&lt;c052ec58&gt;] (__pm_runtime_suspend) from [&lt;c04bf25c&gt;] (omap2_gpio_prepare_for_idle+0x5c/0x70)
&gt; [&lt;c04bf25c&gt;] (omap2_gpio_prepare_for_idle) from [&lt;c0125568&gt;] (omap_sram_idle+0x140/0x244)
&gt; [&lt;c0125568&gt;] (omap_sram_idle) from [&lt;c01269dc&gt;] (omap3_enter_idle_bm+0xfc/0x1ec)
&gt; [&lt;c01269dc&gt;] (omap3_enter_idle_bm) from [&lt;c0601bdc&gt;] (cpuidle_enter_state+0x80/0x3d4)
&gt; [&lt;c0601bdc&gt;] (cpuidle_enter_state) from [&lt;c0183b08&gt;] (cpu_startup_entry+0x198/0x3a0)
&gt; [&lt;c0183b08&gt;] (cpu_startup_entry) from [&lt;c0b00c0c&gt;] (start_kernel+0x354/0x3c8)
&gt; [&lt;c0b00c0c&gt;] (start_kernel) from [&lt;8000807c&gt;] (0x8000807c)

In the immortal words of Steven Rostedt, "*Whack* *Whack* *Whack*!!!"

Reported-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
WhACKED-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / runtime: Add _rcuidle suffix to allow rpm_resume() to be called from idle</title>
<updated>2016-08-31T00:59:20Z</updated>
<author>
<name>Paul E. McKenney</name>
<email>paulmck@linux.vnet.ibm.com</email>
</author>
<published>2016-04-26T20:38:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d44c950e9398e639e124014e5872480a37b67259'/>
<id>urn:sha1:d44c950e9398e639e124014e5872480a37b67259</id>
<content type='text'>
This commit applies another _rcuidle suffix to fix an RCU use from
idle.

&gt; ===============================
&gt; [ INFO: suspicious RCU usage. ]
&gt; 4.6.0-rc5-next-20160426+ #1122 Not tainted
&gt; -------------------------------
&gt; include/trace/events/rpm.h:69 suspicious rcu_dereference_check() usage!
&gt;
&gt; other info that might help us debug this:
&gt;
&gt;
&gt; RCU used illegally from idle CPU!
&gt; rcu_scheduler_active = 1, debug_locks = 0
&gt; RCU used illegally from extended quiescent state!
&gt; 1 lock held by swapper/0/0:
&gt;  #0:  (&amp;(&amp;dev-&gt;power.lock)-&gt;rlock){-.-...}, at: [&lt;c052e3dc&gt;] __pm_runtime_resume+0x3c/0x64
&gt;
&gt; stack backtrace:
&gt; CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1122
&gt; Hardware name: Generic OMAP36xx (Flattened Device Tree)
&gt; [&lt;c0110290&gt;] (unwind_backtrace) from [&lt;c010c3a8&gt;] (show_stack+0x10/0x14)
&gt; [&lt;c010c3a8&gt;] (show_stack) from [&lt;c047fd68&gt;] (dump_stack+0xb0/0xe4)
&gt; [&lt;c047fd68&gt;] (dump_stack) from [&lt;c052e178&gt;] (rpm_resume+0x5cc/0x7f4)
&gt; [&lt;c052e178&gt;] (rpm_resume) from [&lt;c052e3ec&gt;] (__pm_runtime_resume+0x4c/0x64)
&gt; [&lt;c052e3ec&gt;] (__pm_runtime_resume) from [&lt;c04bf2c4&gt;] (omap2_gpio_resume_after_idle+0x54/0x68)
&gt; [&lt;c04bf2c4&gt;] (omap2_gpio_resume_after_idle) from [&lt;c01269dc&gt;] (omap3_enter_idle_bm+0xfc/0x1ec)
&gt; [&lt;c01269dc&gt;] (omap3_enter_idle_bm) from [&lt;c060198c&gt;] (cpuidle_enter_state+0x80/0x3d4)
&gt; [&lt;c060198c&gt;] (cpuidle_enter_state) from [&lt;c0183b08&gt;] (cpu_startup_entry+0x198/0x3a0)
&gt; [&lt;c0183b08&gt;] (cpu_startup_entry) from [&lt;c0b00c0c&gt;] (start_kernel+0x354/0x3c8)
&gt; [&lt;c0b00c0c&gt;] (start_kernel) from [&lt;8000807c&gt;] (0x8000807c)

Reported-by: Tony Lindgren &lt;tony@atomide.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Tony Lindgren &lt;tony@atomide.com&gt;
Tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>Merge branches 'pm-core', 'pm-clk', 'pm-domains' and 'pm-pci'</title>
<updated>2016-07-25T11:45:27Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2016-07-25T11:45:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fa70db3f19a183af5334edea5ad9e417c58faa5c'/>
<id>urn:sha1:fa70db3f19a183af5334edea5ad9e417c58faa5c</id>
<content type='text'>
* pm-core:
  PM / runtime: Asynchronous "idle" in pm_runtime_allow()
  PM / runtime: print error when activating a child to unactive parent

* pm-clk:
  PM / clk: Add support for adding a specific clock from device-tree
  PM / clk: export symbols for existing pm_clk_&lt;...&gt; API fcns

* pm-domains:
  PM / Domains: Convert pm_genpd_init() to return an error code
  PM / Domains: Stop/start devices during system PM suspend/resume in genpd
  PM / Domains: Allow runtime PM during system PM phases
  PM / Runtime: Avoid resuming devices again in pm_runtime_force_resume()
  PM / Domains: Remove redundant pm_request_idle() call in genpd
  PM / Domains: Remove redundant wrapper functions for system PM
  PM / Domains: Allow genpd to power on during system PM phases

* pm-pci:
  PCI / PM: check all fields in pci_set_platform_pm()
</content>
</entry>
<entry>
<title>PM / runtime: Asynchronous "idle" in pm_runtime_allow()</title>
<updated>2016-07-01T23:50:39Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2016-06-29T00:53:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fe7450b05fddebd5a76a5ad280a5ae9a82ce336f'/>
<id>urn:sha1:fe7450b05fddebd5a76a5ad280a5ae9a82ce336f</id>
<content type='text'>
Arjan reports that it takes a relatively long time to enable runtime
PM for multiple devices at system startup, because all writes to the
"control" attribute in sysfs are handled synchronously and if the
device is suspended as a result of the write, it will block until
that operation is complete.

That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
in pm_runtime_allow() which will make it execute the device's
"idle" callback asynchronously, so writes to "control" changing
it from "on" to "auto" will return without waiting.

Reported-by: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reviewed-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Reviewed-by: Kevin Hilman &lt;khilman@baylibre.com&gt;
</content>
</entry>
<entry>
<title>PM / runtime: print error when activating a child to unactive parent</title>
<updated>2016-06-27T22:40:30Z</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2016-06-20T09:14:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=71723f95463d284004bd0afe1825e6790a0c90d0'/>
<id>urn:sha1:71723f95463d284004bd0afe1825e6790a0c90d0</id>
<content type='text'>
The code currently silently bails out with -EBUSY if you try to
activate a child to an inactive parent.

This typically happens when you have a runtime suspended parent
and runtime resume your child, but forgot to set .ignore_children
on the parent to true with pm_suspend_ignore_children(dev).

Silently ignoring this error is not good as it gives rise to
other strange behaviour like double-resume of devices after
silently bailing out of the .runtime_resume() callback.

Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Avoid resuming devices again in pm_runtime_force_resume()</title>
<updated>2016-06-16T13:14:36Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2016-05-30T09:33:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9f5b52747dbf83816dcd29ea1700813aeb668c0f'/>
<id>urn:sha1:9f5b52747dbf83816dcd29ea1700813aeb668c0f</id>
<content type='text'>
If the runtime PM status of the device isn't RPM_SUSPENDED, prevent the
pm_runtime_force_resume() from invoking the -&gt;runtime_resume() callback
for the device, as it's not the expected behaviour from the subsystem/driver.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Reviewed-by: Kevin Hilman &lt;khilman@baylibre.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Fix error path in pm_runtime_force_resume()</title>
<updated>2016-04-21T17:31:11Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2016-04-08T11:10:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0ae3aeefabbeef26294e7a349b51f1c761d46c9f'/>
<id>urn:sha1:0ae3aeefabbeef26294e7a349b51f1c761d46c9f</id>
<content type='text'>
As pm_runtime_set_active() may fail because the device's parent isn't
active, we can end up executing the -&gt;runtime_resume() callback for the
device when it isn't allowed.

Fix this by invoking pm_runtime_set_active() before running the callback
and let's also deal with the error code.

Fixes: 37f204164dfb (PM: Add pm_runtime_suspend|resume_force functions)
Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Reviewed-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Cc: 3.15+ &lt;stable@vger.kernel.org&gt; # 3.15+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / runtime: Add new helper for conditional usage count incrementation</title>
<updated>2015-12-21T02:11:12Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2015-12-17T01:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a436b6a19f57656a6557439523923d89eb4a880d'/>
<id>urn:sha1:a436b6a19f57656a6557439523923d89eb4a880d</id>
<content type='text'>
Introduce a new runtime PM function, pm_runtime_get_if_in_use(),
that will increment the device's runtime PM usage counter and
return 1 if its status is RPM_ACTIVE and its usage counter
is greater than 0 at the same time (0 will be returned otherwise).

This is useful for things that should only be done if the device
is active (from the runtime PM perspective) and used by somebody
(as indicated by the usage counter) already and they are not worth
bothering otherwise.

Requested-by: Imre Deak &lt;imre.deak@intel.com&gt;
Reviewed-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: Re-init runtime PM states at probe error and driver unbind</title>
<updated>2015-11-30T13:50:05Z</updated>
<author>
<name>Ulf Hansson</name>
<email>ulf.hansson@linaro.org</email>
</author>
<published>2015-11-18T10:48:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5de85b9d57aba3ed2e04759e6db3b9e826dd0b06'/>
<id>urn:sha1:5de85b9d57aba3ed2e04759e6db3b9e826dd0b06</id>
<content type='text'>
There are two common expectations among several subsystems/drivers that
deploys runtime PM support, but which isn't met by the driver core.

Expectation 1)
At -&gt;probe() the subsystem/driver expects the runtime PM status of the
device to be RPM_SUSPENDED, which is the initial status being assigned at
device registration.

This expectation is especially common among some of those subsystems/
drivers that manages devices with an attached PM domain, as those requires
the -&gt;runtime_resume() callback at the PM domain level to be invoked
during -&gt;probe().

Moreover these subsystems/drivers entirely relies on runtime PM resources
being managed at the PM domain level, thus don't implement their own set
of runtime PM callbacks.

These are two scenarios that suffers from this unmet expectation.

i) A failed -&gt;probe() sequence requests probe deferral:

-&gt;probe()
  ...
  pm_runtime_enable()
  pm_runtime_get_sync()
  ...

err:
  pm_runtime_put()
  pm_runtime_disable()
  ...

As there are no guarantees that such sequence turns the runtime PM status
of the device into RPM_SUSPENDED, the re-trying -&gt;probe() may start with
the status in RPM_ACTIVE.

In such case the runtime PM core won't invoke the -&gt;runtime_resume()
callback because of a pm_runtime_get_sync(), as it considers the device to
be already runtime resumed.

ii) A driver re-bind sequence:

At driver unbind, the subsystem/driver's &gt;remove() callback invokes a
sequence of runtime PM APIs, to undo actions during -&gt;probe() and to put
the device into low power state.

-&gt;remove()
  ...
  pm_runtime_put()
  pm_runtime_disable()
  ...

Similar as in the failing -&gt;probe() case, this sequence don't guarantee
the runtime PM status of the device to turn into RPM_SUSPENDED.

Trying to re-bind the driver thus causes the same issue as when re-trying
-&gt;probe(), in the probe deferral scenario.

Expectation 2)
Drivers that invokes the pm_runtime_irq_safe() API during -&gt;probe(),
triggers the runtime PM core to increase the usage count for the device's
parent and permanently make it runtime resumed.

The usage count is only dropped at device removal, which also allows it to
be runtime suspended again.

A re-trying -&gt;probe() repeats the call to pm_runtime_irq_safe() and thus
once more triggers the usage count of the device's parent to be increased.

This leads to not only an imbalance issue of the usage count of the
device's parent, but also to keep it runtime resumed permanently even if
-&gt;probe() fails.

To address these issues, let's change the policy of the driver core to
meet these expectations. More precisely, at -&gt;probe() failures and driver
unbind, restore the initial states of runtime PM.

Although to still allow subsystem's to control PM for devices that doesn't
-&gt;probe() successfully, don't restore the initial states unless runtime PM
is disabled.

Signed-off-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Reviewed-by: Kevin Hilman &lt;khilman@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
