[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260209234310.1440722-1-sathyanarayanan.kuppuswamy@linux.intel.com>
Date: Mon, 9 Feb 2026 15:43:08 -0800
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
To: "Rafael J . Wysocki" <rafael@...nel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs
This series fixes issues with RAPL PMU event access when using CPUs
other than the package lead_cpu.
The problem was discovered when turbostat reported zero power values
when run on a non-lead CPU in the package.
Investigation revealed two issues:
1. The RAPL MSR driver incorrectly validated that the current CPU must
match the lead CPU of the package when reading from PMU context, even
though package-scoped MSRs are readable from any CPU in the package.
2. The RAPL PMU cpumask only exposed one CPU per package (the lead_cpu)
for both MSR and TPMI interfaces, forcing tools to use that specific
CPU even though package-scoped registers are readable from any CPU
in the package.
The perf tool avoided issue #1 by checking the cpumask before opening
events, but turbostat does not perform this validation. The restrictive
cpumask in issue #2 was unnecessary since both MSR and TPMI interfaces
support reads from any CPU in the package for package-scoped registers.
These patches:
- Remove the incorrect CPU validation check in PMU context
- Expand the PMU cpumask to include all CPUs in each package for both
MSR and TPMI RAPL interfaces
- Rename 'atomic' parameter to 'pmu_ctx' for clarity
After these changes, tools can successfully read RAPL events from any
CPU in the package, matching the architectural capability of the
hardware for both MSR and TPMI based RAPL implementations.
Testing (PTL & GNR platform):
- Verified turbostat --no-msr --show power works on all CPUs
- Verified perf stat -e power/energy-pkg/ works on all CPUs
- Confirmed /sys/bus/event_source/devices/power/cpumask shows all
package CPUs instead of just lead_cpu
- Tested on both MSR-based (PTL) and TPMI-based (GNR) RAPL system
Kuppuswamy Sathyanarayanan (2):
powercap: intel_rapl: Remove incorrect CPU check in PMU context
powercap: intel_rapl: Expose all package CPUs in PMU cpumask
drivers/powercap/intel_rapl_common.c | 21 ++++++++-------------
drivers/powercap/intel_rapl_msr.c | 12 +++++-------
include/linux/intel_rapl.h | 2 +-
3 files changed, 14 insertions(+), 21 deletions(-)
--
2.43.0
Powered by blists - more mailing lists