On Wed, Oct 22, 2025 at 11:12:47AM -0700, Sean Christopherson wrote: > On Wed, Oct 22, 2025, Yan Zhao wrote: > > On Tue, Oct 21, 2025 at 09:36:52AM -0700, Sean Christopherson wrote: > > > On Tue, Oct 21, 2025, Yan Zhao wrote: > > > > On Thu, Oct 16, 2025 at 05:32:22PM -0700, Sean Christopherson wrote: > > Is it good if we test is_page_fault_stale()? e.g., > No, because it can only get false positives, e.g. if an mmu_notifier > invalidation > on shared, non-guest_memfd memory. Though a sanity check would be nice to > have; Right. The false positive is annoying.
> I believe we can simply do: > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > index c5734ca5c17d..440fd8f80397 100644 > --- a/arch/x86/kvm/mmu/tdp_mmu.c > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -1273,6 +1273,8 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct > kvm_page_fault *fault) > struct kvm_mmu_page *sp; > int ret = RET_PF_RETRY; > > + KVM_MMU_WARN_ON(!root || root->role.invalid); > + > kvm_mmu_hugepage_adjust(vcpu, fault); > > trace_kvm_mmu_spte_requested(fault); Ok.
