[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250617124900.186591-2-rui.zhang@intel.com>
Date: Tue, 17 Jun 2025 20:49:00 +0800
From: Zhang Rui <rui.zhang@...el.com>
To: rafael.j.wysocki@...el.com,
lenb@...nel.org
Cc: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: [PATCH 2/2] tools/power turbostat: Enhance legacy uncore detection
Currently, legacy uncore probe is done by checking the permission for
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/
However, legacy uncore runtime update needs to access
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/current_freq_khz
which demands higher privileges.
This discrepancy can lead to situations where turbostat incorrectly
detects legacy uncore support but fails to access it during runtime when
executed without root privileges.
Fix the problem by checking the same sysfs entry used for runtime update
to decide if legacy uncore support can be probed or not.
Reported-by: Artem Bityutskiy <artem.bityutskiy@...ux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@...el.com>
Reviewed-by: Len Brown <len.brown@...el.com>
---
tools/power/x86/turbostat/turbostat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 5f8ab899b552..46f6a696b434 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -6737,7 +6737,7 @@ static void probe_intel_uncore_frequency_legacy(void)
int k, l;
char path_base[128];
- sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d", i,
+ sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d/current_freq_khz", i,
j);
if (access(path_base, R_OK))
--
2.43.0
Powered by blists - more mailing lists