TencentOS-kernel/arch
Ashok Raj 837711634d x86/hotplug: Silence APIC only after all interrupts are migrated
commit 52d6b926aabc47643cd910c85edb262b7f44c168 upstream.

There is a race when taking a CPU offline. Current code looks like this:

native_cpu_disable()
{
	...
	apic_soft_disable();
	/*
	 * Any existing set bits for pending interrupt to
	 * this CPU are preserved and will be sent via IPI
	 * to another CPU by fixup_irqs().
	 */
	cpu_disable_common();
	{
		....
		/*
		 * Race window happens here. Once local APIC has been
		 * disabled any new interrupts from the device to
		 * the old CPU are lost
		 */
		fixup_irqs(); // Too late to capture anything in IRR.
		...
	}
}

The fix is to disable the APIC *after* cpu_disable_common().

Testing was done with a USB NIC that provided a source of frequent
interrupts. A script migrated interrupts to a specific CPU and
then took that CPU offline.

Fixes: 60dcaad5736f ("x86/hotplug: Silence APIC and NMI when CPU is dead")
Reported-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Tested-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/875zdarr4h.fsf@nanos.tec.linutronix.de/
Link: https://lore.kernel.org/r/1598501530-45821-1-git-send-email-ashok.raj@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-16 16:35:14 +08:00
..
alpha alpha: fix annotation of io{read,write}{16,32}be() 2021-03-16 16:34:34 +08:00
arc ARC: elf: use right ELF_ARCH 2021-03-16 16:31:39 +08:00
arm ARM: dts: ls1021a: output PPS signal on FIPER2 2021-03-16 16:34:50 +08:00
arm64 arm64: vdso32: make vdso32 install conditional 2021-03-16 16:35:13 +08:00
c6x Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
csky csky: Fixup abiv2 syscall_trace break a4 & a5 2021-03-16 16:28:56 +08:00
h8300 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hexagon hexagon: define ioremap_uc 2021-03-16 16:27:29 +08:00
ia64 scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
m68k m68knommu: fix overwriting of bits in ColdFire V3 cache control 2021-03-16 16:34:32 +08:00
microblaze Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mips mips/vdso: Fix resource leaks in genvdso.c 2021-03-16 16:34:50 +08:00
nds32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nios2 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
openrisc openrisc: Fix oops caused when dumping stack 2021-03-16 16:34:18 +08:00
parisc parisc: Implement __smp_store_release and __smp_load_acquire barriers 2021-03-16 16:33:54 +08:00
powerpc powerpc/perf: Fix crashes with generic_compat_pmu & BHRB 2021-03-16 16:35:13 +08:00
riscv RISC-V: Set maximum number of mapped pages correctly 2021-03-16 16:32:57 +08:00
s390 s390/numa: set node distance to LOCAL_DISTANCE 2021-03-16 16:34:56 +08:00
sh sh: landisk: Add missing initialization of sh_io_port_base 2021-03-16 16:34:22 +08:00
sparc scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2021-03-16 16:31:54 +08:00
um um: ensure `make ARCH=um mrproper` removes arch/$(SUBARCH)/include/generated/ 2021-03-16 16:27:11 +08:00
unicore32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
x86 x86/hotplug: Silence APIC only after all interrupts are migrated 2021-03-16 16:35:14 +08:00
xtensa xtensa: fix xtensa_pmu_setup prototype 2021-03-16 16:34:03 +08:00
.gitignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00