Re: [PATCH 0/3] PM: runtime: add new runtime metrics and summary

From: Joshua Crofts

Date: Thu Nov 12 2026 - 04:22:16 EST


On Wed, 11 Nov 2026 08:56:30 -0800
Samuel Wu <wusamuel@xxxxxxxxxx> wrote:

...

> > 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?

No, there isn't.

> 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.

Fair enough, I didn't account for this. 2k+ devices is a lot!

> > 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.

Okay, I've no problem with dropping the sysfs patch. The debugfs summary is
machine-readable for any userspace tools to parse.

--
Kind regards,
Joshua Crofts