[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230725113628.z7vzxk5g6zdqlftg@linux.intel.com>
Date: Tue, 25 Jul 2023 19:36:29 +0800
From: Yu Zhang <yu.c.zhang@...ux.intel.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Reima Ishii <ishiir@...cc.u-tokyo.ac.jp>
Subject: Re: [PATCH 5/5] KVM: x86/mmu: Use dummy root, backed by zero page,
for !visible guest roots
> diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
> index 122bfc0124d3..e9d4d7b66111 100644
> --- a/arch/x86/kvm/mmu/paging_tmpl.h
> +++ b/arch/x86/kvm/mmu/paging_tmpl.h
> @@ -646,6 +646,17 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,
> if (WARN_ON(!VALID_PAGE(vcpu->arch.mmu->root.hpa)))
> goto out_gpte_changed;
>
> + /*
> + * Load a new root and retry the faulting instruction in the extremely
> + * unlikely scenario that the guest root gfn became visible between
> + * loading a dummy root and handling the resulting page fault, e.g. if
> + * userspace create a memslot in the interim.
> + */
> + if (unlikely(kvm_mmu_is_dummy_root(vcpu->arch.mmu->root.hpa))) {
> + kvm_mmu_unload(vcpu);
Do we really need a kvm_mmu_unload()? Could we just set
vcpu->arch.mmu->root.hpa to INVALID_PAGE here?
> + goto out_gpte_changed;
> + }
> +
> for_each_shadow_entry(vcpu, fault->addr, it) {
> gfn_t table_gfn;
B.R.
Yu
Powered by blists - more mailing lists