perf/x86/rapl: Fix the energy-pkg event for AMD CPUs
authorDhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Tue, 30 Jul 2024 04:49:18 +0000 (04:49 +0000)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Sep 2024 10:02:14 +0000 (12:02 +0200)
commit8d72eba1cf8cecd76a2b4c1dd7673c2dc775f514
treec1214a67224e4bb4313ad399dd024c2b114a14e6
parent2ab9d830262c132ab5db2f571003d80850d56b2a
perf/x86/rapl: Fix the energy-pkg event for AMD CPUs

After commit:

  63edbaa48a57 ("x86/cpu/topology: Add support for the AMD 0x80000026 leaf")

... on AMD processors that support extended CPUID leaf 0x80000026, the
topology_die_cpumask() and topology_logical_die_id() macros no longer
return the package cpumask and package ID, instead they return the CCD
(Core Complex Die) mask and ID respectively.

This leads to the energy-pkg event scope to be modified to CCD instead of package.

So, change the PMU scope for AMD and Hygon back to package.

On a 12 CCD 1 Package AMD Zen4 Genoa machine:

  Before:

  $ cat /sys/devices/power/cpumask
  0,8,16,24,32,40,48,56,64,72,80,88.

The expected cpumask here is supposed to be just "0", as it is a package
scope event, only one CPU will be collecting the event for all the CPUs in
the package.

  After:

  $ cat /sys/devices/power/cpumask
  0

[ mingo: Cleaned up the changelog ]

Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Link: https://lore.kernel.org/r/20240904100934.3260-1-Dhananjay.Ugwekar@amd.com
arch/x86/events/rapl.c