Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793638371; b=IGt7OXi2aFis428LzgKnYy3ySRiZ2Une8fCNK+O/ce5JNf6ZSVcXp8or+hszN9UkEvXe EuInZkQrhb8kmXeNzl6UdzJz7RCbbzBO3Va7XyG4nIfRf9ziKeKOzzSbMEzCZ00hPxo8W 4e+6naYS7l+5IOsqZOtf2BfHNSQm4Su1xXYXouUnJnbzKfjDRQ4j6L98UUj8PwLxwrM3Q /nLSnEhLlncqYXuuKlkBqB48IvDLddjrVg5+J6i+TqopIsub2Jh2YMSHm5rgu0TGAmNsU Cfh94JkRQC/bSWy9uN8x1RW7qtdl1q0ObjPu+bR21BrbEpa1ALGMy9DNx0dO39frCWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793638371; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=BZ5RmFxRoz8rcy8X7QXJx9lbysA5ICz4SCKVtxX405I=; b=afFpwAV25UfoVdxqPduQ6Ss5bqOXlpTmZBIR2WdD2RmE+CF74/d8NUQkVfPAavup83QI gl6mpikny4+NWHz/2nBAGj0LKbKtn1Op5aNL5PS6Px8hejZzqJPh512gocgE6y73UYUWF K4MNuv0g3gwMiWyZkroFG7tIs1NAa8Uwvji69Z47Oxswf0rwpFAOHONOxdD6wkvmySSwQ JQzXweqLHGrxJJ9l6yLYTamUQzhSj5zADegbIA6TpaGg0+w5t4nqMrxL2FRkl6BrNE3x3 gKG6TKOUKNEiWExbuDGw34ptNKgthXo0Y9KRLNamjkyD6wgtxRzBM+sdZdI+6eUFwJQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NkrBxRCM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F0AB606E00B for ; Mon, 2 Nov 2026 16:52:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NkrBxRCM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F5B1F00A1D; Mon, 2 Nov 2026 16:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793638371; bh=BZ5RmFxRoz8rcy8X7QXJx9lbysA5ICz4SCKVtxX405I=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=NkrBxRCMP6tQJNMDILPONUCfTdDs4GJu675qFwgE0O2s30ln4ywM9gteok7RdWdAc Fw1ZCnHHgI3z8YY1kL2eE+84CYz/UncCSA3Cl1KwTsvepIYa8bKoPKyvl8CHf6BFyK Ahng0UjLEjtMMFcI23CLSgjy9aEQwmKkk49DfTlh5h0ZEJO3J6Evuo+1ievc1RehAx dZGexaiRA6HL+eIr0ZK7VRQ1YJo4KDESPOeEe/LU1MnUBIabMKh/6cNpdBtUZiTu5Q +YrVpzGOxC9sJ3T4ZaqkyvWqzReColK/vWhYtFQoascasJLSyWwvVRSo6woGqm6r4d IeUpa4Ox4cbsw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xNvH7-00000009z5S-1qpv; Mon, 02 Nov 2026 16:52:49 +0000 Date: Mon, 02 Nov 2026 16:52:48 +0000 Message-ID: <86bj872n1b.wl-maz@kernel.org> From: Marc Zyngier To: Ard Biesheuvel , Fuad Tabba Cc: Will Deacon , Ard Biesheuvel , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Oliver Upton , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu Subject: Re: [PATCH] KVM: arm64: Don't livelock when AT can't resolve a fault IPA In-Reply-To: References: <20261102094748.2638468-2-ardb+git@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ardb@kernel.org, fuad.tabba@linux.dev, will@kernel.org, ardb+git@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, oupton@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 02 Nov 2026 15:57:51 +0000, Fuad Tabba wrote: > > Hi Will, > > On Mon, 02 Nov 2026 14:17:10 +0000, Will Deacon wrote: > > On Mon, Nov 02, 2026 at 02:09:25PM +0000, Marc Zyngier wrote: > > > On Mon, 02 Nov 2026 13:59:12 +0000, > > > Will Deacon wrote: > [...] > > > > > diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h > [...] > > > > > static inline bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu, > > > > > u64 *exit_code) > > > > > { > > > > > - if (!__populate_fault_info(vcpu)) > > > > > + if (!__populate_fault_info(vcpu)) { > > > > > > > > Presumably we need a barrier (DSB?) here, to ensure that the TLBI happens > > > > after the AT instruction? > > I don't think the TLBI requires a barrier before it, because it > doesn't matter if the AT's walk allocates entries after the TLBI. > Anything it allocates matches memory, and the stage-2 descriptor the > AT faulted on has AF clear, so that descriptor can't be cached: > > R_XCLRD: Translation table entries that generate a Translation > fault, an Address size fault, or an Access flag fault are never cached > in a TLB. > > The stale entries the guest keeps hitting were already there before > the TLBI, and the dsb(nsh) and isb after it are what complete it > against them. > > [... your other reply ... ] > > > Alternatively, VMALLE1 or even VAE1 should be enough to get rid of the > > > S1 TLB. > > > > Ah, sorry, VMALLE1 is what I meant to ask about. I basically haven't > > understood the need to invalidate the stage-2. > > The guest's walk can also go through a stage-2 entry for its > page-table page, cached before the aging cleared that page's AF, and > nothing requires the AT to use that entry: > > R_NPZWX: When an address translation instruction is executed, it is > IMPLEMENTATION DEFINED whether the result can be returned from a TLB, > or a translation table walk occurs. > > So if my reading is correct, on a CPU whose AT walks memory instead, > the AT keeps failing while the guest's walk goes through the stale > entry, and the guest takes the same permission fault again. VMALLE1 > and VAE1 only cover stage 1, so they'd leave that loop in place. If we assume that the TLB covers VA->PA (which is a very likely case), TLBI VAE1 should nuke the permission fault that brought the vcpu to EL2, and instead walk the page tables, getting the access fault. The only case I can imagine where invalidating S2 would matter is if you are running under NV, because there is an independent S2 TLB (the shadow S2), and then VMALLS12E1 makes total sense. Ard, was this solely observed under NV? Or did you see it on a non NV guest as well? Thanks, M. -- Without deviation from the norm, progress is not possible.