Re: [PATCH v3 1/3] KVM: arm64: Avoid re-testing walk_continue

From: Leonardo Bras

Date: Wed Jul 08 2026 - 13:08:50 EST


On Wed, Jul 08, 2026 at 05:41:05PM +0100, Marc Zyngier wrote:
> On Wed, 08 Jul 2026 14:40:57 +0100,
> Leonardo Bras <leo.bras@xxxxxxx> wrote:
> >
> > In __kvm_pgtable_visit(), a couple tests for kvm_pgtable_walk_continue()
> > will 'goto out' if it should not continue. This means the same test will be
> > ran again before returning ret, which is unnecessary.
> >
> > Return ret directly instead.
> > This will simplify next patch.
>
> This reads quite badly, and doesn't explain what you are trying to do.
> How about something like:
>
> "__kvm_pgtable_visit() performs a bunch of calls to
> kvm_pgtable_walk_continue() to find out whether the walk can continue
> further, and if not, falls back to an 'goto out' which retests the
> possibility of continuing the walk.
>
> Given that there is no reason why the situation would have changed
> between the two checks, turn this goto into an early return,
> simplifying the code and paving the way for further rework."
>

Agree, your version looks better.
Will try to be more clear, and reuse some of your version, in my next
version.

Thanks!
Leo