[PATCH 02/13] tools/power turbostat: Fix AMD RAPL regression on big systems

From: Len Brown

Date: Sat Apr 25 2026 - 14:48:38 EST


From: Len Brown <len.brown@xxxxxxxxx>

turbostat.c:8688: rapl_perf_init: Assertion `next_domain < num_domains' failed.

The initial fix for this regression was incomplete, as it did not
handle multi-package systems with sparse core ids.

Fixes: ef0e60083f76 ("tools/power turbostat: Fix AMD RAPL regression")
Signed-off-by: Len Brown <len.brown@xxxxxxxxx>
---
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 e9e8ef72395a..bea574d7aa68 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5155,7 +5155,7 @@ static inline int get_rapl_num_domains(void)
if (!platform->has_per_core_rapl)
return topo.num_packages;

- return topo.num_cores;
+ return GLOBAL_CORE_ID(topo.max_core_id, topo.num_packages) + 1;
}

static inline int get_rapl_domain_id(int cpu)
--
2.45.2