From: Zhang Rui <rui.zhang@intel.com>
To: rafael.j.wysocki@intel.com, lenb@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH 2/2] tools/power turbostat: Enhance legacy uncore detection
Date: Tue, 17 Jun 2025 20:49:00 +0800 [thread overview]
Message-ID: <20250617124900.186591-2-rui.zhang@intel.com> (raw)
In-Reply-To: <20250617124900.186591-1-rui.zhang@intel.com>
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@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Len Brown <len.brown@intel.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
next prev parent reply other threads:[~2025-06-17 12:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 12:48 [PATCH 1/2] tools/power turbostat: Fix bogus SysWatt for forked program Zhang Rui
2025-06-17 12:49 ` Zhang Rui [this message]
2025-06-18 14:48 ` [PATCH 2/2] tools/power turbostat: Enhance legacy uncore detection Len Brown
2025-06-18 14:47 ` [PATCH 1/2] tools/power turbostat: Fix bogus SysWatt for forked program Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250617124900.186591-2-rui.zhang@intel.com \
--to=rui.zhang@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®