Skip to content

Commit b10b3ef

Browse files
Kan LiangKAGA-KOKO
authored andcommitted
perf/x86/intel/rapl: Support multi-die/package
RAPL becomes die-scope on Xeon Cascade Lake-AP. Perf RAPL driver needs to support die-scope RAPL domain. Use topology_logical_die_id() to replace topology_logical_package_id(). For previous platforms which doesn't have multi-die, topology_logical_die_id() is identical as topology_logical_package_id(). Use topology_die_cpumask() to replace topology_core_cpumask(). For previous platforms which doesn't have multi-die, topology_die_cpumask() is identical as topology_core_cpumask(). There is no functional change for previous platforms. Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Len Brown <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/851320c8c87ba7a54e58ee8579c1bf566ce23cbb.1557769318.git.len.brown@intel.com
1 parent 1ff4a47 commit b10b3ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/events/intel/rapl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static u64 rapl_timer_ms;
161161

162162
static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu)
163163
{
164-
unsigned int pkgid = topology_logical_package_id(cpu);
164+
unsigned int pkgid = topology_logical_die_id(cpu);
165165

166166
/*
167167
* The unsigned check also catches the '-1' return value for non
@@ -571,7 +571,7 @@ static int rapl_cpu_offline(unsigned int cpu)
571571

572572
pmu->cpu = -1;
573573
/* Find a new cpu to collect rapl events */
574-
target = cpumask_any_but(topology_core_cpumask(cpu), cpu);
574+
target = cpumask_any_but(topology_die_cpumask(cpu), cpu);
575575

576576
/* Migrate rapl events to the new target */
577577
if (target < nr_cpu_ids) {
@@ -598,14 +598,14 @@ static int rapl_cpu_online(unsigned int cpu)
598598
pmu->timer_interval = ms_to_ktime(rapl_timer_ms);
599599
rapl_hrtimer_init(pmu);
600600

601-
rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu;
601+
rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu;
602602
}
603603

604604
/*
605605
* Check if there is an online cpu in the package which collects rapl
606606
* events already.
607607
*/
608-
target = cpumask_any_and(&rapl_cpu_mask, topology_core_cpumask(cpu));
608+
target = cpumask_any_and(&rapl_cpu_mask, topology_die_cpumask(cpu));
609609
if (target < nr_cpu_ids)
610610
return 0;
611611

@@ -675,7 +675,7 @@ static void cleanup_rapl_pmus(void)
675675

676676
static int __init init_rapl_pmus(void)
677677
{
678-
int maxpkg = topology_max_packages();
678+
int maxpkg = topology_max_packages() * topology_max_die_per_package();
679679
size_t size;
680680

681681
size = sizeof(*rapl_pmus) + maxpkg * sizeof(struct rapl_pmu *);

0 commit comments

Comments
 (0)