OpenCloudOS-Kernel/tools/power/x86
Justin Ernst 037e72e7d7 tools/power/turbostat: Fix uncore frequency file string
[ Upstream commit 60add818ab2543b7e4f2bfeaacf2504743c1eb50 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-17 12:02:16 +02:00
..
amd_pstate_tracer PM: tools: use canonical ftrace path 2023-02-02 15:45:35 +01:00
intel-speed-select tools/power/x86/intel-speed-select: v1.17 release 2023-08-09 08:57:58 -07:00
intel_pstate_tracer PM: tools: use canonical ftrace path 2023-02-02 15:45:35 +01:00
turbostat tools/power/turbostat: Fix uncore frequency file string 2024-05-17 12:02:16 +02:00
x86_energy_perf_policy tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num() 2024-04-13 13:07:31 +02:00