[RFC PATCH v4 2/4] genirq/cpuhotplug: Dynamically isolate CPUs from managed interrupts

From: Costa Shulyupin
Date: Sun Dec 01 2024 - 07:43:29 EST


After change of housekeeping_cpumask(HK_TYPE_MANAGED_IRQ) during runtime
managed interrupts continue to run on isolated CPUs.

Dynamic CPUs isolation is complex task. One of approaches is:
1. Set affected CPUs offline and disable relevant interrupts
2. Change housekeeping_cpumask
3. Set affected CPUs online and enable relevant interrupts

irq_restore_affinity_of_irq() restores managed interrupts
during complex CPU hotplug process of bringing back a CPU online.

Leave the interrupts disabled those affinity doesn't intersect
with new housekeeping_cpumask thereby ensuring isolation
of the CPU from managed intrrupts.

Signed-off-by: Costa Shulyupin <costa.shul@xxxxxxxxxx>
---
kernel/irq/cpuhotplug.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index ec2cdcd20bee..839d3e879c0d 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -218,6 +218,9 @@ static void irq_restore_affinity_of_irq(struct irq_desc *desc, unsigned int cpu)
if (desc->istate & IRQS_SUSPENDED)
return;

+ if (!cpumask_intersects(affinity, housekeeping_cpumask(HK_TYPE_MANAGED_IRQ)))
+ return;
+
if (irqd_is_managed_and_shutdown(data))
irq_startup(desc, IRQ_RESEND, IRQ_START_COND);

--
2.47.0