genirq/cpuhotplug: Revert "Set force affinity flag on hotplug migration"

That commit was part of the changes moving x86 to the generic CPU hotplug
interrupt migration code. The force flag was required on x86 before the
hierarchical irqdomain rework, but invoking set_affinity() with force=true
stayed and had no side effects.

At some point in the past, the force flag got repurposed to support the
exynos timer interrupt affinity setting to a not yet online CPU, so the
interrupt controller callback does not verify the supplied affinity mask
against cpu_online_mask.

Setting the flag in the CPU hotplug code causes the cpu online masking to
be blocked on these irq controllers and results in potentially affining an
interrupt to the CPU which is unplugged, i.e. instead of moving it away,
it's just reassigned to it.

As the force flags is not longer needed on x86, it's safe to revert that
patch so the ARM irqchips which use the force flag work again.

Add comments to that effect, so this won't happen again.

Note: The online mask handling should be done in the generic code and the
force flag and the masking in the irq chips removed all together, but
that's not a change possible for 4.13.

Fixes: 77f85e66aa8b ("genirq/cpuhotplug: Set force affinity flag on hotplug migration")
Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: LAK <linux-arm-kernel@lists.infradead.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1707271217590.3109@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Changed files
+13 -3
include
linux
kernel
+6 -1
include/linux/irq.h
··· 388 388 * @irq_mask_ack: ack and mask an interrupt source 389 389 * @irq_unmask: unmask an interrupt source 390 390 * @irq_eoi: end of interrupt 391 - * @irq_set_affinity: set the CPU affinity on SMP machines 391 + * @irq_set_affinity: Set the CPU affinity on SMP machines. If the force 392 + * argument is true, it tells the driver to 393 + * unconditionally apply the affinity setting. Sanity 394 + * checks against the supplied affinity mask are not 395 + * required. This is used for CPU hotplug where the 396 + * target CPU is not yet set in the cpu_online_mask. 392 397 * @irq_retrigger: resend an IRQ to the CPU 393 398 * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ 394 399 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
+7 -2
kernel/irq/cpuhotplug.c
··· 95 95 affinity = cpu_online_mask; 96 96 brokeaff = true; 97 97 } 98 - 99 - err = irq_do_set_affinity(d, affinity, true); 98 + /* 99 + * Do not set the force argument of irq_do_set_affinity() as this 100 + * disables the masking of offline CPUs from the supplied affinity 101 + * mask and therefore might keep/reassign the irq to the outgoing 102 + * CPU. 103 + */ 104 + err = irq_do_set_affinity(d, affinity, false); 100 105 if (err) { 101 106 pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", 102 107 d->irq, err);