]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86/mmu: Remove spurious TLB flush from TDP MMU's change_pte() hook
authorSean Christopherson <seanjc@google.com>
Fri, 26 Feb 2021 01:03:25 +0000 (17:03 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 26 Feb 2021 13:36:09 +0000 (08:36 -0500)
commit63dfdd709bb37569142eb2de7343e3dbd3d705a9
treea945e66225409582e1148822f307f540c63d128e
parenta403d592fc1a3188d3417b80b352c7c21d448d55
KVM: x86/mmu: Remove spurious TLB flush from TDP MMU's change_pte() hook

Remove an unnecessary remote TLB flush from set_tdp_spte(), the TDP MMu's
hook for handling change_pte() invocations from the MMU notifier.  If
the new host PTE is writable, the flush is completely redundant as there
are no futher changes to the SPTE before the post-loop flush.  If the
host PTE is read-only, then the primary MMU is responsible for ensuring
that the contents of the old and new pages are identical, thus it's safe
to let the guest continue reading both the old and new pages.  KVM must
only ensure the old page cannot be referenced after returning from its
callback; this is handled by the post-loop flush.

Fixes: 1d8dd6b3f12b ("kvm: x86/mmu: Support changed pte notifier in tdp MMU")
Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210226010329.1766033-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c