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

Pingfan Liu posted 10 patches 3 years, 7 months ago
[RFC 09/10] genirq/cpuhotplug: Ask migrate_one_irq() to migrate to a real online cpu
Posted by Pingfan Liu 3 years, 7 months ago
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@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
To: linux-kernel@vger.kernel.org
---
 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