On Fri, Jun 11, 2021 at 4:57 PM David Matlack <dmatlack@xxxxxxxxxx> wrote: > > In order to use walk_shadow_page_lockless() in fast_page_fault() we need > to also record the spteps. > > No functional change intended. > > Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx> Reviewed-by: Ben Gardon <bgardon@xxxxxxxxxx> > --- > arch/x86/kvm/mmu/mmu.c | 1 + > arch/x86/kvm/mmu/mmu_internal.h | 3 +++ > arch/x86/kvm/mmu/tdp_mmu.c | 1 + > 3 files changed, 5 insertions(+) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 8140c262f4d3..765f5b01768d 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -3538,6 +3538,7 @@ static bool walk_shadow_page_lockless(struct kvm_vcpu *vcpu, u64 addr, > spte = mmu_spte_get_lockless(it.sptep); > walk->last_level = it.level; > walk->sptes[it.level] = spte; > + walk->spteps[it.level] = it.sptep; > > if (!is_shadow_present_pte(spte)) > break; > diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h > index 26da6ca30fbf..0fefbd5d6c95 100644 > --- a/arch/x86/kvm/mmu/mmu_internal.h > +++ b/arch/x86/kvm/mmu/mmu_internal.h > @@ -178,6 +178,9 @@ struct shadow_page_walk { > > /* The spte value at each level. */ > u64 sptes[PT64_ROOT_MAX_LEVEL + 1]; > + > + /* The spte pointers at each level. */ > + u64 *spteps[PT64_ROOT_MAX_LEVEL + 1]; > }; > > #endif /* __KVM_X86_MMU_INTERNAL_H */ > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > index 36f4844a5f95..7279d17817a1 100644 > --- a/arch/x86/kvm/mmu/tdp_mmu.c > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -1529,6 +1529,7 @@ bool kvm_tdp_mmu_walk_lockless(struct kvm_vcpu *vcpu, u64 addr, > > walk->last_level = iter.level; > walk->sptes[iter.level] = iter.old_spte; > + walk->spteps[iter.level] = iter.sptep; > } > > return walk_ok; > -- > 2.32.0.272.g935e593368-goog >