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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FCDEC52D6F for ; Mon, 19 Aug 2024 15:44:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E16D46B007B; Mon, 19 Aug 2024 11:44:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC66A6B0082; Mon, 19 Aug 2024 11:44:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8D966B0083; Mon, 19 Aug 2024 11:44:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AC1A56B007B for ; Mon, 19 Aug 2024 11:44:55 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 391F0812D9 for ; Mon, 19 Aug 2024 15:44:55 +0000 (UTC) X-FDA: 82469418150.20.2939D22 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 5DF58C0022 for ; Mon, 19 Aug 2024 15:44:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jrEBxu+g; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724082206; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aX/OYVAkaEdVbwwIoOF3s1uLG4beiySIM1VEDPCdiCc=; b=hXHM6HMjnUmeABaqSrHkK81hjLiB60qxVFcAzQQYf7a2OLFa1hBcQ6/WF6USW/Df64hYsr y3lABTZzAfubClTOJS9Og3Iq6tTUpx5diXU3TPPilQ7Wi60gGJZtMCy1kUZ889Gd+0Oqt5 buwlyDQW2TqqzWFshGqmwXbOyrZe7VY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724082206; a=rsa-sha256; cv=none; b=UGfzTXh4/8N4i+igrbakJFeEZVFpxQaSbnleuAmzK3dBsIx4BcHAfSqf8L3nHLgDUYvkSB nCmucy6h4EblbFVSLJHswSXFmgANL+f+FLlci1w5CnTMdwO+E2kF2FHNqd/uWiyDdUPamE zotB1B03tT7HfIm7he7Wf6LXmOd6Yh8= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jrEBxu+g; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4FD0860C6E; Mon, 19 Aug 2024 15:44:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B65FAC32782; Mon, 19 Aug 2024 15:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724082292; bh=9K0lJYsHQSHszMJjX6x7fDt2250JGt/1bnUzF/FZPSc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jrEBxu+g3W/W+F6pOwBR+ng5/r6bUlowypNEQ5XHXHVtCPf0wKbvU4xTgMe9Qetd9 CpxBjhrcQP82vY34DM/oKUpHXTPk2KEebrCDA3E0dMchzEiyt0dca2ruZpP+KvX71Q NwDog8RMhIViPcZETR41MbRx0xKj/jUc44DG9evJ+m9HP5CRKyjS+M7TufOKn5ciyF 3LWI3TU1CsuCqWTWGOZMfOVKsxB+FXtrKuo0wgw6hyF8PRTBVcGrH8B1mD03k5dX2L VBG1R7OT29miF6OIF7EC+xeskwwWxFN4tCku3j084T6J6hzY96a0cH2CTJ6UGJaAvl yKUaOabpdi6/A== Date: Mon, 19 Aug 2024 16:44:42 +0100 From: Mark Brown To: Catalin Marinas Cc: Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , Kees Cook , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , Ross Burton , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v10 19/40] arm64/gcs: Context switch GCS state for EL0 Message-ID: <0f6fd3ec-2481-4507-af0e-3cbbb7406b54@sirena.org.uk> References: <20240801-arm64-gcs-v10-0-699e2bd2190b@kernel.org> <20240801-arm64-gcs-v10-19-699e2bd2190b@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RY211L+JHDJI/V3D" Content-Disposition: inline In-Reply-To: X-Cookie: Interchangeable parts won't. X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5DF58C0022 X-Stat-Signature: u78n7a4u55xe7ks18kppuscpxbadazd9 X-Rspam-User: X-HE-Tag: 1724082293-964858 X-HE-Meta: U2FsdGVkX18uJa3Jfb/0P1b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kSVbo7OSDnbUXSQcuyLJix5T7rhgxf5jKpt4UYNeGH8cLN8jYrlaIhPAQ6rcyhzokocZi1VnyMrHRHvuL3Y8szbgpH/yKd2c0bVRu7zUBfT8p9Avigzt60xBvoD8/dgbKD8YyQfhQoRphiAjkMeCLV3liIA5yUk6sCQZ/OoCQB1EWpqa171v7izx+aZKPgPZ8Ht1SBKjuzxSoubFJJ25r7et/zsUHQwiYfTa/urgmzKl+DN6n8JhaU7A X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --RY211L+JHDJI/V3D Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 19, 2024 at 12:46:13PM +0100, Catalin Marinas wrote: > On Thu, Aug 01, 2024 at 01:06:46PM +0100, Mark Brown wrote: > > + /* > > + * Ensure that GCS changes are observable by/from other PEs in > > + * case of migration. > > + */ > > + if (task_gcs_el0_enabled(current) || task_gcs_el0_enabled(next)) > > + gcsb_dsync(); > Could we do the sysreg writing under this 'if' block? If no app is using > GCS (which would be the case for a while), it looks like unnecessary > sysreg accesses. Yes, that should be fine I think. > What's the GCSB DSYNC supposed to do here? The Arm ARM talks about > ordering between GCS memory effects and other memory effects. I haven't > looked at the memory model in detail yet (D11.9.1) but AFAICT it has > nothing to do with the system registers. We'll need this barrier when > ordering is needed between explicit or implicit (e.g. BL) GCS accesses > and the explicit classic memory accesses. Paging comes to mind, so maybe > flush_dcache_page() would need this barrier. ptrace() is another case if > the memory accessed is a GCS page. I can see you added it in other > places, I'll have a look as I go through the rest. But I don't think one > is needed here. It's not particuarly for the system registers, is there's so that anything else that looks at the task's GCS sees the current state. I'm pretty confident this excessive, the goal was to err on the side of correctness and then relax later. --RY211L+JHDJI/V3D Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmbDaGkACgkQJNaLcl1U h9BvXwf/RQT11d03bUvuvD6MuYImODPR+T57Yc5/4X0OndD0EPF5k5PWbkvH//Tw ZLgMt2oTPhRGxuAsNqSI3SJndV6cvgGv2BgT8L/c48ftU6TrvwdLiFuEXY6wzpTu NcL4WCQ/1U9z74jPkVSAAyyLyhHkjXyzlnlweiOH2IiBaUtoJrq7TcRjAjChMRLG noxrNAXiLahjU8QUP1bvQeMrCGWdz4TT/sCHjf8Gwo9kySFe8KOcFH56x4FHt+J4 xktf7O8cR+W41/Y+T2xSadecOHrdXU8fW2X/6o5252Ims33XJpYsyrzDV42nzv1T gKlZCm6EGCD0AKemQ2JTc3fuppNpzw== =ff4l -----END PGP SIGNATURE----- --RY211L+JHDJI/V3D--