[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240502095115.177713-1-Dhananjay.Ugwekar@amd.com>
Date: Thu, 2 May 2024 15:21:13 +0530
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
To: <tglx@...utronix.de>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<x86@...nel.org>
CC: <peterz@...radead.org>, <mingo@...hat.com>, <ananth.narayan@....com>,
<gautham.shenoy@....com>, <linux-perf-users@...r.kernel.org>,
<linux-hardening@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<sandipan.das@....com>, <alexander.shishkin@...ux.intel.com>,
<irogers@...gle.com>, <gustavoars@...nel.org>, <kprateek.nayak@....com>,
<ravi.bangoria@....com>, Dhananjay Ugwekar <Dhananjay.Ugwekar@....com>
Subject: [PATCH 0/2] Fix 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(), no longer return
the package cpumask and package id, instead they return the CCD (Core
Complex Die) mask and CCD id respectively. This leads to the energy-pkg
event scope to be modified to CCD instead of package.
This is functionally incorrect as the AMD energy-pkg is a package scope
event.
On a 12 CCD 1 Package AMD Zen4 Genoa machine:
$ cat /sys/devices/power/cpumask
0,8,16,24,32,40,48,56,64,72,80,88.
Expected cpumask for 1 Package AMD CPUs energy-pkg event is supposed to
be just "0".
This in turn leads to incorrect values of package energy consumption.
$ perf stat -C 100 -e power/energy-pkg/ sleep 1
Performance counter stats for 'CPU(s) 100':
36.60 Joules power/energy-pkg/
1.005821050 seconds time elapsed
$ perf stat -a -e power/energy-pkg/ sleep 1
Performance counter stats for 'system wide':
414.03 Joules power/energy-pkg/
1.005252132 seconds time elapsed
In both cases the energy consumption values should have been the same,
but instead, due to the incorrect cpumask, the values are being
aggregated at a CCD level in the second case.
Replacing the die macros with the package macros(for AMD CPUs) fixes
this issue.
This patch cleanly applies on top of tip/master after
commit acf68d98cae8 ("perf/x86/rapl: Add support for Intel Lunar Lake"),
but not on Linus' tree.
Dhananjay Ugwekar (2):
perf/x86/rapl: Rename maxdie to nr_rapl_pmu and dieid to rapl_pmu_idx
perf/x86/rapl: Fix the energy-pkg event for AMD CPUs
arch/x86/events/rapl.c | 44 +++++++++++++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 11 deletions(-)
--
2.34.1
Powered by blists - more mailing lists