Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 88d724e

Browse files
Dongli ZhangKAGA-KOKO
authored andcommitted
genirq/cpuhotplug: Retry with cpu_online_mask when migration fails
When a CPU goes offline, the interrupts affine to that CPU are re-configured. Managed interrupts undergo either migration to other CPUs or shutdown if all CPUs listed in the affinity are offline. The migration of managed interrupts is guaranteed on x86 because there are interrupt vectors reserved. Regular interrupts are migrated to a still online CPU in the affinity mask or if there is no online CPU to any online CPU. This works as long as the still online CPUs in the affinity mask have interrupt vectors available, but in case that none of those CPUs has a vector available the migration fails and the device interrupt becomes stale. This is not any different from the case where the affinity mask does not contain any online CPU, but there is no fallback operation for this. Instead of giving up, retry the migration attempt with the online CPU mask if the interrupt is not managed, as managed interrupts cannot be affected by this problem. Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a60dd06 commit 88d724e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

kernel/irq/cpuhotplug.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,22 @@ static bool migrate_one_irq(struct irq_desc *desc)
130130
* CPU.
131131
*/
132132
err = irq_do_set_affinity(d, affinity, false);
133+
134+
/*
135+
* If there are online CPUs in the affinity mask, but they have no
136+
* vectors left to make the migration work, try to break the
137+
* affinity by migrating to any online CPU.
138+
*/
139+
if (err == -ENOSPC && !irqd_affinity_is_managed(d) && affinity != cpu_online_mask) {
140+
pr_debug("IRQ%u: set affinity failed for %*pbl, re-try with online CPUs\n",
141+
d->irq, cpumask_pr_args(affinity));
142+
143+
affinity = cpu_online_mask;
144+
brokeaff = true;
145+
146+
err = irq_do_set_affinity(d, affinity, false);
147+
}
148+
133149
if (err) {
134150
pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n",
135151
d->irq, err);

0 commit comments

Comments
 (0)