[PATCH] KVM: arm64: Reload PTE after invoking walker callback on preorder traversal

Fuad Tabba tabba at google.com
Mon May 22 03:59:36 PDT 2023


On Mon, May 22, 2023 at 11:58 AM Marc Zyngier <maz at kernel.org> wrote:
>
> On Mon, 22 May 2023 11:48:38 +0100,
> Marc Zyngier <maz at kernel.org> wrote:
> >
> > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> > > index 3d61bd3e591d..120c49d52ca0 100644
> > > --- a/arch/arm64/kvm/hyp/pgtable.c
> > > +++ b/arch/arm64/kvm/hyp/pgtable.c
> > > @@ -207,14 +207,26 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data,
> > >             .flags  = flags,
> > >     };
> > >     int ret = 0;
> > > +   bool reload = false;
> > >     kvm_pteref_t childp;
> > >     bool table = kvm_pte_table(ctx.old, level);
> > >
> > > -   if (table && (ctx.flags & KVM_PGTABLE_WALK_TABLE_PRE))
> > > +   if (table && (ctx.flags & KVM_PGTABLE_WALK_TABLE_PRE)) {
> > >             ret = kvm_pgtable_visitor_cb(data, &ctx, KVM_PGTABLE_WALK_TABLE_PRE);
> > > +           reload = true;
> > > +   }
> > >
> > >     if (!table && (ctx.flags & KVM_PGTABLE_WALK_LEAF)) {
> > >             ret = kvm_pgtable_visitor_cb(data, &ctx, KVM_PGTABLE_WALK_LEAF);
> > > +           reload = true;
> > > +   }
> >
> > From these two clauses, it is clear that reload is always the value of
> > (ctx.flags & KVM_PGTABLE_WALK_LEAF). That'd simplify the patch a bit.
>
> OK, it should be obvious by now that I cannot read, because TABLE_PRE and
> LEAF are very different things.
>
> Sorry about the noise. I'll fix the trailer thing and stay quiet for
> the rest of the day...

:)

Thanks Marc!
/fuad

>
>         M.
>
> --
> Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list