lkml.org 
[lkml]   [2021]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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);
> +}

\
 
 \ /
  Last update: 2021-12-08 20:17    [W:0.330 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site