Skip to content

Commit 626c5ac

Browse files
dhananjay-AMDIngo Molnar
authored andcommitted
perf/x86/rapl: Rename 'maxdie' to nr_rapl_pmu and 'dieid' to rapl_pmu_idx
AMD CPUs have the scope of RAPL energy-pkg event as package, whereas Intel Cascade Lake CPUs have the scope as die. To account for the difference in the energy-pkg event scope between AMD and Intel CPUs, give more generic and semantically correct names to the maxdie and dieid variables. No functional change. Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> Link: https://lore.kernel.org/r/20240502095115.177713-2-Dhananjay.Ugwekar@amd.com
1 parent 10ed2b1 commit 626c5ac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

arch/x86/events/rapl.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ struct rapl_pmu {
114114

115115
struct rapl_pmus {
116116
struct pmu pmu;
117-
unsigned int maxdie;
118-
struct rapl_pmu *pmus[] __counted_by(maxdie);
117+
unsigned int nr_rapl_pmu;
118+
struct rapl_pmu *pmus[] __counted_by(nr_rapl_pmu);
119119
};
120120

121121
enum rapl_unit_quirk {
@@ -141,13 +141,13 @@ static struct perf_msr *rapl_msrs;
141141

142142
static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
143143
{
144-
unsigned int dieid = topology_logical_die_id(cpu);
144+
unsigned int rapl_pmu_idx = topology_logical_die_id(cpu);
145145

146146
/*
147147
* The unsigned check also catches the '-1' return value for non
148148
* existent mappings in the topology map.
149149
*/
150-
return dieid < rapl_pmus->maxdie ? rapl_pmus->pmus[dieid] : NULL;
150+
return rapl_pmu_idx < rapl_pmus->nr_rapl_pmu ? rapl_pmus->pmus[rapl_pmu_idx] : NULL;
151151
}
152152

153153
static inline u64 rapl_read_counter(struct perf_event *event)
@@ -658,7 +658,7 @@ static void cleanup_rapl_pmus(void)
658658
{
659659
int i;
660660

661-
for (i = 0; i < rapl_pmus->maxdie; i++)
661+
for (i = 0; i < rapl_pmus->nr_rapl_pmu; i++)
662662
kfree(rapl_pmus->pmus[i]);
663663
kfree(rapl_pmus);
664664
}
@@ -674,13 +674,13 @@ static const struct attribute_group *rapl_attr_update[] = {
674674

675675
static int __init init_rapl_pmus(void)
676676
{
677-
int maxdie = topology_max_packages() * topology_max_dies_per_package();
677+
int nr_rapl_pmu = topology_max_packages() * topology_max_dies_per_package();
678678

679-
rapl_pmus = kzalloc(struct_size(rapl_pmus, pmus, maxdie), GFP_KERNEL);
679+
rapl_pmus = kzalloc(struct_size(rapl_pmus, pmus, nr_rapl_pmu), GFP_KERNEL);
680680
if (!rapl_pmus)
681681
return -ENOMEM;
682682

683-
rapl_pmus->maxdie = maxdie;
683+
rapl_pmus->nr_rapl_pmu = nr_rapl_pmu;
684684
rapl_pmus->pmu.attr_groups = rapl_attr_groups;
685685
rapl_pmus->pmu.attr_update = rapl_attr_update;
686686
rapl_pmus->pmu.task_ctx_nr = perf_invalid_context;

0 commit comments

Comments
 (0)