Skip to main content

TECH VEDA

Corporate on-site training - Submit proposal Pick your modulesSharpen your kernel skills: deep dives, drivers, Yocto, CVEs, careers — updated daily. Read the blog →
Patches

Proposed Runtime PM Statistics: How Many Times Did Your Device Suspend?

A patch series under review proposes runtime PM statistics that count device suspends and resumes in one debugfs file. What it adds and where it stands.

Proposed Runtime PM Statistics: How Many Times Did Your Device Suspend?

A two-patch series on the linux-pm list proposes new runtime PM statistics: per-device counts of runtime suspends and resumes, the length of the last, shortest and longest suspended period, and one debugfs file that prints them for every device. Version 2 was posted on 16 November 2026 after review of version 1 removed five proposed sysfs attributes. The series has no replies yet, has not been applied to any tree, and is not in linux-next or mainline.

Status on 19 November 2026: v2, posted and awaiting review. Not merged.

The runtime PM statistics that the kernel keeps today answer one question: for how long has this device been suspended, and for how long active. They do not say how many times it changed state. Joshua Crofts has posted a series, “PM: runtime: add new runtime metrics and summary”, that would add the missing counts.

The problem: two totals and no count

Runtime PM accounting lives in drivers/base/power/runtime.c. Each struct device carries a struct dev_pm_info, and in 7.4-rc3 that structure holds three accounting fields: active_time, suspended_time and accounting_timestamp. Every status change goes through __update_runtime_status(), which calls update_pm_runtime_accounting(). That function adds the time since the last timestamp to suspended_time if the device was in RPM_SUSPENDED, and to active_time otherwise.

User space reads the two totals, in milliseconds, from the device’s power/ directory in sysfs. For an I2C device at address 0x48 on bus 1:

root@board:~# grep . /sys/bus/i2c/devices/1-0048/power/runtime_*

With CONFIG_PM_ADVANCED_DEBUG the directory also has runtime_usage, runtime_active_kids and runtime_enabled. None of these is a transition count.

The cover letter gives the case that the totals cannot separate: a device suspended once for 50 seconds, and a device that suspended 1,000 times for 50 ms each. Both show the same runtime_suspended_time. The second device ran its suspend and resume callbacks 1,000 times, and each run may switch a regulator, gate a clock or reprogram the hardware. On a battery-powered product that difference can decide whether an autosuspend delay saves energy or costs it.

The way to get a count today is tracing. The rpm trace events (rpm_suspend, rpm_resume, rpm_idle, rpm_usage, rpm_return_int and rpm_status) record each step, and rpm_status prints the device name and the new status:

root@board:~# echo 1 > /sys/kernel/tracing/events/rpm/rpm_status/enable
root@board:~# cat /sys/kernel/tracing/trace_pipe

This works, but tracing has to be switched on in advance, the events have to be counted and paired afterwards, and nothing is known about the time before tracing started. Our earlier post on a device that never runtime suspends covers the opposite fault.

What the series proposes for runtime PM statistics

Patch 1 would add six fields to struct dev_pm_info, in the block that already holds the two totals:

	u64			resume_count;
	u64			suspend_count;
	u64			suspend_time;
	u64			last_suspended_time;
	u64			min_suspended_time;
	u64			max_suspended_time;

The patch would update them inside __update_runtime_status(), by comparing the old status with the new one. As the diff reads:

  • A change from RPM_SUSPENDING or RPM_ACTIVE to RPM_SUSPENDED would increment suspend_count and record the time in suspend_time.
  • A change away from RPM_SUSPENDED would end the suspended period: its length would be stored in last_suspended_time and compared against the minimum and maximum. A minimum of zero would be treated as “not yet set”.
  • A change from RPM_RESUMING or RPM_SUSPENDED to RPM_ACTIVE would increment resume_count.

Durations would be kept in nanoseconds.

Patch 2 would add one read-only debugfs file, /sys/kernel/debug/pm_runtime_summary, created by a late_initcall. It would walk the device list with the existing dpm_for_each_dev() iterator, take each device’s power.lock, and print one row per device, leaving out devices with runtime PM disabled and both counts at zero. The cover letter shows this output from the author’s test, a QEMU x86_64 guest (three of six rows shown, column spacing reduced):

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.3  suspended        1        1       1658       44028        0       0       0
00:03:0       active          15       14      19627       25899       42       5   14811

If the series were merged in this form, reading runtime PM statistics on a board would need one command, cat /sys/kernel/debug/pm_runtime_summary, and no tracing session. That file does not exist on any released kernel.

The review: sysfs attributes proposed, then dropped

Version 1, posted on 10 November 2026, had a third patch. It exposed the five values as per-device sysfs attributes (runtime_resume_count, runtime_suspend_count, runtime_last_suspended_time, runtime_min_suspended_time and runtime_max_suspended_time) and documented them in Documentation/ABI/testing/sysfs-devices-power. Two reviewers replied, and both discussed that patch.

Greg Kroah-Hartman asked why each show function took the device’s power lock, since the value can change immediately after the lock is released. Crofts answered that an unlocked 64-bit read can be torn on a 32-bit system. Kroah-Hartman asked whether that mattered for a best-effort number, and which 32-bit system would rely on the interface. Crofts replied that he was not using one; the point had come from an automated review tool, Sashiko, run locally. He agreed to drop the locks, and Kroah-Hartman advised him not to let a tool’s output replace his own reasoning.

Samuel Wu, writing from a Google address, asked what user space would do with the runtime PM statistics and why they were needed in both sysfs and debugfs. Crofts named three uses: detecting devices that suspend and resume too often, tuning autosuspend delays, and testing runtime PM in a new driver. Wu then asked whether any user-space program reads such attributes today. Crofts said none does. Wu’s objection was about scale: a typical Android device can have more than 2,000 devices, so five attributes per device means more than 10,000 new sysfs nodes, which in his words would have “a boot time impact, a non-negligible memory impact, and constitute a permanent ABI”. He preferred the debugfs file, because it lists only relevant devices, reads each device under its lock, and carries no ABI guarantee.

Crofts accepted this. Version 2 drops the sysfs patch and credits Wu in its changelog, which also lists fixes for Sashiko findings: a typo, a race condition and a duplicate function call. The cover letter states that Gemini was used to prepare the series.

Where it stands

Version 2 was posted on 16 November 2026 to linux-pm, the driver-core list and LKML, addressed to seven people including Rafael J. Wysocki and both v1 reviewers. It is based on v7.4-rc1. When we checked the thread on 19 November it had no replies and carried no Acked-by or Reviewed-by tags. MAINTAINERS lists Wysocki as the maintainer of drivers/base/power/; he has not commented on either version. The new fields are absent from runtime.c in mainline 7.4-rc3, in next-20261118 and in the linux-next and bleeding-edge branches of the linux-pm tree. Nobody has stated a target release.

The next step is a response from the PM maintainer. Two points are visible in the patch and have not been raised on the list. These are our reading, not review findings:

  • The debugfs code would be built only when both CONFIG_DEBUG_FS and CONFIG_PM_SLEEP are set, and dpm_for_each_dev() lives in main.c, which is compiled only with CONFIG_PM_SLEEP. A kernel with runtime PM but without system suspend or hibernation support would carry the counters and have no file to read them from.
  • The table would convert nanoseconds to whole milliseconds. A suspended period shorter than 1 ms would print as 0, which is also what a device with no completed period would print.

What it would mean for a product team

There is nothing to change in a product today. No interface has been added or removed, and the series may be revised or not taken at all. The event that would change this is the series being applied to the linux-pm tree.

A team tuning autosuspend delays now can try the proposed runtime PM statistics on a development branch. The series is based on v7.4-rc1, so the board must already boot that kernel:

raghu@techveda.org:~$ git checkout -b rpm-summary v7.4-rc1
raghu@techveda.org:~$ b4 shazam 20261116-pm-runtime-summary-v2-0-a3d8654baf8f@kernel.org

The author reports testing only under QEMU on x86_64. On real hardware, check whether the counts agree with a count of rpm_status trace events over the same interval, and how the table shows devices whose drivers call pm_runtime_set_active() during probe. That path also goes through __update_runtime_status(), which is consistent with the sample rows showing one resume and no suspend.

Three limits apply even if the series is merged unchanged. First, the file is in debugfs. Many production images do not enable or mount debugfs, so this would be a tool for the lab and for bring-up, not for field telemetry, and its layout could change without notice. Second, the counts say how often a device suspended, not why it resumed. Finding what took the usage count still needs tracing with the rpm_usage and rpm_resume events. Third, on a kernel built with CONFIG_PM the six counters would be present in every struct device whether or not debugfs is enabled: 48 bytes per device.

Out-of-tree drivers would not be affected: the series adds no driver-facing API and changes no existing sysfs attribute.

What was checked and what could not be verified

We read the full v1 thread, the v2 cover letter and both v2 patches, and the 7.4-rc3 source files named above. We checked mainline, linux-next and two linux-pm branches for the new fields.

We did not build or run the series, so the sample output is the author’s and our two observations come from reading the diff. The automated review report that the v2 changelog refers to is not in the list thread. We found no maintainer statement on whether the series will be taken, and no posted test result from Arm or RISC-V hardware.

Key takeaways

  • Linux 7.4-rc3 reports total active and suspended time per device, and no count of runtime suspends or resumes. A count needs tracing.
  • The proposed runtime PM statistics would add suspend and resume counts and last, minimum and maximum suspended time, shown in one debugfs file.
  • Per-device sysfs attributes were proposed in v1 and dropped in v2 after a reviewer objected to the node count and the permanent ABI.
  • v2 of the runtime PM statistics series is unreviewed, is in no tree, and has no stated target release.
  • No product action is needed now. Re-check when the PM maintainer replies.
Was this worth your time?

Frequently asked questions

Can I read runtime PM statistics from pm_runtime_summary on my board today?

No. The file exists only in a patch series under review. It is not in mainline 7.4-rc3, in linux-next or in any released kernel.

Why were the sysfs attributes removed from the series?

A reviewer pointed out that five attributes on each of more than 2,000 devices would add over 10,000 sysfs nodes, with boot-time and memory cost and a permanent ABI. The author confirmed that no user-space program reads them today and kept only the debugfs file.

Would the proposed runtime PM statistics show which driver or process resumed a device?

No. They would report how often and for how long a device was suspended. Finding what resumed it still needs tracing with the rpm_usage and rpm_resume events.

References

RB
Raghu Bharadwaj

Founder, TECH VEDA — 20+ years teaching the Linux kernel, device drivers and embedded systems.

Follow on LinkedIn

Get new posts by email

Kernel, embedded Linux and AI-era engineering — a few sharp reads a month. No spam.

We email occasionally and never share your address.