Re: [PATCH 0/3] PM: runtime: add new runtime metrics and summary
From: Samuel Wu
Date: Tue Nov 10 2026 - 22:39:03 EST
On Tue, Nov 10, 2026 at 3:34 AM Joshua Crofts <crofts@xxxxxxxxxx> wrote:
>
> Add a new set additional PM runtime metrics to improve power management
> debugging and reporting (these metrics may be useful to userspace
> utilities such as Powertop).
>
> MOTIVATION:
> The current implementation only measures the duration a device spends in
> suspended or active mode, which is very limiting. We can't find out how
> many times a device changed state or what its shortest suspend cycle
> was (to detect a sort of power "thrashing" behaviour).
>
> NEW FEATURES:
> This series introduces the following new metrics:
> - resume_count : number of successful transitions to active
> - suspend_count: number of successful transitions to suspended
> - last_suspended_time: duration of the most recent sleep cycle (ns)
> - min_suspended_time / max_suspended_sleep: shortest and longest sleep
> cycle durations to help detect power thrashing (ns)
>
> By reading the debugfs file /sys/kernel/debug/pm_runtime_summary, you
> get the following table describing the power stats of each device with
> runtime PM enabled:
>
> Device Status Resumes Suspends Active(ms) Suspend(ms) Last(ms) Min(ms) Max(ms)
> --------------------------------------------------------------------------------------------------------------------------
> 0000:00:02.0 active 1 0 45688 0 0 0 0
> 0000:00:1f.0 active 1 0 45687 0 0 0 0
> 0000:00:1f.2 active 1 0 45686 0 0 0 0
> 0000:00:1f.3 suspended 1 1 1658 44028 0 0 0
> 00:03:0 active 15 14 19627 25899 42 5 14811
> 00:03:0.0 active 14 13 19626 25900 42 5 14811
>
> TESTING:
> Tested with an x86_64 defconfig kernel and QEMU.
>
> AI ASSISTANCE:
> Gemini was used to prepare this series.
>
> Signed-off-by: Joshua Crofts <crofts@xxxxxxxxxx>
> ---
> Joshua Crofts (3):
> PM: runtime: add additional suspend/resume metrics
> PM: add sysfs attributes for additional suspend/resume metrics
> PM: runtime: add debugfs entry for pm_runtime_summary
>
> Documentation/ABI/testing/sysfs-devices-power | 36 ++++++
> drivers/base/power/runtime.c | 156 +++++++++++++++++++++++++-
> drivers/base/power/sysfs.c | 81 +++++++++++++
> include/linux/pm.h | 12 ++
> 4 files changed, 281 insertions(+), 4 deletions(-)
> ---
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
> change-id: 20261110-pm-runtime-summary-8dd29a1383bc
>
> Best regards,
> --
> Joshua Crofts <crofts@xxxxxxxxxx>
What is the vision for using these runtime PM stats once surfaced to
userspace? Runtime PM and suspend have disjoint portions, but I'm
curious if you see any non-obvious areas where these stats would be
insightful.
And is there a reason the stats need to be surfaced in both sysfs and debugfs?
Thanks!
Sam