diff options
author | 2022-03-21 05:05:08 -0400 | |
---|---|---|
committer | 2022-03-21 05:11:51 -0400 | |
commit | fcb93eb6d09dd302cbef22bd95a5858af75e4156 (patch) | |
tree | 52c79ff4f635cb0830b070bf0d54e5dac63d518d | |
parent | Merge tag 'kvmarm-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/kvma... (diff) | |
download | linux-fcb93eb6d09dd302cbef22bd95a5858af75e4156.tar.gz linux-fcb93eb6d09dd302cbef22bd95a5858af75e4156.tar.bz2 linux-fcb93eb6d09dd302cbef22bd95a5858af75e4156.zip |
kvm: x86/mmu: Flush TLB before zap_gfn_range releases RCU
Since "KVM: x86/mmu: Zap only TDP MMU leafs in kvm_zap_gfn_range()"
is going to be reverted, it's not going to be true anymore that
the zap-page flow does not free any 'struct kvm_mmu_page'. Introduce
an early flush before tdp_mmu_zap_leafs() returns, to preserve
bisectability.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu/tdp_mmu.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index af60922906ef..7f63e1a704e3 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -941,13 +941,17 @@ static bool tdp_mmu_zap_leafs(struct kvm *kvm, struct kvm_mmu_page *root, flush = true; } - rcu_read_unlock(); - /* - * Because this flow zaps _only_ leaf SPTEs, the caller doesn't need - * to provide RCU protection as no 'struct kvm_mmu_page' will be freed. + * Need to flush before releasing RCU. TODO: do it only if intermediate + * page tables were zapped; there is no need to flush under RCU protection + * if no 'struct kvm_mmu_page' is freed. */ - return flush; + if (flush) + kvm_flush_remote_tlbs_with_address(kvm, start, end - start); + + rcu_read_unlock(); + + return false; } /* |