mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 08:58:07 +00:00
e027fffff7
Several people reported that 5.8 broke the interrupt affinity setting
mechanism.
The consolidation of the entry code reused the regular exception entry code
for device interrupts and changed the way how the vector number is conveyed
from ptregs->orig_ax to a function argument.
The low level entry uses the hardware error code slot to push the vector
number onto the stack which is retrieved from there into a function
argument and the slot on stack is set to -1.
The reason for setting it to -1 is that the error code slot is at the
position where pt_regs::orig_ax is. A positive value in pt_regs::orig_ax
indicates that the entry came via a syscall. If it's not set to a negative
value then a signal delivery on return to userspace would try to restart a
syscall. But there are other places which rely on pt_regs::orig_ax being a
valid indicator for syscall entry.
But setting pt_regs::orig_ax to -1 has a nasty side effect vs. the
interrupt affinity setting mechanism, which was overlooked when this change
was made.
Moving interrupts on x86 happens in several steps. A new vector on a
different CPU is allocated and the relevant interrupt source is
reprogrammed to that. But that's racy and there might be an interrupt
already in flight to the old vector. So the old vector is preserved until
the first interrupt arrives on the new vector and the new target CPU. Once
that happens the old vector is cleaned up, but this cleanup still depends
on the vector number being stored in pt_regs::orig_ax, which is now -1.
That -1 makes the check for cleanup: pt_regs::orig_ax == new_vector
always false. As a consequence the interrupt is moved once, but then it
cannot be moved anymore because the cleanup of the old vector never
happens.
There would be several ways to convey the vector information to that place
in the guts of the interrupt handling, but on deeper inspection it turned
out that this check is pointless and a leftover from the old affinity model
of X86 which supported multi-CPU affinities. Under this model it was
possible that an interrupt had an old and a new vector on the same CPU, so
the vector match was required.
Under the new model the effective affinity of an interrupt is always a
single CPU from the requested affinity mask. If the affinity mask changes
then either the interrupt stays on the CPU and on the same vector when that
CPU is still in the new affinity mask or it is moved to a different CPU, but
it is never moved to a different vector on the same CPU.
Ergo the cleanup check for the matching vector number is not required and
can be removed which makes the dependency on pt_regs:orig_ax go away.
The remaining check for new_cpu == smp_processsor_id() is completely
sufficient. If it matches then the interrupt was successfully migrated and
the cleanup can proceed.
For paranoia sake add a warning into the vector assignment code to
validate that the assumption of never moving to a different vector on
the same CPU holds.
Fixes:
|
||
---|---|---|
.. | ||
acpi | ||
apic | ||
cpu | ||
fpu | ||
kprobes | ||
.gitignore | ||
alternative.c | ||
amd_gart_64.c | ||
amd_nb.c | ||
apb_timer.c | ||
aperture_64.c | ||
apm_32.c | ||
asm-offsets.c | ||
asm-offsets_32.c | ||
asm-offsets_64.c | ||
audit_64.c | ||
bootflag.c | ||
check.c | ||
cpuid.c | ||
crash.c | ||
crash_core_32.c | ||
crash_core_64.c | ||
crash_dump_32.c | ||
crash_dump_64.c | ||
devicetree.c | ||
doublefault_32.c | ||
dumpstack.c | ||
dumpstack_32.c | ||
dumpstack_64.c | ||
e820.c | ||
early-quirks.c | ||
early_printk.c | ||
ebda.c | ||
eisa.c | ||
espfix_64.c | ||
ftrace.c | ||
ftrace_32.S | ||
ftrace_64.S | ||
head32.c | ||
head64.c | ||
head_32.S | ||
head_64.S | ||
hpet.c | ||
hw_breakpoint.c | ||
i8237.c | ||
i8253.c | ||
i8259.c | ||
idt.c | ||
ima_arch.c | ||
io_delay.c | ||
ioport.c | ||
irq.c | ||
irq_32.c | ||
irq_64.c | ||
irq_work.c | ||
irqflags.S | ||
irqinit.c | ||
itmt.c | ||
jailhouse.c | ||
jump_label.c | ||
kdebugfs.c | ||
kexec-bzimage64.c | ||
kgdb.c | ||
ksysfs.c | ||
kvm.c | ||
kvmclock.c | ||
ldt.c | ||
machine_kexec_32.c | ||
machine_kexec_64.c | ||
Makefile | ||
mmconf-fam10h_64.c | ||
module.c | ||
mpparse.c | ||
msr.c | ||
nmi.c | ||
nmi_selftest.c | ||
paravirt-spinlocks.c | ||
paravirt.c | ||
paravirt_patch.c | ||
pci-dma.c | ||
pci-iommu_table.c | ||
pci-swiotlb.c | ||
pcspeaker.c | ||
perf_regs.c | ||
platform-quirks.c | ||
pmem.c | ||
probe_roms.c | ||
process.c | ||
process.h | ||
process_32.c | ||
process_64.c | ||
ptrace.c | ||
pvclock.c | ||
quirks.c | ||
reboot.c | ||
reboot_fixups_32.c | ||
relocate_kernel_32.S | ||
relocate_kernel_64.S | ||
resource.c | ||
rtc.c | ||
setup.c | ||
setup_percpu.c | ||
signal.c | ||
signal_compat.c | ||
smp.c | ||
smpboot.c | ||
stacktrace.c | ||
step.c | ||
sys_ia32.c | ||
sys_x86_64.c | ||
sysfb.c | ||
sysfb_efi.c | ||
sysfb_simplefb.c | ||
tboot.c | ||
time.c | ||
tls.c | ||
tls.h | ||
topology.c | ||
trace_clock.c | ||
tracepoint.c | ||
traps.c | ||
tsc.c | ||
tsc_msr.c | ||
tsc_sync.c | ||
umip.c | ||
unwind_frame.c | ||
unwind_guess.c | ||
unwind_orc.c | ||
uprobes.c | ||
verify_cpu.S | ||
vm86_32.c | ||
vmlinux.lds.S | ||
vsmp_64.c | ||
x86_init.c |