Re: [PATCH 13/13] KVM: x86/mmu: Tear down roots in fast invalidation thread

From: Sean Christopherson
Date: Wed Mar 31 2021 - 18:30:26 EST


On Wed, Mar 31, 2021, Ben Gardon wrote:
> ---
> arch/x86/kvm/mmu/mmu.c | 6 ++++
> arch/x86/kvm/mmu/tdp_mmu.c | 74 +++++++++++++++++++++++++++++++++++++-
> arch/x86/kvm/mmu/tdp_mmu.h | 1 +
> 3 files changed, 80 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 49b7097fb55b..22742619698d 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5455,6 +5455,12 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
> kvm_zap_obsolete_pages(kvm);
>
> write_unlock(&kvm->mmu_lock);
> +
> + if (is_tdp_mmu_enabled(kvm)) {
> + read_lock(&kvm->mmu_lock);
> + kvm_tdp_mmu_zap_all_fast(kvm);

Purely because it exists first, I think we should follow the legacy MMU's
terminology, i.e. kvm_tdp_mmu_zap_obsolete_pages().

> + read_unlock(&kvm->mmu_lock);
> + }
> }