From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@cryspen.com>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH] KVM: arm64: nv: Invalidate whole L1 blocks on TLBI RIPAS2E1
Date: Tue, 10 Nov 2026 06:30:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-206417@kernel.org> (raw)
In-Reply-To: <6817d113e5f0a9cafe0ce5bc0847276b7f14aacc.1794210561.git.dan@cryspen.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: arm64: nv: multiple evaluation of compute_tlb_inval_range()
in ALIGN*()
--
commit a02572444c705de05e0b8656d139113ddf1c61f9
Author: Dan Carpenter <dan@cryspen.com>
KVM: arm64: nv: Invalidate whole L1 blocks on TLBI RIPAS2E1
This commit widens the range unmapped by s2_mmu_unmap_range() to cover
the containing L1 stage-2 blocks using compute_tlb_inval_range().
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 5ee1b521d2b3f..ef4554656ddfb 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -4116,6 +4116,17 @@ union tlbi_info {
> static void s2_mmu_unmap_range(struct kvm_s2_mmu *mmu,
> const union tlbi_info *info)
> {
> + u64 start = info->range.start;
> + u64 end = start + info->range.size;
> +
> + /*
> + * An L1 stage-2 block may be held in the shadow S2 as several smaller
> + * leaves, and R_TVTYQ requires the TLBI to invalidate all of them, so
> + * widen each end of the range to the L1 block containing it.
> + */
> + start = ALIGN_DOWN(start, compute_tlb_inval_range(mmu, start >> 12));
> + end = ALIGN(end, compute_tlb_inval_range(mmu, (end - 1) >> 12));
[Severity: Low]
Does passing compute_tlb_inval_range() directly to ALIGN_DOWN() and
ALIGN() evaluate it five times instead of twice? ALIGN_DOWN(x, a)
expands a three times and ALIGN(x, a) expands a twice via
__ALIGN_KERNEL() and __ALIGN_KERNEL_MASK(), so each call to
s2_mmu_unmap_range() performs three redundant sets of shadow stage-2
page-table lookups under kvm->mmu_lock.
--
Sashiko AI review · https://sashiko.dev/#/patchset/6817d113e5f0a9cafe0ce5bc0847276b7f14aacc.1794210561.git.dan@cryspen.com?part=1
next prev parent reply other threads:[~2026-11-10 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 6:14 [PATCH] KVM: arm64: nv: Invalidate whole L1 blocks on TLBI RIPAS2E1 Dan Carpenter
2026-11-10 6:30 ` sashiko-bot [this message]
2026-11-11 10:08 ` Marc Zyngier
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=sashiko-outbox-206417@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dan@cryspen.com \
--cc=kvmarm@lists.linux.dev \
--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.