mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Leonardo Bras <leo.bras@arm.com>, Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oupton@kernel.org>,
	Fuad Tabba <fuad.tabba@linux.dev>,
	Joey Gouly <joey.gouly@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Raghavendra Rao Ananta <rananta@google.com>
Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND v4 1/3] KVM: arm64: Avoid re-testing walk_continue
Date: Fri, 6 Nov 2026 16:59:05 +0000	[thread overview]
Message-ID: <1639d961-1092-4a47-8825-55c1647a115b@arm.com> (raw)
In-Reply-To: <20261106161240.1345126-2-leo.bras@arm.com>

On 06/11/2026 16:12, Leonardo Bras wrote:
> __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, 'goto out', which retests the possibility of
> continuing the walk before exiting.
> 
> Given that it's testing the same ret variable again, there is no reason
> the result of kvm_pgtable_walk_continue() would have changed since the
> previous check. So turn this goto into an early return, simplifying the
> code and paving the way for further rework."

Looks sensible to me.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>


> 
> Signed-off-by: Leonardo Bras <leo.bras@arm.com>
> ---
>   arch/arm64/kvm/hyp/pgtable.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index b74dd5ce1efd..7a51f78b6446 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -183,32 +183,32 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data,
>   	 * Reload the page table after invoking the walker callback for leaf
>   	 * entries or after pre-order traversal, to allow the walker to descend
>   	 * into a newly installed or replaced table.
>   	 */
>   	if (reload) {
>   		ctx.old = READ_ONCE(*ptep);
>   		table = kvm_pte_table(ctx.old, level);
>   	}
>   
>   	if (!kvm_pgtable_walk_continue(data->walker, ret))
> -		goto out;
> +		return ret;
>   
>   	if (!table) {
>   		data->addr = ALIGN_DOWN(data->addr, kvm_granule_size(level));
>   		data->addr += kvm_granule_size(level);
>   		goto out;
>   	}
>   
>   	childp = (kvm_pteref_t)kvm_pte_follow(ctx.old, mm_ops);
>   	ret = __kvm_pgtable_walk(data, mm_ops, childp, level + 1);
>   	if (!kvm_pgtable_walk_continue(data->walker, ret))
> -		goto out;
> +		return ret;
>   
>   	if (ctx.flags & KVM_PGTABLE_WALK_TABLE_POST)
>   		ret = kvm_pgtable_visitor_cb(data, &ctx, KVM_PGTABLE_WALK_TABLE_POST);
>   
>   out:
>   	if (kvm_pgtable_walk_continue(data->walker, ret))
>   		return 0;
>   
>   	return ret;
>   }


  reply	other threads:[~2026-11-06 16:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 16:12 [PATCH RESEND v4 0/3] Optimize S2 hugepage splitting, introduce skip-level flags Leonardo Bras
2026-11-06 16:12 ` [PATCH RESEND v4 1/3] KVM: arm64: Avoid re-testing walk_continue Leonardo Bras
2026-11-06 16:59   ` Suzuki K Poulose [this message]
2026-11-09 12:37     ` Leonardo Bras
2026-11-06 16:12 ` [PATCH RESEND v4 2/3] KVM: arm64: Introduce KVM_PGTABLE_WALK_SKIP_LEVEL* walk flags Leonardo Bras
2026-11-06 17:02   ` Suzuki K Poulose
2026-11-09 13:55     ` Leonardo Bras
2026-11-06 18:13   ` Oliver Upton
2026-11-09 14:58     ` Leonardo Bras
2026-11-06 16:12 ` [PATCH RESEND v4 3/3] KVM: arm64: Make stage2_split_walker() skip unnecessary walks Leonardo Bras
2026-11-06 16:57 ` [PATCH RESEND v4 0/3] Optimize S2 hugepage splitting, introduce skip-level flags Marc Zyngier
2026-11-09 12:36   ` Leonardo Bras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1639d961-1092-4a47-8825-55c1647a115b@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=leo.bras@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=rananta@google.com \
    --cc=seiden@linux.ibm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®