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 32795CD8CB9 for ; Wed, 10 Jun 2026 10:57:17 +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=4dsbxE+UpFB1gxbxB8yCHBRmb9YT0B/b0rsLXt8UlE8=; b=arQip6uPfttbjEIaesbp0qLpUQ Mv+V/7bDY9PeEbjCZBJ1AESiyK2GPlzGpkZDPu93fYZ9bsCtBI47OsNfSAM0p/Py70byMW95KfWic WuUiaojXvjnqztPkBplBfUX4OXAIlGYfGCkItj75PX+2p0GSsZGxt6DN1ZQbNwbtQevCmWtLP0f0Z PUVqxTepZv/DSzrU+1zPmlpyt7sWAN3mD7wYEcbRmLas8+BfBuh+xUAqmY6tYYTiG/OIjT6wpflx3 OF1Ud1qQ2MJcCAJAAHoaEraGLX3rk8pHtYnOtOZBA/Zhzy9ihPwIND0l3f0B0Waib7EmZjT/BWMwR lRccoQrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wXGcP-00000007TFv-3KmV; Wed, 10 Jun 2026 10:57:09 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wXGcO-00000007TFX-3Gzo for linux-arm-kernel@lists.infradead.org; Wed, 10 Jun 2026 10:57:08 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id DABC860545; Wed, 10 Jun 2026 10:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ED6E1F00893; Wed, 10 Jun 2026 10:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781089027; bh=4dsbxE+UpFB1gxbxB8yCHBRmb9YT0B/b0rsLXt8UlE8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Hz56KSCKIKm/QlVi1yOtRaw7l4oEe9zAxUjfmOc6JyuyyWD5xyoPjHlQXM7Yk4dDQ giJAlyKINKAWCr1aSwhyx1s6HFoN4z37ksD3v0vL6duPnaioiVGw4u/CK1d11qjHpA osJ8EKeg2WahzWjQrkatbBrfdNIJP5YFL/oI01LPep6l9ELR0xQuDIbw2lWzBzwQaL fe1s+OoSC4TGPpZzlJAAQ+GgnBVgo5Qu2M1Dl1L3LdkwM9bzT0CCxf/foXMEFb6XLr K+8Gd9NE7C2KrZAi08XtNsjcYdCRGTIZcanKCMrQXtl13BCliIWvpTi1Xc4zUGsp92 M8kjVkTei2BpA== 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 1wXGcL-0000000BJXq-12qI; Wed, 10 Jun 2026 10:57:05 +0000 Date: Wed, 10 Jun 2026 11:57:04 +0100 Message-ID: <868q8mu0hr.wl-maz@kernel.org> From: Marc Zyngier To: Yosry Ahmed Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Steffen Eiden , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: Re: [PATCH] KVM: arm64: Hold kvm->mmu_lock while initialising vcpu->arch.vncr_tlb In-Reply-To: References: <20260608081108.2244133-1-maz@kernel.org> <86ldcotbub.wl-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: yosry@kernel.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, seiden@linux.ibm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, 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 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, 09 Jun 2026 18:57:26 +0100, Yosry Ahmed wrote: > > > > If yes, I think the code looks confusing, at least to a layman like > > > myself. It initially seems like the lock protects against concurrent > > > initializations, but then the NULL check is not done again under the > > > lock. The goal of the lock is not clear without the original report. > > > > > > Mayeb it's clearer to explicitly use barriers if the goal is preventing > > > reordering? > > > > This would require both the initialisation of vncr_tlb to use a store > > release, *and* all the other call sites to use a load acquire. > > > > I really don't think it is worth the churn, nor the (very small) > > burden on the readers. > > That's fair. I was mainly just pointing out my initial confusion and > that others may share it. Avoiding the churn on the readers' side is > understandable. Maybe a comment here would help explain why the lock > needs to be held? I have added this: /* * Taking the lock on assignment ensures that the TLB is * seen as initialised when following the pointer (release * semantics of the unlock), and avoids having acquires on * each user which already take the lock. */ Thanks, M. -- Without deviation from the norm, progress is not possible.