* [PATCH] PM: runtime: Document that force_suspend() is incompatible with SMART_SUSPEND
@ 2022-12-13 15:54 Richard Fitzgerald
2023-01-13 19:54 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2022-12-13 15:54 UTC (permalink / raw)
To: rafael, len.brown, pavel
Cc: linux-pm, linux-kernel, patches, Richard Fitzgerald
pm_runtime_force_suspend() cannot be used with DPM_FLAG_SMART_SUSPEND, so
note this in the kerneldoc.
If DPM_FLAG_SMART_SUSPEND is set and the PM core cannot skip system resume
it will call pm_runtime_active() on the driver. This can lead to an
inconsistent state where:
pm_runtime_force_suspend() called ->runtime_suspend
but
device_resume_noirq() called pm_runtime_set_active()
This leaves the driver actually suspended but marked as active.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
drivers/base/power/runtime.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 50e726b6c2cf..b29be7d4d7d0 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1864,6 +1864,10 @@ static bool pm_runtime_need_not_resume(struct device *dev)
* sure the device is put into low power state and it should only be used during
* system-wide PM transitions to sleep states. It assumes that the analogous
* pm_runtime_force_resume() will be used to resume the device.
+ *
+ * Do not use with DPM_FLAG_SMART_SUSPEND as this can lead to an inconsistent
+ * state where this function has called the ->runtime_suspend callback but the
+ * PM core marks the driver as runtime active.
*/
int pm_runtime_force_suspend(struct device *dev)
{
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PM: runtime: Document that force_suspend() is incompatible with SMART_SUSPEND
2022-12-13 15:54 [PATCH] PM: runtime: Document that force_suspend() is incompatible with SMART_SUSPEND Richard Fitzgerald
@ 2023-01-13 19:54 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-01-13 19:54 UTC (permalink / raw)
To: Richard Fitzgerald
Cc: rafael, len.brown, pavel, linux-pm, linux-kernel, patches
On Tue, Dec 13, 2022 at 4:54 PM Richard Fitzgerald
<rf@opensource.cirrus.com> wrote:
>
> pm_runtime_force_suspend() cannot be used with DPM_FLAG_SMART_SUSPEND, so
> note this in the kerneldoc.
>
> If DPM_FLAG_SMART_SUSPEND is set and the PM core cannot skip system resume
> it will call pm_runtime_active() on the driver. This can lead to an
> inconsistent state where:
>
> pm_runtime_force_suspend() called ->runtime_suspend
>
> but
>
> device_resume_noirq() called pm_runtime_set_active()
>
> This leaves the driver actually suspended but marked as active.
>
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> ---
> drivers/base/power/runtime.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 50e726b6c2cf..b29be7d4d7d0 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1864,6 +1864,10 @@ static bool pm_runtime_need_not_resume(struct device *dev)
> * sure the device is put into low power state and it should only be used during
> * system-wide PM transitions to sleep states. It assumes that the analogous
> * pm_runtime_force_resume() will be used to resume the device.
> + *
> + * Do not use with DPM_FLAG_SMART_SUSPEND as this can lead to an inconsistent
> + * state where this function has called the ->runtime_suspend callback but the
> + * PM core marks the driver as runtime active.
> */
> int pm_runtime_force_suspend(struct device *dev)
> {
> --
Applied as 6.3 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-13 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13 15:54 [PATCH] PM: runtime: Document that force_suspend() is incompatible with SMART_SUSPEND Richard Fitzgerald
2023-01-13 19:54 ` Rafael J. Wysocki
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®