Re: [RFC PATCH v3 04/10] PM / EM: Expose the Energy Model in sysfs

From: Quentin Perret
Date: Tue Jun 19 2018 - 09:06:31 EST


On Tuesday 19 Jun 2018 at 14:16:43 (+0200), Peter Zijlstra wrote:
> On Mon, May 21, 2018 at 03:24:59PM +0100, Quentin Perret wrote:
> > This exposes the Energy Model (read-only) of all frequency domains in
> > sysfs for convenience. To do so, a parent kobject is added to the CPU
> > subsystem under the umbrella of which a kobject for each frequency
> > domain is attached.
> >
> > The resulting hierarchy is as follows for a platform with two frequency
> > domains for example:
> >
> > /sys/devices/system/cpu/energy_model
> > âââ fd0
> > â âââ capacity
> > â âââ cpus
> > â âââ frequency
> > â âââ power
> > âââ fd4
> > âââ capacity
> > âââ cpus
> > âââ frequency
> > âââ power
> >
>
> Given that each FD can have multiple {freq,power} tuples and sysfs has a
> one value per file policy, how does this work?

This is meant to look a little bit like the sysfs entries of CPUFreq
policies, so you get something like this:

$ cat /sys/devices/system/cpu/energy_model/fd0/capacity
133 250 351 428 462
$ cat /sys/devices/system/cpu/energy_model/fd0/frequency
533000 999000 1402000 1709000 1844000
$ cat /sys/devices/system/cpu/energy_model/fd0/power
28 70 124 187 245
$ cat /sys/devices/system/cpu/energy_model/fd0/cpus
0-3


For example, CPUFreq exposes available governors and frequencies as:

$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
conservative ondemand userspace powersave performance schedutil

$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
533000 999000 1402000 1709000 1844000