Skip to content

Commit 83037a4

Browse files
Yicong Yangwilldeacon
authored andcommitted
drivers/perf: hisi: Migrate to one online CPU if no associated one online
If the selected CPU hisi_pmu::on_cpu goes offline, driver will select a new online CPU from hisi_pmu::associated_cpus, or if no online CPU found the PMU context won't be migrated. However for uncore PMUs the associated CPUs are just a peference and it also works to schedule the events on any online CPUs. So add a fallback to choose an online CPU if no associated CPUs found. Signed-off-by: Yicong Yang <yangyicong@hisilicon.com> Link: https://lore.kernel.org/r/20241210141525.37788-4-yangyicong@huawei.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent f2368a2 commit 83037a4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/perf/hisilicon/hisi_uncore_pmu.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,16 @@ int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
499499
/* Give up ownership of the PMU */
500500
hisi_pmu->on_cpu = -1;
501501

502-
/* Choose a new CPU to migrate ownership of the PMU to */
502+
/*
503+
* Migrate ownership of the PMU to a new CPU chosen from PMU's online
504+
* associated CPUs if possible, if no associated CPU online then
505+
* migrate to one online CPU.
506+
*/
503507
target = cpumask_any_and_but(&hisi_pmu->associated_cpus,
504508
cpu_online_mask, cpu);
509+
if (target >= nr_cpu_ids)
510+
target = cpumask_any_but(cpu_online_mask, cpu);
511+
505512
if (target >= nr_cpu_ids)
506513
return 0;
507514

0 commit comments

Comments
 (0)