mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Kuppuswamy Sathyanarayanan
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	"Rafael J . Wysocki"	 <rafael@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs
Date: Tue, 10 Feb 2026 09:53:19 -0800	[thread overview]
Message-ID: <62c8c3910e1becf49e96eddf892d7c37960c7c28.camel@linux.intel.com> (raw)
In-Reply-To: <20260209234310.1440722-1-sathyanarayanan.kuppuswamy@linux.intel.com>

On Mon, 2026-02-09 at 15:43 -0800, Kuppuswamy Sathyanarayanan wrote:
> 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
> 

Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


>  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(-)

  parent reply	other threads:[~2026-02-10 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
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 ` srinivas pandruvada [this message]
2026-02-11 20:04   ` [PATCH v1 0/2] Fix RAPL PMU access from non-lead CPUs Rafael J. Wysocki

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=62c8c3910e1becf49e96eddf892d7c37960c7c28.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    /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

Powered by JetHome