public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs
@ 2026-02-09 23:43 Kuppuswamy Sathyanarayanan
  2026-02-09 23:43 ` [PATCH v1 1/2] powercap: intel_rapl: Remove incorrect CPU check in PMU context Kuppuswamy Sathyanarayanan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2026-02-09 23:43 UTC (permalink / raw)
  To: Rafael J . Wysocki; +Cc: Srinivas Pandruvada, linux-pm, linux-kernel

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-14 16:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 23:43 [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs Kuppuswamy Sathyanarayanan
2026-02-09 23:43 ` [PATCH v1 1/2] powercap: intel_rapl: Remove incorrect CPU check in PMU context Kuppuswamy Sathyanarayanan
2026-02-14 16:19   ` Raag Jadav
2026-02-09 23:43 ` [PATCH v1 2/2] powercap: intel_rapl: Expose all package CPUs in PMU cpumask Kuppuswamy Sathyanarayanan
2026-02-10 17:53 ` [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs srinivas pandruvada
2026-02-11 20:04   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox