]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: preserve pending TLB flush across calls to kvm_tdp_mmu_zap_sp
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 Apr 2021 15:08:51 +0000 (11:08 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 8 Apr 2021 11:48:18 +0000 (07:48 -0400)
commitb86db5a1c7941676cde2183ae75f6471383dda7e
tree862f1cf2659e23ebe3fb4c20d1a02e44b46c1a97
parent5004d00b2f98381dfb392087f022178d230f4572
KVM: x86/mmu: preserve pending TLB flush across calls to kvm_tdp_mmu_zap_sp

Right now, if a call to kvm_tdp_mmu_zap_sp returns false, the caller
will skip the TLB flush, which is wrong.  There are two ways to fix
it:

- since kvm_tdp_mmu_zap_sp will not yield and therefore will not flush
  the TLB itself, we could change the call to kvm_tdp_mmu_zap_sp to
  use "flush |= ..."

- or we can chain the flush argument through kvm_tdp_mmu_zap_sp down
  to __kvm_tdp_mmu_zap_gfn_range.  Note that kvm_tdp_mmu_zap_sp will
  neither yield nor flush, so flush would never go from true to
  false.

This patch does the former to simplify application to stable kernels,
and to make it further clearer that kvm_tdp_mmu_zap_sp will not flush.

Cc: seanjc@google.com
Fixes: 9d94992da0fc0 ("KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping")
Cc: <stable@vger.kernel.org> # 5.10.x: 9d94992da0: KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping
Cc: <stable@vger.kernel.org> # 5.10.x: 87fdcb64ca: KVM: x86/mmu: Don't allow TDP MMU to yield when recovering NX pages
Cc: <stable@vger.kernel.org>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c