path: root/include
diff options
authorLai Jiangshan <>2021-06-01 01:22:56 +0800
committerPaolo Bonzini <>2021-06-08 17:10:21 -0400
commitb53e84eed08b88fd3ff59e5c2a7f1a69d4004e32 (patch)
tree62d39d3be80543decd6c621e1fd87ddb738d3d74 /include
parentf31500b0d437a2464ca5972d8f5439e156b74960 (diff)
KVM: x86: Unload MMU on guest TLB flush if TDP disabled to force MMU sync
When using shadow paging, unload the guest MMU when emulating a guest TLB flush to ensure all roots are synchronized. From the guest's perspective, flushing the TLB ensures any and all modifications to its PTEs will be recognized by the CPU. Note, unloading the MMU is overkill, but is done to mirror KVM's existing handling of INVPCID(all) and ensure the bug is squashed. Future cleanup can be done to more precisely synchronize roots when servicing a guest TLB flush. If TDP is enabled, synchronizing the MMU is unnecessary even if nested TDP is in play, as a "legacy" TLB flush from L1 does not invalidate L1's TDP mappings. For EPT, an explicit INVEPT is required to invalidate guest-physical mappings; for NPT, guest mappings are always tagged with an ASID and thus can only be invalidated via the VMCB's ASID control. This bug has existed since the introduction of KVM_VCPU_FLUSH_TLB. It was only recently exposed after Linux guests stopped flushing the local CPU's TLB prior to flushing remote TLBs (see commit 4ce94eabac16, "x86/mm/tlb: Flush remote and local TLBs concurrently"), but is also visible in Windows 10 guests. Tested-by: Maxim Levitsky <> Reviewed-by: Maxim Levitsky <> Fixes: f38a7b75267f ("KVM: X86: support paravirtualized help for TLB shootdowns") Signed-off-by: Lai Jiangshan <> [sean: massaged comment and changelog] Message-Id: <> Signed-off-by: Sean Christopherson <> Cc: Signed-off-by: Paolo Bonzini <>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions