mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 14:12:07 +02:00
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>
This commit is contained in:
parent
f2368a209a
commit
83037a47d3
|
|
@ -499,9 +499,16 @@ int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
|
|||
/* Give up ownership of the PMU */
|
||||
hisi_pmu->on_cpu = -1;
|
||||
|
||||
/* Choose a new CPU to migrate ownership of the PMU to */
|
||||
/*
|
||||
* Migrate ownership of the PMU to a new CPU chosen from PMU's online
|
||||
* associated CPUs if possible, if no associated CPU online then
|
||||
* migrate to one online CPU.
|
||||
*/
|
||||
target = cpumask_any_and_but(&hisi_pmu->associated_cpus,
|
||||
cpu_online_mask, cpu);
|
||||
if (target >= nr_cpu_ids)
|
||||
target = cpumask_any_but(cpu_online_mask, cpu);
|
||||
|
||||
if (target >= nr_cpu_ids)
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user