> 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