On 8/20/20 5:42 PM, Ashok Raj wrote:
> When offlining CPUs, fixup_irqs() migrates all interrupts away from the
> outgoing CPU to an online CPU. It's always possible the device sent an
> interrupt to the previous CPU destination. Pending interrupt bit in IRR in
> LAPIC identifies such interrupts. apic_soft_disable() will not capture any
> new interrupts in IRR. This causes interrupts from device to be lost during
> CPU offline. The issue was found when explicitly setting MSI affinity to a
> CPU and immediately offlining it. It was simple to recreate with a USB
> ethernet device and doing I/O to it while the CPU is offlined. Lost
> interrupts happen even when Interrupt Remapping is enabled.
> 
> Current code does apic_soft_disable() before migrating interrupts.
> 
> native_cpu_disable()
> {
>       ...
>       apic_soft_disable();
>       cpu_disable_common();
>         --> fixup_irqs(); // Too late to capture anything in IRR.
> }
> 
> Just flipping the above call sequence seems to hit the IRR checks
> and the lost interrupt is fixed for both legacy MSI and when
> interrupt remapping is enabled.
> 
> Fixes: 60dcaad5736f ("x86/hotplug: Silence APIC and NMI when CPU is dead")
> Link: https://lore.kernel.org/lkml/[email protected]/
> Reported-by: Evan Green <[email protected]>
> Tested-by: Mathias Nyman <[email protected]>
> Tested-by: Evan Green <[email protected]>
> Reviewed-by: Evan Green <[email protected]>
> Signed-off-by: Ashok Raj <[email protected]>
> ---
> v2:
> - Typos and fixes suggested by Randy Dunlap

Those all look good now.  Thanks for the update.

> To: [email protected]
> To: Thomas Gleixner <[email protected]>
> Cc: Sukumar Ghorai <[email protected]>
> Cc: Srikanth Nandamuri <[email protected]>
> Cc: Evan Green <[email protected]>
> Cc: Mathias Nyman <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Cc: [email protected]
> ---
>  arch/x86/kernel/smpboot.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)


-- 
~Randy

Reply via email to