From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 262ABFD8763 for ; Tue, 17 Mar 2026 13:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ezgFIwAaI15kyXevFuXOWgYHdSeujTu7mnqnl9urGvs=; b=JCkTiFZEEdRPOGSY+QxomKU/hh MBMbUABpruNzD1HHRQuk5PSlbpE+KIJA9inXqL/JBKjy0EJlKokHCwiszk7ECBbF+LmGr+rZD63QW Bh7GUQA9qnom04O2HE6GMd6w/QCBQh7AG7KONdO849Pxp196SHSIw9OvpZyPUnczf8DtlE6mi+UsW pN0/r9VxFg0SelhIlmJbXdHWom1+4+ZCezUPuDXuLnCIb8KOwEuXt/tURkz6+FhyKrgei/+EU/FH0 Drk8Vgug7mKTN3KjHIPUmc2OyhX4XKuGJzXaquvdYvu4MjARegQm1cjp1SRXobwGODGAqJcUDHu6m vvoNqgFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w2UWI-00000006QrD-3LiQ; Tue, 17 Mar 2026 13:31:38 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w2UWH-00000006Qr7-1vwv for linux-arm-kernel@lists.infradead.org; Tue, 17 Mar 2026 13:31:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 9256360008; Tue, 17 Mar 2026 13:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 452FBC2BC86; Tue, 17 Mar 2026 13:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773754296; bh=DSTFlNqodCcOj9M1rB8mRwfLqMQnLFCVkyLnYpbsHPY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Krl/nvhw1qEbpC3x8UIqixcxdStCjxc64yt0yK+9/fdhHGNulj+hvdzwSB+/YKFiq CfQaYXMbhXWRMTldnI/e5rvFhpBrNJ0SNKcJXpD3S6UCd9jfg1oOVXDLQttmfrXmbI HZxbgOCbXcjteXvOA+Rd2ibNa2i8yqsX7lIUCqRg3Osb0/yUxbxb3RvLk39vX7ZQbQ 5oJTqjE8YfTqR1Pg4X3dbn+kj6i10APUbBIM3k/8LqnBBgx8UkkwpC/c+9ca/AzGIZ Ge7ynaCGBb4tPxu+HxO1zdn5ZcmPSnml0wySO4SWUzpuCEITMjD1bWEJFygERKiIJh cCsH75bLQ8tnQ== 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 1w2UWE-00000002rFQ-0ULt; Tue, 17 Mar 2026 13:31:34 +0000 Date: Tue, 17 Mar 2026 13:31:33 +0000 Message-ID: <86ms0660qy.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Will Deacon , Quentin Perret Subject: Re: [PATCH 08/17] KVM: arm64: Kill topup_memcache from kvm_s2_fault In-Reply-To: References: <20260316175451.1866175-1-maz@kernel.org> <20260316175451.1866175-9-maz@kernel.org> 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) 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: tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com, will@kernel.org, qperret@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 17 Mar 2026 12:12:57 +0000, Fuad Tabba wrote: > > Hi Marc, > > On Mon, 16 Mar 2026 at 17:55, Marc Zyngier wrote: > > > > The topup_memcache field can be easily replaced by the equivalent > > conditions, and the resulting code is not much worse. > > > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/kvm/mmu.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > index 11820e39ad8e1..abe239752c696 100644 > > --- a/arch/arm64/kvm/mmu.c > > +++ b/arch/arm64/kvm/mmu.c > > @@ -1712,7 +1712,6 @@ static short kvm_s2_resolve_vma_size(const struct kvm_s2_fault_desc *s2fd, > > > > struct kvm_s2_fault { > > bool writable; > > - bool topup_memcache; > > bool mte_allowed; > > bool is_vma_cacheable; > > bool s2_force_noncacheable; > > @@ -1983,7 +1982,6 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd) > > .logging_active = logging_active, > > .force_pte = logging_active, > > .prot = KVM_PGTABLE_PROT_R, > > - .topup_memcache = !perm_fault || (logging_active && kvm_is_write_fault(s2fd->vcpu)), > > }; > > void *memcache; > > int ret; > > @@ -1994,9 +1992,11 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd) > > * only exception to this is when dirty logging is enabled at runtime > > * and a write fault needs to collapse a block entry into a table. > > */ > > - ret = prepare_mmu_memcache(s2fd->vcpu, fault.topup_memcache, &memcache); > > - if (ret) > > - return ret; > > + if (!perm_fault || (logging_active && kvm_is_write_fault(s2fd->vcpu))) { > > + ret = prepare_mmu_memcache(s2fd->vcpu, true, &memcache); > > + if (ret) > > + return ret; > > + } > > Further up in user_mem_abort(), when memcache is declared it should be > initialized to NULL, since prepare_mmu_memcache() isn't called if this > evaluates to false. I had that at some point, but then realised that there was no case where memcache could be used and yet not be initialised via prepare_mmu_memcache(). But given that this is still a bit fragile, I'll add it back. > > With that fixed: > Reviewed-by: Fuad Tabba Thanks! M. -- Without deviation from the norm, progress is not possible.