[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YbEEuZBjEjOO9Pws@google.com>
Date: Wed, 8 Dec 2021 19:17:13 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Hou Wenlong <houwenlong93@...ux.alibaba.com>,
Ben Gardon <bgardon@...gle.com>
Subject: Re: [PATCH 04/28] KVM: x86/mmu: Retry page fault if root is
invalidated by memslot update
On Sat, Nov 20, 2021, Sean Christopherson wrote:
> @@ -3976,6 +3980,20 @@ static bool kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault,
> return true;
> }
>
> +/*
> + * Returns true if the page fault is stale and needs to be retried, i.e. if the
> + * root was invalidated by a memslot update or a relevant mmu_notifier fired.
> + */
> +static bool is_page_fault_stale(struct kvm_vcpu *vcpu,
> + struct kvm_page_fault *fault, int mmu_seq)
> +{
> + if (is_obsolete_sp(vcpu->kvm, to_shadow_page(vcpu->arch.mmu->root_hpa)))
Ugh, I got so focused on TDP MMU that I completely forgot to test this with shadow
paging. PAE roots are not backed by shadow pages, which means this explodes on the
very first page fault with TDP disabled. Nested NPT will suffer the same fate.
I'll figure out a patch for 5.16. Long term, it might be nice to actually allocate
shadow pages for the special roots.
> + return true;
> +
> + return fault->slot &&
> + mmu_notifier_retry_hva(vcpu->kvm, mmu_seq, fault->hva);
> +}
Powered by blists - more mailing lists