linux/arch/x86
Sean Christopherson 2cf024c9e0 KVM: x86/mmu: Do not cache MMIO accesses while memslots are in flux
commit ddfd1730fd upstream.

When installing new memslots, KVM sets bit 0 of the generation number to
indicate that an update is in-progress.  Until the update is complete,
there are no guarantees as to whether a vCPU will see the old or the new
memslots.  Explicity prevent caching MMIO accesses so as to avoid using
an access cached from the old memslots after the new memslots have been
installed.

Note that it is unclear whether or not disabling caching during the
update window is strictly necessary as there is no definitive
documentation as to what ordering guarantees KVM provides with respect
to updating memslots.  That being said, the MMIO spte code does not
allow reusing sptes created while an update is in-progress, and the
associated documentation explicitly states:

    We do not want to use an MMIO sptes created with an odd generation
    number, ...  If KVM is unlucky and creates an MMIO spte while the
    low bit is 1, the next access to the spte will always be a cache miss.

At the very least, disabling the per-vCPU MMIO cache during updates will
make its behavior consistent with the MMIO spte behavior and
documentation.

Fixes: 56f17dd3fb ("kvm: x86: fix stale mmio cache bug")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-07-09 22:04:04 +01:00
..
boot x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
configs USB: remove CONFIG_USB_DEBUG from defconfig files 2014-05-28 09:40:45 -07:00
crypto x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
ia32 x86/speculation/mds: Clear CPU buffers on exit to user 2019-05-22 23:15:22 +01:00
include x86/speculation/mds: Add mitigation mode VMWERV 2019-05-22 23:15:24 +01:00
kernel x86/bugs: Change L1TF mitigation string to match upstream 2019-05-22 23:15:28 +01:00
kvm KVM: x86/mmu: Do not cache MMIO accesses while memslots are in flux 2019-07-09 22:04:04 +01:00
lguest asmlinkage, x86: Add explicit __visible to arch/x86/* 2014-05-05 16:07:44 -07:00
lib x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
math-emu x86/ldt: Further fix FPU emulation 2015-09-03 13:29:55 +01:00
mm x86/speculation: Support 'mitigations=' cmdline option 2019-05-22 23:15:26 +01:00
net bpf, x64: fix memleak when not converging after image 2018-10-21 08:45:51 +01:00
oprofile x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
pci x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux) 2019-04-04 16:13:40 +01:00
platform x86/platform/uv: Include clocksource.h for clocksource_touch_watchdog() 2018-02-13 18:42:35 +00:00
power x86/power/64: Fix kernel text mapping corruption during image restoration 2016-08-22 22:38:25 +01:00
realmode x86/build: Supress realmode.bin is up to date message 2014-04-16 15:17:24 +02:00
syscalls seccomp: add "seccomp" syscall 2018-09-25 23:47:34 +01:00
tools x86/tools: Fix gcc-7 warning in relocs.c 2018-10-03 04:10:07 +01:00
um x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
vdso x86/cpufeature: Carve out X86_FEATURE_* 2019-05-22 23:15:08 +01:00
video x86: Use vga_default_device() when determining whether an fb is primary 2012-04-24 09:50:17 +01:00
xen tracing/x86/xen: Remove zero data size trace events trace_xen_mmu_flush_tlb{_all} 2018-10-21 08:46:06 +01:00
.gitignore x86/kprobes: Add arch/x86/tools/insn_sanity to .gitignore 2012-01-16 08:21:59 +01:00
Kbuild x86, realmode: realmode.bin infrastructure 2012-05-08 11:41:48 -07:00
Kconfig x86/Kconfig: Select SCHED_SMT if SMP enabled 2019-05-22 23:15:13 +01:00
Kconfig.cpu Merge branch 'x86-nuke-platforms-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-04-02 13:15:58 -07:00
Kconfig.debug x86/efi: Dump the EFI page table 2014-03-04 16:17:17 +00:00
Makefile x86/retpoline: Remove compile time warning 2018-03-19 18:59:08 +00:00
Makefile.um um: fix linker script generation 2012-04-09 13:59:00 -04:00
Makefile_32.cpu x86, 386 removal: Remove CONFIG_M386 from Kconfig 2012-11-29 13:23:01 -08:00