From: Len Brown <lenb@kernel.org>
To: torvalds@linux-foundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Len Brown <len.brown@intel.com>
Subject: [PATCH 1/1] tools/power turbostat: Fix AMD RAPL regression
Date: Tue, 17 Feb 2026 21:02:04 -0600 [thread overview]
Message-ID: <cfd5ff044914fd5f7fae2403675b68593f986055.1771383514.git.len.brown@intel.com> (raw)
In-Reply-To: <20260218030402.694540-1-lenb@kernel.org>
From: Len Brown <len.brown@intel.com>
turbostat.c:8688: rapl_perf_init: Assertion `next_domain < num_domains' failed.
Revert a hunk from a cleanup patch that was not supposed to change anything...
And once again, AMD RAPL is "special".
Fixes: ddf60e38ca04 ("tools/power turbostat: Simplify global core_id calculation")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
---
tools/power/x86/turbostat/turbostat.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 1aace9b3269e..606f3dead084 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5161,10 +5161,17 @@ static inline int get_rapl_num_domains(void)
static inline int get_rapl_domain_id(int cpu)
{
+ int nr_cores_per_package = topo.max_core_id + 1;
+ int rapl_core_id;
+
if (!platform->has_per_core_rapl)
return cpus[cpu].package_id;
- return GLOBAL_CORE_ID(cpu, cpus[cpu].package_id);
+ /* Compute the system-wide unique core-id for @cpu */
+ rapl_core_id = cpus[cpu].core_id;
+ rapl_core_id += cpus[cpu].package_id * nr_cores_per_package;
+
+ return rapl_core_id;
}
/*
--
2.45.2
next prev parent reply other threads:[~2026-02-18 3:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 3:02 [GIT PULL] turbostat-v2026.02.14+AMD Len Brown
2026-02-18 3:02 ` Len Brown [this message]
2026-02-18 5:36 [GIT PULL v2] turbostat-v2026.02.14+AMD Len Brown
2026-02-18 5:36 ` [PATCH 1/1] tools/power turbostat: Fix AMD RAPL regression 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=cfd5ff044914fd5f7fae2403675b68593f986055.1771383514.git.len.brown@intel.com \
--to=lenb@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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®