Re: [PATCH v3 00/10] Add per-core RAPL energy counter support for AMD CPUs

2024-06-23 Thread K Prateek Nayak
Hello Dhananjay, On 6/24/2024 11:28 AM, Dhananjay Ugwekar wrote: Currently the energy-cores event in the power PMU aggregates energy consumption data at a package level. On the other hand the core energy RAPL counter in AMD CPUs has a core scope (which means the energy consumption is recorded se

[PATCH v3 10/10] perf/x86/rapl: Add per-core energy counter support for AMD CPUs

2024-06-23 Thread Dhananjay Ugwekar
Add a new "power_per_core" PMU and "energy-per-core" event for monitoring energy consumption by each core. The existing energy-cores event aggregates the energy consumption at the package level. This new event aligns with the AMD's per_core energy counters. Tested the package level and core level

[PATCH v3 09/10] perf/x86/rapl: Remove the global variable rapl_msrs

2024-06-23 Thread Dhananjay Ugwekar
After making the rapl_model struct global, the rapl_msrs global variable isn't needed, so remove it. Also it will be cleaner when new per-core scope PMU is added. As we will need to maintain two rapl_msrs array(one for per-core scope and one for package scope PMU), inside the rapl_model struct. S

[PATCH v3 08/10] perf/x86/rapl: Modify the generic variable names to *_pkg*

2024-06-23 Thread Dhananjay Ugwekar
Prep for addition of power_per_core PMU to handle core scope energy consumption for AMD CPUs. Replace the generic names with *_pkg*, to differentiate between the scopes of the two different PMUs and their variables. No functional change. Signed-off-by: Dhananjay Ugwekar --- arch/x86/events/rap

[PATCH v3 07/10] perf/x86/rapl: Add an argument to the cleanup and init functions

2024-06-23 Thread Dhananjay Ugwekar
Prep for per-core RAPL PMU addition. No functional change. Signed-off-by: Dhananjay Ugwekar --- arch/x86/events/rapl.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index 70c7b35fb4d2..f815c60ec551 100644 ---

[PATCH v3 06/10] perf/x86/rapl: Add wrapper for online/offline functions

2024-06-23 Thread Dhananjay Ugwekar
This is in preparation for the addition of per-core RAPL counter support for AMD CPUs. The CPU online and offline functions will need to handle the setting up and migration of the new per-core PMU as well. The wrapper functions added below will make it easier to pass the corresponding args for bot

[PATCH v3 05/10] perf/x86/rapl: Move cpumask variable to rapl_pmus struct

2024-06-23 Thread Dhananjay Ugwekar
This patch is in preparation for addition of per-core energy counter support for AMD CPUs. Per-core energy counter PMU will need a separate cpumask. It seems like a better approach to add the cpumask inside the rapl_pmus struct, instead of creating another global cpumask variable for per-core PMU.

[PATCH v3 04/10] perf/x86/rapl: Make rapl_model struct global

2024-06-23 Thread Dhananjay Ugwekar
To support AMD's per_core RAPL counter, we will need to check per_core capability of the current rapl_model multiple times in rapl_cpu_online/offline, init_rapl_pmus functions, so cache the matched rapl model in a global variable, to avoid calling x86_match_cpu() multiple times. No functional chan

[PATCH v3 03/10] perf/x86/rapl: Rename rapl_pmu variables

2024-06-23 Thread Dhananjay Ugwekar
Rename struct rapl_pmu variables from "pmu" to "rapl_pmu", to avoid any confusion between the variables of two different structs pmu and rapl_pmu. As rapl_pmu also contains a pointer to struct pmu, which leads to situations in code like pmu->pmu, which is needlessly confusing. Above scenario is rep

[PATCH v3 02/10] perf/x86/rapl: Fix the energy-pkg event for AMD CPUs

2024-06-23 Thread Dhananjay Ugwekar
After commit ("x86/cpu/topology: Add support for the AMD 0x8026 leaf"), on AMD processors that support extended CPUID leaf 0x8026, 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

[PATCH v3 01/10] x86/topology: Introduce topology_logical_core_id()

2024-06-23 Thread Dhananjay Ugwekar
From: K Prateek Nayak On x86, topology_core_id() returns a unique core ID within the PKG domain. Looking at match_smt() suggests that a core ID just needs to be unique within a LLC domain. For use cases such as the per-core RAPL PMU, there exists a need for a unique core ID across the entire syst

[PATCH v3 00/10] Add per-core RAPL energy counter support for AMD CPUs

2024-06-23 Thread Dhananjay Ugwekar
Currently the energy-cores event in the power PMU aggregates energy consumption data at a package level. On the other hand the core energy RAPL counter in AMD CPUs has a core scope (which means the energy consumption is recorded separately for each core). Earlier efforts to add the core event in t