From: sashiko-bot@kernel.org
To: "Leonardo Bras" <leo.bras@arm.com>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v3 2/3] KVM: arm64: Introduce KVM_PGTABLE_WALK_SKIP_LEVEL* walk flags
Date: Wed, 08 Jul 2026 13:50:11 +0000 [thread overview]
Message-ID: <20260708135012.3B21A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708134101.2514759-3-leo.bras@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] KVM_PGTABLE_WALK_SKIP_LEVEL* flags fail to skip the starting root level of the page table walk.
--
--- Patch [2]: [PATCH v3 2/3] KVM: arm64: Introduce KVM_PGTABLE_WALK_SKIP_LEVEL* walk flags ---
commit 5ddf63ba492be8c2a84af0b81cf00790fc72767a
Author: Leonardo Bras <leo.bras@arm.com>
KVM: arm64: Introduce KVM_PGTABLE_WALK_SKIP_LEVEL* walk flags
This commit adds new walking flags that tell kvm_pgtable_walk() to skip
lower levels when traversing page tables.
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index 4be1d51a6ac58..b9a2078efc519 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
[ ... ]
> @@ -192,7 +205,7 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data,
> if (!kvm_pgtable_walk_continue(data->walker, ret))
> return ret;
>
> - if (!table) {
> + if (!table || kvm_pgtable_skip_level(level + 1, ctx.flags)) {
[Severity: Medium]
Does this fail to skip the starting level of the page table walk if that
initial level matches the skip criteria?
Looking at __kvm_pgtable_visit() in arch/arm64/kvm/hyp/pgtable.c, the visitor
callbacks are executed unconditionally for the current level before we reach
this skip check:
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;
}
Since the skip condition here only evaluates level + 1 to prevent descending
further, if a caller begins a walk at a level that should be skipped (for
example, starting at level 2 with KVM_PGTABLE_WALK_SKIP_LEVEL2), the callbacks
for that root level will still execute.
Should the current level also be checked against the skip flags before
executing the pre-table or leaf visitor callbacks?
> data->addr = ALIGN_DOWN(data->addr, kvm_granule_size(level));
> data->addr += kvm_granule_size(level);
> goto out;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708134101.2514759-1-leo.bras@arm.com?part=2
next prev parent reply other threads:[~2026-07-08 13:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 13:40 [PATCH v3 0/3] Optimize S2 page splitting Leonardo Bras
2026-07-08 13:40 ` [PATCH v3 1/3] KVM: arm64: Avoid re-testing walk_continue Leonardo Bras
2026-07-08 16:41 ` Marc Zyngier
2026-07-08 17:00 ` Leonardo Bras
2026-07-08 13:40 ` [PATCH v3 2/3] KVM: arm64: Introduce KVM_PGTABLE_WALK_SKIP_LEVEL* walk flags Leonardo Bras
2026-07-08 13:50 ` sashiko-bot [this message]
2026-07-08 15:49 ` Leonardo Bras
2026-07-08 16:16 ` Leonardo Bras
2026-07-08 17:17 ` Marc Zyngier
2026-07-09 14:25 ` Leonardo Bras
2026-07-11 5:53 ` Wei-Lin Chang
2026-07-13 10:14 ` Leonardo Bras
2026-07-14 5:41 ` Wei-Lin Chang
2026-07-14 10:13 ` Leonardo Bras
2026-07-08 13:40 ` [PATCH v3 3/3] KVM: arm64: Make stage2_split_walker() skip unnecessary walks Leonardo Bras
2026-07-08 15:25 ` [PATCH v3 0/3] Optimize S2 page splitting Leonardo Bras
2026-07-12 14:50 ` Dev Jain
2026-07-13 10:08 ` 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=20260708135012.3B21A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=leo.bras@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.