diff mbox series

[07/18] tools/power turbostat: Quit early for unsupported RAPL counters

Message ID bd2c6acc500d5c44d0202463aa2138a3363ae103.1749406068.git.len.brown@intel.com
State New
Headers show
Series [01/18] tools/power turbostat.8: fix typo: idle_pct should be pct_idle | expand

Commit Message

Len Brown June 8, 2025, 6:17 p.m. UTC
From: Zhang Rui <rui.zhang@intel.com>

Quit early for unsupported RAPL counters.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 tools/power/x86/turbostat/turbostat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 69c19e01b681..7e7d25d2362a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -7948,6 +7948,9 @@  void rapl_perf_init(void)
 		enum rapl_unit unit;
 		unsigned int next_domain;
 
+		if (!BIC_IS_ENABLED(cai->bic))
+			continue;
+
 		memset(domain_visited, 0, num_domains * sizeof(*domain_visited));
 
 		for (int cpu = 0; cpu < topo.max_cpu_num + 1; ++cpu) {
@@ -7971,7 +7974,7 @@  void rapl_perf_init(void)
 			struct rapl_counter_info_t *rci = &rapl_counter_info_perdomain[next_domain];
 
 			/* Check if the counter is enabled and accessible */
-			if (BIC_IS_ENABLED(cai->bic) && (platform->rapl_msrs & cai->feature_mask)) {
+			if (platform->rapl_msrs & cai->feature_mask) {
 
 				/* Use perf API for this counter */
 				if (!no_perf && cai->perf_name