]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/power/turbostat: Fix uncore frequency file string
authorJustin Ernst <justin.ernst@hpe.com>
Tue, 2 Apr 2024 17:40:29 +0000 (13:40 -0400)
committerLen Brown <len.brown@intel.com>
Tue, 9 Apr 2024 18:04:23 +0000 (14:04 -0400)
commit60add818ab2543b7e4f2bfeaacf2504743c1eb50
treedf21244bb830c7cea3a8f644eaa3b6513aa243e5
parentde39d38c06eb047954c5ad20a3f9acb6d3c78498
tools/power/turbostat: Fix uncore frequency file string

Running turbostat on a 16 socket HPE Scale-up Compute 3200 (SapphireRapids) fails with:
turbostat: /sys/devices/system/cpu/intel_uncore_frequency/package_010_die_00/current_freq_khz: open failed: No such file or directory

We observe the sysfs uncore frequency directories named:
...
package_09_die_00/
package_10_die_00/
package_11_die_00/
...
package_15_die_00/

The culprit is an incorrect sprintf format string "package_0%d_die_0%d" used
with each instance of reading uncore frequency files. uncore-frequency-common.c
creates the sysfs directory with the format "package_%02d_die_%02d". Once the
package value reaches double digits, the formats diverge.

Change each instance of "package_0%d_die_0%d" to "package_%02d_die_%02d".

[lenb: deleted the probe part of this patch, as it was already fixed]

Signed-off-by: Justin Ernst <justin.ernst@hpe.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c