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 5B214C4167B for ; Thu, 7 Dec 2023 15:25:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D74436B0085; Thu, 7 Dec 2023 10:25:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D23626B009A; Thu, 7 Dec 2023 10:25:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEB416B009B; Thu, 7 Dec 2023 10:25:29 -0500 (EST) 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 A99C16B0085 for ; Thu, 7 Dec 2023 10:25:29 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8142D1C01B2 for ; Thu, 7 Dec 2023 15:25:29 +0000 (UTC) X-FDA: 81540396378.27.A5BFCAF Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf01.hostedemail.com (Postfix) with ESMTP id 6C11040025 for ; Thu, 7 Dec 2023 15:25:26 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf01.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701962727; 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; bh=ev4oB7q4Zvlo4qzjtWssBInB/o1pH4QXlgQXa1sil58=; b=S8OANeWsbAw1Pup6G8Bp/8WotOqp7MTyF1NkhQEBE2pdVKy2PwXgQTOdZcCZ4FL+1dkACy 6kYIJzXAhO0Fa669KYBSyyCSm7nNunylum0Kxbd/UT00ovaExkNFfheWrDl4fxfdm9J6Dl rL6sF/fBHbBoxI0UYIE3ebbQZX+UmUg= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf01.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701962727; a=rsa-sha256; cv=none; b=2UrZxJKkY8ShdLB4D1RwEcsmn0AcNLFZedknCCAE6gZTVdj14cmQzocGn/cgYLU8L0HqZy sbfTB7MvneL2rafgrMD5T1OeaB+H8LVvl+eMEH9BcgK2TRWTd1eGMRzbN91Dt6RgGmuXDj XRbsYAPRwVZEmf5UN7nJxWQ++eOxhSA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B4EFECE213F; Thu, 7 Dec 2023 15:25:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E72E4C433C7; Thu, 7 Dec 2023 15:25:19 +0000 (UTC) Date: Thu, 7 Dec 2023 15:25:17 +0000 From: Catalin Marinas To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, dave.hansen@linux.intel.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: Re: [PATCH v3 11/25] arm64: enable ARCH_HAS_PKEYS on arm64 Message-ID: References: <20231124163510.1835740-1-joey.gouly@arm.com> <20231124163510.1835740-12-joey.gouly@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231124163510.1835740-12-joey.gouly@arm.com> X-Rspamd-Queue-Id: 6C11040025 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: sn8xrjsbtgz1ke5sags156dc37ah1wfk X-HE-Tag: 1701962726-452902 X-HE-Meta: U2FsdGVkX18JCk9QnIm+85dRh/ydnfmnhKdm5YeLrvfTM8QJd0cZOrb90NSwFihvvMOlOPYUsEaWNB8VF27lBuehCU8Nkm16ALWTMTtA66pZ3OA0+RoCXBrToq3UauF1l4ovu5ElQriy0LZ15Gs8SNQ0+yZz/ZWbRZCuicJ7q8HLqxMBxUgNaBe4aKKj36DmGH4QtWOuezXhfiXWuU2XtBOaK+QikpdrSuuCr/p1jsCTzpS2qb1mYypIc3+fXGEOgf/dacKotXK1/M9NYxztJ4y6CIr8ymA2RrwF75hTPfJevcUsUVCSagOQ5x2sME8FzyrCQ4q4NndSLNkkoIOpK/B+GjTi1mcmEZ6Yk532RfAZ7IFWCcBSYuOd1oMjJyX2pEyw1X9RC3yoDomJjM9tlgeL+rrjfgRf7XBuamy6zZwAeSxFnm2iu8wyAsEhwoj2Ha2iN1uBb0aKuNz/Aof6urulq30Y2uqb00A0rIBXMIb5loqxShz4URX/csZxsVWs2zNGpE9WW7u247U23R2YFFlsDBsHzeJqm+bdlD4njWbR2y+2ONReoU3vBsmu3ssBfocdEQz/SW980cLUgG95nCPzXMyURSfYNEWnG1oxUy4n7X5CvPuWKmbegNbx5SxNDlEiNvQ8zqSQigDughIpjFkKaR8+DWful77TbeFyVCXikF7EKNgp9aNvp1uNM5YfHI2IeaZOQf1vEVXwvkb4a/y36882PHdJXDupYm3+mO4on9bWoXgL4xHPMkjHPi+s4B7LKQSRa9ynNrWOUES/Gcur3DOHajYc2GjMcPCiBmb/igwQbVndjjIOQzB0ATnNXevHA3CL4N7m5e5S+oQsKSLQ6eO4SpC6wy7Fy9qWK44dpd5BreyVfstBg7wsJfkOQE7Yf4ae/wFCbuOa30/scALpgOiWLgU6HyQbgWdbdh8ooo7iPrLrWCptvMaNIU5tim+WLBx3eoXIDvTHXvp Z5ZUBKa5 y5Tns/wNGNJykxgd9y6zfQSVKWaJwPT4Ykq+fEqCS10bYdzHjfA9u6OQosi0JyoqDhoxK8lAfRH1sVeMAkbA9Vk30zOABoz8d1cNCfctbwm1eU2Bz6l0V7yJ+xYQDSSjKWp8uKue9fLF8bOqqQZFsNN8wQvQfMsBoNomqmC4OlrV+b3yjhA4uEdFbTrY7bu4awI/2DQIq2jbxyn+uw9AnrheHktfrql8mNF9oXzi8oLcO6tZH/MhGRaM45tXYTNv0rsSdvvlbyfCNNl3lBqPIxTYU2e+xdHEJDpqvDl3s2pFrVPrO1lYUtVSlkrxgoHuZxvwZiA3OBgLw3e5fLKacnAiuaQByr3HUoDPpZ2kF2tDMbL8= 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: On Fri, Nov 24, 2023 at 04:34:56PM +0000, Joey Gouly wrote: > diff --git a/arch/arm64/include/asm/pkeys.h b/arch/arm64/include/asm/pkeys.h > new file mode 100644 > index 000000000000..5761fb48fd53 > --- /dev/null > +++ b/arch/arm64/include/asm/pkeys.h > @@ -0,0 +1,54 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) 2023 Arm Ltd. > + * > + * Based on arch/x86/include/asm/pkeys.h > +*/ > + > +#ifndef _ASM_ARM64_PKEYS_H > +#define _ASM_ARM64_PKEYS_H > + > +#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2) > + > +#define arch_max_pkey() 0 > + > +int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, > + unsigned long init_val); > + > +static inline bool arch_pkeys_enabled(void) > +{ > + return false; > +} > + > +static inline int vma_pkey(struct vm_area_struct *vma) > +{ > + return -1; > +} What's the point of these dummies? I guess they'll be populated later but I haven't reached that point. Could we not just leave them out for now and add the complete version directly? This would work better with an earlier comment to move the Kconfig entry towards the end of the series. Also, they don't seem to match the generic include/linux/pkeys.h dummies. For example, vma_pkey() returns 0 in the generic version, -1 here. Should they actually match? -- Catalin