[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a95b2f6-a7ad-5101-baa5-6a19194695a3@redhat.com>
Date: Thu, 12 Aug 2021 19:38:43 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Ben Gardon <bgardon@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] KVM: x86/mmu: Don't step down in the TDP iterator
when zapping all SPTEs
On 12/08/21 19:33, Sean Christopherson wrote:
> On Thu, Aug 12, 2021, Paolo Bonzini wrote:
>> On 12/08/21 19:07, Sean Christopherson wrote:
>>> Yeah, I was/am on the fence too, I almost included a blurb in the cover letter
>>> saying as much. I'll do that for v2 and let Paolo decide.
>>
>> I think it makes sense to have it. You can even use the ternary operator
>
> Hah, yeah, I almost used a ternary op. Honestly don't know why I didn't, guess
> my brain flipped a coin.
>
>>
>> /*
>> * When zapping everything, all entries at the top level
>> * ultimately go away, and the levels below go down with them.
>> * So do not bother iterating all the way down to the leaves.
>
> The subtle part is that try_step_down() won't actually iterate down because it
> explicitly rereads and rechecks the SPTE.
>
> if (iter->level == iter->min_level)
> return false;
>
> /*
> * Reread the SPTE before stepping down to avoid traversing into page
> * tables that are no longer linked from this entry.
> */
> iter->old_spte = READ_ONCE(*rcu_dereference(iter->sptep)); \
> ---> this is the code that is avoided
> child_pt = spte_to_child_pt(iter->old_spte, iter->level); /
> if (!child_pt)
> return false;
Ah, right - so I agree with Ben that it's not too important.
Paolo
Powered by blists - more mailing lists