[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALzav=fPS3Q43tq74Le754EvxboCvW--TMKWES3e2z=kjV+0cg@mail.gmail.com>
Date: Mon, 12 Aug 2024 14:58:47 -0700
From: David Matlack <dmatlack@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Oliver Upton <oliver.upton@...ux.dev>, Marc Zyngier <maz@...nel.org>, Peter Xu <peterx@...hat.com>,
James Houghton <jthoughton@...gle.com>
Subject: Re: [PATCH 14/22] KVM: x86/mmu: Morph kvm_handle_gfn_range() into an
aging specific helper
On Mon, Aug 12, 2024 at 2:53 PM David Matlack <dmatlack@...gle.com> wrote:
>
> On Fri, Aug 9, 2024 at 12:48 PM Sean Christopherson <seanjc@...gle.com> 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).
Nevermind, I see this is cleaned up in the following patch.
Powered by blists - more mailing lists