Re: [PATCH 0/3] PM: runtime: add new runtime metrics and summary
From: Samuel Wu
Date: Wed Nov 11 2026 - 12:53:55 EST
On Wed, Nov 11, 2026 at 1:12 AM Joshua Crofts <crofts@xxxxxxxxxx> wrote:
>
> On Tue, 10 Nov 2026 19:38:39 -0800
> Samuel Wu <wusamuel@xxxxxxxxxx> wrote:
>
> ...
>
> >
> > 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.
>
> The main things this is useful for are detecting power "thrashing" and
> tuning autosuspend delays. Currently, sysfs only shows the total time
> a device spent in active and suspended mode; from an energy standpoint,
> a continuous 50 second suspension is different from a device cycling
> 1000 times for 50ms each (these transitions can be pretty power-hungry).
> This could help userspace utilities like PowerTOP to more effectively
> determine what is causing an increased power consumption.
>
> From the kernel dev standpoint - this is genuinely useful when testing
> runtime PM functions in new drivers (for example in the IIO subsystem we
> deal with a lot of runtime PM stuff).
Makes sense, there is value in this info.
> > And is there a reason the stats need to be surfaced in both sysfs and debugfs?
>
> sysfs definitely, as you should definitely be able to access this info
> per-device (and this is the way userspace tools would get this info).
Is there already a userspace user of these sysfs nodes?
Adding these five sysfs nodes would easily create 10k+ new sysfs nodes
(a typical Android device can easily have 2k+ devices). Most userspace
apps would iterate through every possible node, meaning this would be
an inconsistent snapshot across the 10k+ syscalls, in addition to
being inefficient.
These sysfs nodes would have a boot time impact, a non-negligible
memory impact, and constitute a permanent ABI.
> The debugfs summary is however pretty elegant IMO and useful. I'm sure a lot
> of people investigating odd device behaviour would like this (plus there
> are overviews like this in the kernel already - clk_summary for example).
The debugfs addition makes more sense IMO. It filters with
pm_runtime_enabled() instead of presenting every device, and the
spinlock at least keeps the view of each device consistent. It's also
more flexible without the ABI guarantee.