lkml.org 
[lkml]   [2020]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 18/22] kvm: mmu: Support disabling dirty logging for the tdp MMU
On Fri, Sep 25, 2020 at 6:09 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 25/09/20 23:22, Ben Gardon wrote:
> > + for_each_tdp_pte_root(iter, root, start, end) {
> > + if (!is_shadow_present_pte(iter.old_spte) ||
> > + is_last_spte(iter.old_spte, iter.level))
> > + continue;
> > +
>
> I'm starting to wonder if another iterator like
> for_each_tdp_leaf_pte_root would be clearer, since this idiom repeats
> itself quite often. The tdp_iter_next_leaf function would be easily
> implemented as
>
> while (likely(iter->valid) &&
> (!is_shadow_present_pte(iter.old_spte) ||
> is_last_spte(iter.old_spte, iter.level))
> tdp_iter_next(iter);

Do you see a substantial efficiency difference between adding a
tdp_iter_next_leaf and building on for_each_tdp_pte_using_root with
something like:

#define for_each_tdp_leaf_pte_using_root(_iter, _root, _start, _end) \
for_each_tdp_pte_using_root(_iter, _root, _start, _end) \
if (!is_shadow_present_pte(_iter.old_spte) || \
!is_last_spte(_iter.old_spte, _iter.level)) \
continue; \
else

I agree that putting those checks in a wrapper makes the code more concise.

>
> Paolo
>

\
 
 \ /
  Last update: 2020-10-07 18:31    [W:0.122 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site