Skip to content

Commit 601c942

Browse files
sudeep-hollactmarinas
authored andcommitted
arm64: use cpu_online_mask when using forced irq_set_affinity
Commit 01f8fa4("genirq: Allow forcing cpu affinity of interrupts") enabled the forced irq_set_affinity which previously refused to route an interrupt to an offline cpu. Commit ffde1de("irqchip: Gic: Support forced affinity setting") implements this force logic and disables the cpu online check for GIC interrupt controller. When __cpu_disable calls migrate_irqs, it disables the current cpu in cpu_online_mask and uses forced irq_set_affinity to migrate the IRQs away from the cpu but passes affinity mask with the cpu being offlined also included in it. When calling irq_set_affinity with force == true in a cpu hotplug path, the caller must ensure that the cpu being offlined is not present in the affinity mask or it may be selected as the target CPU, leading to the interrupt not being migrated. This patch uses cpu_online_mask when using forced irq_set_affinity so that the IRQs are properly migrated away. Signed-off-by: Sudeep Holla <[email protected]> Acked-by: Mark Rutland <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 89ca3b8 commit 601c942

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/arm64/kernel/irq.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc)
9797
if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
9898
return false;
9999

100-
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
101-
affinity = cpu_online_mask;
100+
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids)
102101
ret = true;
103-
}
104102

103+
/*
104+
* when using forced irq_set_affinity we must ensure that the cpu
105+
* being offlined is not present in the affinity mask, it may be
106+
* selected as the target CPU otherwise
107+
*/
108+
affinity = cpu_online_mask;
105109
c = irq_data_get_irq_chip(d);
106110
if (!c->irq_set_affinity)
107111
pr_debug("IRQ%u: unable to set affinity\n", d->irq);

0 commit comments

Comments
 (0)