All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: Oliver Upton <oupton@kernel.org>, Fuad Tabba <tabba@google.com>,
	Joey Gouly <joey.gouly@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: arm64: nv: Allocate the shadow S2 MMUs individually
Date: Mon, 10 Aug 2026 08:58:12 +0100	[thread overview]
Message-ID: <86v79i9zl7.wl-maz@kernel.org> (raw)
In-Reply-To: <anizGXThM-haqQXU@gmail.com>

On Sun, 09 Aug 2026 19:11:54 +0100,
Karl Mehltretter <kmehltretter@gmail.com> wrote:
> 
> On Sun, Aug 09, 2026 at 12:39:10PM +0100, Marc Zyngier wrote:
> > My current patch is as follows, and so far, I haven't seen much that I
> > like better.
> > 
> 
> Hi Marc,
> 
> Thanks for your revised patch.
> I think one correctness issue is in there. 
> 
> > +		for (i = 0; !ret && i < S2_MMU_PER_VCPU; i++)
> > +			ret = init_nested_s2_mmu(kvm, &tmp[i]);
> 
> > +		if (ret) {
> > +			while (--i >= 0)
> > +				kvm_free_stage2_pgd(&tmp[i]);
> 
> The increment expression of the for loop still runs after an error.

Yup. Should be fixed with

diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index 5b69a0f382320..50d6dcc75582c 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -96,8 +96,11 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu)
 		if (!tmp)
 			ret = -ENOMEM;
 
-		for (i = 0; !ret && i < S2_MMU_PER_VCPU; i++)
+		for (i = 0; !ret && i < S2_MMU_PER_VCPU; i++) {
 			ret = init_nested_s2_mmu(kvm, &tmp[i]);
+			if (ret)
+				break;
+		}
 
 		if (ret) {
 			while (--i >= 0)

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2026-08-10  7:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 22:44 [PATCH 1/2] KVM: arm64: nv: Allocate the shadow S2 MMUs individually Karl Mehltretter
2026-08-03 22:44 ` [PATCH 2/2] KVM: arm64: selftests: Add a nested S2 MMU realloc test Karl Mehltretter
2026-08-04 14:44   ` Marc Zyngier
2026-08-04 10:24 ` [PATCH 1/2] KVM: arm64: nv: Allocate the shadow S2 MMUs individually Wei-Lin Chang
2026-08-04 14:31 ` Marc Zyngier
2026-08-04 14:56   ` Marc Zyngier
2026-08-04 21:54     ` Karl Mehltretter
2026-08-05  7:32       ` Marc Zyngier
2026-08-05 21:39         ` Karl Mehltretter
2026-08-07 17:08   ` Karl Mehltretter
2026-08-09 11:39     ` Marc Zyngier
2026-08-09 18:11       ` Karl Mehltretter
2026-08-10  7:58         ` Marc Zyngier [this message]
2026-08-10 22:32           ` Karl Mehltretter

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=86v79i9zl7.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kmehltretter@gmail.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.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 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.