OSDN Git Service

KVM: x86/mmu: Use leaf-only loop for walking TDP SPTEs when changing SPTE
authorSean Christopherson <seanjc@google.com>
Fri, 26 Mar 2021 02:19:46 +0000 (19:19 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 17 Apr 2021 12:30:55 +0000 (08:30 -0400)
Use the leaf-only TDP iterator when changing the SPTE in reaction to a
MMU notifier.  Practically speaking, this is a nop since the guts of the
loop explicitly looks for 4k SPTEs, which are always leaf SPTEs.  Switch
the iterator to match age_gfn_range() and test_age_gfn() so that a future
patch can consolidate the core iterating logic.

No real functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210326021957.1424875-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c

index 3608f4a..6b7a536 100644 (file)
@@ -1037,7 +1037,7 @@ static int set_tdp_spte(struct kvm *kvm, struct kvm_memory_slot *slot,
 
        new_pfn = pte_pfn(*ptep);
 
-       tdp_root_for_each_pte(iter, root, gfn, gfn + 1) {
+       tdp_root_for_each_leaf_pte(iter, root, gfn, gfn + 1) {
                if (iter.level != PG_LEVEL_4K)
                        continue;