Skip to content

Commit e60a13b

Browse files
committed
tools/power turbostat: Handle non-root legacy-uncore sysfs permissions
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/ may be readable by all, but /sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/current_freq_khz may be readable only by root. Non-root turbostat users see complaints in this scenario. Fail probe of the interface if we can't read current_freq_khz. Reported-by: Artem Bityutskiy <[email protected]> Original-patch-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 378e901 commit e60a13b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7002,7 +7002,8 @@ static void probe_intel_uncore_frequency_legacy(void)
70027002
sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d", i,
70037003
j);
70047004

7005-
if (access(path_base, R_OK))
7005+
sprintf(path, "%s/current_freq_khz", path_base);
7006+
if (access(path, R_OK))
70067007
continue;
70077008

70087009
BIC_PRESENT(BIC_UNCORE_MHZ);

0 commit comments

Comments
 (0)