On Fri, Aug 9, 2024 at 12:48 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 0a33857d668a..88b656a1453d 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > +static bool kvm_rmap_age_gfn_range(struct kvm *kvm, > + struct kvm_gfn_range *range, bool test_only) > +{ > + struct slot_rmap_walk_iterator iterator; > + struct rmap_iterator iter; > + bool young = false; > + u64 *sptep; > + > + for_each_slot_rmap_range(range->slot, PG_LEVEL_4K, KVM_MAX_HUGEPAGE_LEVEL, > + range->start, range->end - 1, &iterator) { > + for_each_rmap_spte(iterator.rmap, &iter, sptep) { > + if (test_only && is_accessed_spte(*sptep)) > + return true; > + > + young = mmu_spte_age(sptep); It's jarring to see that mmu_spte_age() can get called in the test_only case, even though I think the code is technically correct (it will only be called if !is_accessed_spte() in which case mmu_spte_age() will do nothing).