[RFC 09/10] genirq/cpuhotplug: Ask migrate_one_irq() to migrate to a real online cpu

From: Pingfan Liu
Date: Sun Aug 21 2022 - 22:17:06 EST


In kexec quick reboot path, the dying cpus are still on the
cpu_online_mask, but the interrupt should be migrated onto a real online
cpu instead of a dying one. Otherwise, the interrupt has no opportunity
to move onto a live cpu.

Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx
---
kernel/irq/cpuhotplug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index 1ed2b1739363..e85d6456f310 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -110,6 +110,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
if (maskchip && chip->irq_mask)
chip->irq_mask(d);

+ cpumask_andnot(affinity, affinity, cpu_dying_mask);
if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
/*
* If the interrupt is managed, then shut it down and leave
@@ -120,7 +121,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
irq_shutdown_and_deactivate(desc);
return false;
}
- affinity = cpu_online_mask;
+ cpumask_andnot(affinity, cpu_online_mask, cpu_dying_mask);
brokeaff = true;
}
/*
--
2.31.1