All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mostafa Saleh" <smostafa@google.com>
Cc: "Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>
Subject: Re: [RFC PATCH 2/2] KVM: arm64: Support BBM level 3
Date: Fri, 17 Jul 2026 13:28:57 +0000	[thread overview]
Message-ID: <20260717132857.AC30A1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260717130901.2239134-3-smostafa@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Replacing a block mapping with an empty table mapping using BBML3 violates architectural requirements and causes TLB conflict aborts.
--

--- Patch [2]: [RFC PATCH 2/2] KVM: arm64: Support BBM level 3 ---
commit ea79cffc563af3beac80c1a139cbab5674ecb7f0
Author: Mostafa Saleh <smostafa@google.com>

KVM: arm64: Support BBM level 3

This patch introduces support for hardware Break-Before-Make (BBM) level 3
to replace stage-2 PTEs directly instead of using the software sequence.
It atomically updates the PTE and relies on hardware features to handle
the transition.

> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c

[ ... ]

> @@ -1069,7 +1102,10 @@ static int stage2_map_walk_leaf(const struct kvm_pgtable_visit_ctx *ctx,
>  	 * will be mapped lazily.
>  	 */
>  	new = kvm_init_table_pte(childp, mm_ops);
> -	stage2_make_pte(ctx, new);
> +	if (!stage2_make_pte(ctx, data->mmu, new)) {
> +		mm_ops->put_page(childp);
> +		return -EAGAIN;
> +	}
>  
>  	return 0;
>  }

[Severity: Critical]
Does using BBML3 to replace a block mapping with an empty table mapping risk
a TLB conflict abort?

In stage2_map_walk_leaf(), the code allocates a zeroed page for the new
table and installs it. With BBML3, stage2_make_pte() atomically overwrites
the valid block PTE with the new empty table PTE, bypassing the software
break step.

Because the new table is unpopulated, if another CPU takes a stage-2 fault
on this range before the TLBI completes, it can populate a 4KB page in the
new table. That CPU will then cache the new 4KB mapping while still holding
the old 2MB block mapping in its TLB. The overlapping entries will trigger
a fatal TLB Conflict Abort, panicking the host.

Would it be necessary to either fall back to the software break-before-make
sequence when splitting a block, or ensure the new table is populated with
equivalent translations before the atomic swap?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260717130901.2239134-1-smostafa@google.com?part=2

  reply	other threads:[~2026-07-17 13:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 13:08 [RFC PATCH 0/2] KVM: arm64: Support BBM level 3 Mostafa Saleh
2026-07-17 13:08 ` [RFC PATCH 1/2] KVM: arm64: Add stage2_clean_old_pte() Mostafa Saleh
2026-07-17 13:09 ` [RFC PATCH 2/2] KVM: arm64: Support BBM level 3 Mostafa Saleh
2026-07-17 13:28   ` sashiko-bot [this message]
2026-07-17 14:15     ` Mostafa Saleh
2026-07-17 20:56   ` Oliver Upton

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=20260717132857.AC30A1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=smostafa@google.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 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.