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

2024-07-11 Thread Zhang, Rui
> > @@ -352,9 +384,13 @@ static int rapl_pmu_event_init(struct perf_event > *event) > u64 cfg = event->attr.config & RAPL_EVENT_MASK; > int bit, ret = 0; > struct rapl_pmu *rapl_pmu; > +   struct rapl_pmus *curr_rapl_pmus; >   > /* only look at RAPL events */ >

Re: [PATCH v4 09/11] perf/x86/rapl: Remove the global variable rapl_msrs

2024-07-11 Thread Zhang, Rui
_msrs array(one for per-core scope and one > for > package scope PMU), inside the rapl_model struct. > > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui -rui > --- >  arch/x86/events/rapl.c | 7 ++- >  1 file changed, 2 insertions(+), 5 deletions(-) > > dif

Re: [PATCH v4 08/11] perf/x86/rapl: Modify the generic variable names to *_pkg*

2024-07-11 Thread Zhang, Rui
iables. > > No functional change. > > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui -rui > --- > Changes in v4: > * Move some renaming code from patch 10 to here (Rui) > --- >  arch/x86/events/rapl.c | 113 +-- > -- >

Re: [PATCH v4 07/11] perf/x86/rapl: Add an argument to the cleanup and init functions

2024-07-11 Thread Zhang, Rui
On Thu, 2024-07-11 at 10:24 +, Dhananjay Ugwekar wrote: > Prep for per-core RAPL PMU addition. > > No functional change. > > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui -rui > --- >  arch/x86/events/rapl.c | 14 +- >  1 file changed, 9 in

Re: [PATCH v4 06/11] perf/x86/rapl: Add wrapper for online/offline functions

2024-07-11 Thread Zhang, Rui
as well. The wrapper functions > added > below will make it easier to pass the corresponding args for both the > PMUs. > > No functional change. > > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui -rui > --- >  arch/x86/events/rapl.c | 30 +

Re: [PATCH v4 05/11] perf/x86/rapl: Move cpumask variable to rapl_pmus struct

2024-07-11 Thread Zhang, Rui
> @@ -710,6 +710,9 @@ static int __init init_rapl_pmus(void) > rapl_pmus = kzalloc(struct_size(rapl_pmus, rapl_pmu, > nr_rapl_pmu), GFP_KERNEL); > if (!rapl_pmus) > return -ENOMEM; > + > +   if (!alloc_cpumask_var(&rapl_pmus->cpumask, GFP_KERNEL)) > +

Re: [PATCH v4 04/11] perf/x86/rapl: Make rapl_model struct global

2024-07-11 Thread Zhang, Rui
a global variable, to avoid calling > x86_match_cpu() multiple times. > > No functional change. > > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui -rui > --- >  arch/x86/events/rapl.c | 16 >  1 file changed, 8 insertions(+), 8 deletions(-) &

Re: [PATCH v4 03/11] perf/x86/rapl: Rename rapl_pmu variables

2024-07-11 Thread Zhang, Rui
mu, which leads to situations in code like pmu->pmu, > which is needlessly confusing. Above scenario is replaced with > much more readable rapl_pmu->pmu with this change. > > Also rename "pmus" member in rapl_pmus struct, for same reason. > > No functional change. >

Re: [PATCH v4 02/11] perf/x86/rapl: Fix the energy-pkg event for AMD CPUs

2024-07-11 Thread Zhang, Rui
On Thu, 2024-07-11 at 10:24 +, Dhananjay Ugwekar wrote: > 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 pa

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

2024-07-07 Thread Zhang, Rui
Hi, Peter, On Fri, 2024-07-05 at 11:24 +0200, Peter Zijlstra wrote: > On Fri, Jul 05, 2024 at 02:18:30AM +0000, Zhang, Rui wrote: > > > > > > I have a doubt about this, won't the future Intel multi-die > > > > > systems > > > > &

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

2024-07-04 Thread Zhang, Rui
On Wed, 2024-07-03 at 12:01 +0530, Dhananjay Ugwekar wrote: > Hi Rui, > > On 7/3/2024 9:37 AM, Zhang, Rui wrote: > > On Tue, 2024-07-02 at 15:50 +0530, Dhananjay Ugwekar wrote: > > > > > > > > > > > For Intel products, we have > > > >

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

2024-07-02 Thread Zhang, Rui
On Tue, 2024-07-02 at 15:50 +0530, Dhananjay Ugwekar wrote: > > > > > For Intel products, we have > > 1. Casecadelake-AP which has multi-die per package and has per-die > > RAPL > > MSRs > > 2. all other platforms which has single-die per package, so its > > RAPL > > MSRs can be considered as eit

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

2024-07-01 Thread Zhang, Rui
On Mon, 2024-07-01 at 15:08 +0200, Peter Zijlstra wrote: > On Mon, Jun 24, 2024 at 05:59:05AM +, Dhananjay Ugwekar wrote: > > 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 betwee

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

2024-06-26 Thread Zhang, Rui
Hi, Dhananjay > > > > > [...] > > > > > @@ -685,6 +774,13 @@ static void __init rapl_advertise(void) > > > rapl_pkg_domain_names[i], > > > rapl_hw_unit[i]); > > > } > > > } > > > + > > > +   for (i = 0; i < NR_RAPL_CORE_DOMAINS; i++) {

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

2024-06-26 Thread Zhang, Rui
> @@ -131,8 +146,10 @@ enum rapl_unit_quirk { >  }; >   >  struct rapl_model { > -   struct perf_msr *rapl_msrs; > +   struct perf_msr *rapl_pkg_msrs; IMO, this should be part of patch 8/10. [...] > @@ -685,6 +774,13 @@ static void __init rapl_advertise(void) >  

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

2024-06-26 Thread Zhang, Rui
nfo is saved in an array. > Introduce topology_logical_core_id() to derive a > unique core ID across the system. > > Signed-off-by: K Prateek Nayak > Signed-off-by: Dhananjay Ugwekar Reviewed-by: Zhang Rui thanks, rui > --- >  Documentation/arch/x86/topology.rst  

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

2024-06-26 Thread Zhang, Rui
On Mon, 2024-06-24 at 05:58 +, Dhananjay Ugwekar wrote: > 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 pa

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

2024-06-11 Thread Zhang, Rui
> @@ -345,9 +353,14 @@ static int rapl_pmu_event_init(struct perf_event > *event) > u64 cfg = event->attr.config & RAPL_EVENT_MASK; > int bit, ret = 0; > struct rapl_pmu *rapl_pmu; > +   struct rapl_pmus *curr_rapl_pmus; >   > /* only look at RAPL events */ > -  

Re: [PATCH 2/6] perf/x86/rapl: Rename rapl_pmu variables

2024-06-10 Thread Zhang, Rui
On Mon, 2024-06-10 at 10:07 +, Dhananjay Ugwekar wrote: > 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 c

Re: [PATCH 1/6] perf/x86/rapl: Fix the energy-pkg event for AMD CPUs

2024-06-10 Thread Zhang, Rui
ollecting the event for all the > CPUs in > the package. > > After: > $ cat /sys/devices/power/cpumask > 0 > > Signed-off-by: Dhananjay Ugwekar > Fixes: 63edbaa48a57 ("x86/cpu/topology: Add support for the AMD > 0x8026 leaf") Reviewed-by: Zhang Rui