KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping
authorSean Christopherson <seanjc@google.com>
Sat, 10 Apr 2021 15:12:27 +0000 (11:12 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Apr 2021 06:42:04 +0000 (08:42 +0200)
commitbe2c527b5d392d9395dea992b0db4087de3c993d
tree8e0b5c7c82a5e236c567ea5ccc2d27f6f1ea3f65
parent0aa4dd9e513209819579296f5d3d240f288cd423
KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping

[ Upstream commit 048f49809c526348775425420fb5b8e84fd9a133 ]

Honor the "flush needed" return from kvm_tdp_mmu_zap_gfn_range(), which
does the flush itself if and only if it yields (which it will never do in
this particular scenario), and otherwise expects the caller to do the
flush.  If pages are zapped from the TDP MMU but not the legacy MMU, then
no flush will occur.

Fixes: 29cf0f5007a2 ("kvm: x86/mmu: NX largepage recovery for TDP MMU")
Cc: stable@vger.kernel.org
Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210325200119.1359384-3-seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/mmu/mmu.c