1
0
Fork 0
alistair23-linux/arch/x86
Thomas Gleixner 0696d059f2 x86/vector: Use correct per cpu variable in free_moved_vector()
free_moved_vector() accesses the per cpu vector array with this_cpu_write()
to clear the vector. The function has two call sites:

 1) The vector cleanup IPI
 2) The force_complete_move() code path

For #1 this_cpu_write() is correct as it runs on the CPU on which the
vector needs to be freed.

For #2 this_cpu_write() is wrong because the function is called from an
outgoing CPU which is not necessarily the CPU on which the previous vector
needs to be freed. As a result it sets the vector on the outgoing CPU to
NULL, which is pointless as that CPU does not handle interrupts
anymore. What's worse is that it leaves the vector on the previous target
CPU in place which later on triggers the BUG_ON(vector) in the vector
allocation code when the vector gets reused. That's possible because the
bitmap allocator entry of that CPU is freed correctly.

Always use the CPU to which the vector was associated and clear the vector
entry on that CPU. Fixup the tracepoint as well so it tracks on which CPU
the vector gets removed.

Fixes: 69cde0004a ("x86/vector: Use matrix allocator for vector assignment")
Reported-by: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rui Zhang <rui.zhang@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Alok Kataria <akataria@vmware.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Yu Chen <yu.c.chen@intel.com>
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1710161614430.1973@nanos
2017-10-17 16:45:09 +02:00
..
boot Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:42:35 -07:00
configs Merge branch 'x86/urgent' into x86/asm, to pick up fixes 2017-08-10 13:14:15 +02:00
crypto crypto: x86/twofish - Fix RBP usage 2017-09-20 17:42:38 +08:00
entry Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-04 17:43:56 -07:00
events Merge branch 'core-watchdog-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-10-06 08:36:41 -07:00
hyperv tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others() 2017-08-31 14:20:37 +02:00
ia32 x86/fpu: Rename fpu::fpstate_active to fpu::initialized 2017-09-26 09:43:36 +02:00
include x86/vector: Use correct per cpu variable in free_moved_vector() 2017-10-17 16:45:09 +02:00
kernel x86/vector: Use correct per cpu variable in free_moved_vector() 2017-10-17 16:45:09 +02:00
kvm KVM: add X86_LOCAL_APIC dependency 2017-10-05 19:55:48 +02:00
lib x86/boot: Add early cmdline parsing for options with arguments 2017-07-18 11:38:06 +02:00
math-emu x86/fpu: Rename fpu__activate_curr() to fpu__initialize() 2017-09-26 09:43:44 +02:00
mm Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-10-01 13:55:32 -07:00
net bpf: fix bpf_tail_call() x64 JIT 2017-10-03 16:04:44 -07:00
oprofile
pci dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
platform genirq/irqdomain: Update irq_domain_ops.activate() signature 2017-09-25 20:38:24 +02:00
power dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
purgatory kasan: do not sanitize kexec purgatory 2017-03-31 17:13:30 -07:00
ras x86/mce: Merge mce_amd_inj into mce-inject 2017-06-14 07:32:07 +02:00
realmode x86/boot/realmode: Check for memory encryption on the APs 2017-07-18 11:38:04 +02:00
tools
um um: remove a stray tab 2017-09-13 22:36:27 +02:00
video
xen Merge branch 'irq/urgent' into x86/apic 2017-10-12 11:02:50 +02:00
.gitignore
Kbuild Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:25:15 -07:00
Kconfig x86/irq/vector: Initialize matrix allocator 2017-09-25 20:51:56 +02:00
Kconfig.cpu
Kconfig.debug Merge branch 'x86/asm' into locking/core 2017-08-18 10:29:54 +02:00
Makefile x86/build: Use cc-option to validate stack alignment parameter 2017-08-21 09:53:15 +02:00
Makefile.um
Makefile_32.cpu kbuild: remove cc-option-align 2017-06-25 12:43:00 +09:00