Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors
@ 2026-11-04 15:16 Stanley Jhu
  2026-11-04 16:46 ` Brian Norris
  2026-11-04 17:11 ` Bart Van Assche
  0 siblings, 2 replies; 4+ messages in thread
From: Stanley Jhu @ 2026-11-04 15:16 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Brian Norris, Len Brown, Pavel Machek, Praveen Talari,
	Jonathan Corbet, Mark Brown, Alan Stern, Jens Axboe,
	Bart Van Assche, linux-pm, linux-doc, linux-block, linux-scsi,
	linux-kernel, Stanley Jhu

Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on
suspend callback failures"), rpm_callback() no longer sets
dev->power.runtime_error when ->runtime_resume() returns an error.
However, Documentation/power/runtime_pm.rst still states in both the
resume callback rules and the ->runtime_idle() comparison that the PM
core treats ->runtime_resume() errors as fatal device errors and blocks
runtime PM helper functions until the status is manually reset.

Update the resume callback semantics bullet to state that on error the
PM core resets the runtime PM status to 'suspended', returns the error
code from synchronous resume helpers, and unlike with the suspend
callback never treats resume failures as fatal, leaving the Section 4
runtime PM helpers unblocked so a subsequent resume request can run
->runtime_resume() again. Also drop ->runtime_resume() from the
->runtime_idle() fatal-error comparison.

Fixes: eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures")
Fixes: aedc51762a0d ("PM: runtime: Clarify ->runtime_idle() callback return value handling")
Signed-off-by: Stanley Jhu <stanleyjhu@google.com>
---
Differences from v1:
- Contrast resume failures with the suspend callback instead of citing
  -EBUSY, -EAGAIN, or power.runtime_error (Brian Norris)
- Add Fixes tag for commit aedc51762a0d covering ->runtime_idle()
- Link to v1: https://lore.kernel.org/r/20261029040005.2100005-1-stanleyjhu@google.com

 Documentation/power/runtime_pm.rst | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
index 40a5c23d5259..09072c576087 100644
--- a/Documentation/power/runtime_pm.rst
+++ b/Documentation/power/runtime_pm.rst
@@ -222,11 +222,12 @@ what to do to handle the device).
     I/O operations as needed.  The runtime PM status of the device is then
     'active'.
 
-  * If the resume callback returns an error code, the PM core regards this as a
-    fatal error and will refuse to run the helper functions described in
-    `Section 4`_ for the device, until its status is directly set to either
-    'active', or 'suspended' (by means of special helper functions provided by
-    the PM core for this purpose).
+  * If the resume callback returns an error code, the PM core sets the
+    device's runtime PM status back to 'suspended' and returns the error
+    code from synchronous resume helpers.  Unlike with the suspend
+    callback, failures in the resume callback are never considered fatal,
+    so the helper functions described in `Section 4`_ are not blocked and
+    a subsequent resume request can run the resume callback again.
 
 The idle callback (a subsystem-level one, if present, or the driver one) is
 executed by the PM core whenever the device appears to be idle, which is
@@ -250,9 +251,9 @@ call to pm_runtime_autosuspend().
 To prevent this suspension (for example, if the callback routine has scheduled
 a delayed suspend or determined the device cannot be idle), the routine must
 return a non-zero value (typically -EBUSY or -EAGAIN).  Unlike
-->runtime_suspend() and ->runtime_resume(), the PM core does not treat negative
-return codes from ->runtime_idle() as a fatal device error; any non-zero value
-simply stops the PM core from suspending the device.
+->runtime_suspend(), the PM core does not treat negative return codes from
+->runtime_idle() as a fatal device error, and any non-zero value simply stops
+the PM core from suspending the device.
 
 Core Guarantees and Synchronization Rules
 -----------------------------------------
-- 
2.56.0.385.gac671c819a-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors
  2026-11-04 15:16 [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors Stanley Jhu
@ 2026-11-04 16:46 ` Brian Norris
  2026-11-04 17:11 ` Bart Van Assche
  1 sibling, 0 replies; 4+ messages in thread
From: Brian Norris @ 2026-11-04 16:46 UTC (permalink / raw)
  To: Stanley Jhu
  Cc: Rafael J . Wysocki, Len Brown, Pavel Machek, Praveen Talari,
	Jonathan Corbet, Mark Brown, Alan Stern, Jens Axboe,
	Bart Van Assche, linux-pm, linux-doc, linux-block, linux-scsi,
	linux-kernel

On Wed, Nov 04, 2026 at 11:16:51PM +0800, Stanley Jhu wrote:
> Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on
> suspend callback failures"), rpm_callback() no longer sets
> dev->power.runtime_error when ->runtime_resume() returns an error.
> However, Documentation/power/runtime_pm.rst still states in both the
> resume callback rules and the ->runtime_idle() comparison that the PM
> core treats ->runtime_resume() errors as fatal device errors and blocks
> runtime PM helper functions until the status is manually reset.
> 
> Update the resume callback semantics bullet to state that on error the
> PM core resets the runtime PM status to 'suspended', returns the error
> code from synchronous resume helpers, and unlike with the suspend
> callback never treats resume failures as fatal, leaving the Section 4
> runtime PM helpers unblocked so a subsequent resume request can run
> ->runtime_resume() again. Also drop ->runtime_resume() from the
> ->runtime_idle() fatal-error comparison.
> 
> Fixes: eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures")
> Fixes: aedc51762a0d ("PM: runtime: Clarify ->runtime_idle() callback return value handling")
> Signed-off-by: Stanley Jhu <stanleyjhu@google.com>

Reviewed-by: Brian Norris <briannorris@chromium.org>

Thanks for fixing this!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors
  2026-11-04 15:16 [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors Stanley Jhu
  2026-11-04 16:46 ` Brian Norris
@ 2026-11-04 17:11 ` Bart Van Assche
  2026-11-04 19:11   ` Rafael J. Wysocki (Intel)
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2026-11-04 17:11 UTC (permalink / raw)
  To: Stanley Jhu, Rafael J . Wysocki
  Cc: Brian Norris, Len Brown, Pavel Machek, Praveen Talari,
	Jonathan Corbet, Mark Brown, Alan Stern, Jens Axboe, linux-pm,
	linux-doc, linux-block, linux-scsi, linux-kernel

On 11/4/26 7:16 AM, Stanley Jhu wrote:
 > +  * If the resume callback returns an error code, the PM core sets the
 > +    device's runtime PM status back to 'suspended' and returns the error
 > +    code from synchronous resume helpers.  Unlike with the suspend
 > +    callback, failures in the resume callback are never considered 
fatal,
 > +    so the helper functions described in `Section 4`_ are not 
blocked and
 > +    a subsequent resume request can run the resume callback again.

Hi Stanley,

This matches what rpm_resume() does since commit eef1d74bf88f. A nit:
suspend callback failures with -EBUSY / -EAGAIN are not fatal either,
so "Unlike most suspend callback errors" may be slightly more accurate.
Either way:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Additionally, the kerneldoc of @runtime_error in include/linux/pm.h
("Fatal error code returned by a failing callback") could be updated
in a follow-up patch to mention ->runtime_suspend() explicitly.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors
  2026-11-04 17:11 ` Bart Van Assche
@ 2026-11-04 19:11   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-11-04 19:11 UTC (permalink / raw)
  To: Bart Van Assche, Stanley Jhu
  Cc: Brian Norris, Pavel Machek, Praveen Talari, Jonathan Corbet,
	Mark Brown, Alan Stern, Jens Axboe, linux-pm, linux-doc,
	linux-block, linux-scsi, linux-kernel

On Wed, Nov 4, 2026 at 6:11 PM Bart Van Assche <bvanassche@acm.org> wrote:
>
> On 11/4/26 7:16 AM, Stanley Jhu wrote:
>  > +  * If the resume callback returns an error code, the PM core sets the
>  > +    device's runtime PM status back to 'suspended' and returns the error
>  > +    code from synchronous resume helpers.  Unlike with the suspend
>  > +    callback, failures in the resume callback are never considered
> fatal,
>  > +    so the helper functions described in `Section 4`_ are not
> blocked and
>  > +    a subsequent resume request can run the resume callback again.
>
> Hi Stanley,
>
> This matches what rpm_resume() does since commit eef1d74bf88f. A nit:
> suspend callback failures with -EBUSY / -EAGAIN are not fatal either,
> so "Unlike most suspend callback errors" may be slightly more accurate.
> Either way:

Adjusted accordingly while applying.

> Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Applied as 7.4-rc material, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-04 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 15:16 [PATCH v2] PM: runtime: Update runtime_pm.rst for non-fatal resume errors Stanley Jhu
2026-11-04 16:46 ` Brian Norris
2026-11-04 17:11 ` Bart Van Assche
2026-11-04 19:11   ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox