From patchwork Mon Dec 4 10:54:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13478192 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 882F9C4167B for ; Mon, 4 Dec 2023 10:55:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24D6C6B02A9; Mon, 4 Dec 2023 05:55:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 224DE6B02AC; Mon, 4 Dec 2023 05:55:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EC796B02AD; Mon, 4 Dec 2023 05:55:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F15256B02A9 for ; Mon, 4 Dec 2023 05:55:27 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CCD89A083F for ; Mon, 4 Dec 2023 10:55:27 +0000 (UTC) X-FDA: 81528829494.13.94FBA3C Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP id 3CD201C000C for ; Mon, 4 Dec 2023 10:55:26 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701687326; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eY6NiicJ90X6+1Q0eg6fxYOX0IQ4OXMtCPZ2hrvQ55c=; b=Z12SK2ABrWfQkUPLKGeb7DQH8FzENlr85uetRZnXEuNN+xoNSvPg8RdC0qqlsQrray5HxI PvoUhNsj+CzSTB0rQtDfF8H99zXkx5rXD1tBoiSptzzLPKCegCaXLgV2Nwx25ehjYqXVDW CSi/F28rdkRLW8/oahj4tickMMu88So= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701687326; a=rsa-sha256; cv=none; b=zdPJb2/cBzkNxPRf3HHsd1PMXlIxkRS6kasdFaGHBOpBfjeAoiKKiI+iTQgOS09CMdG7x2 ny3OMz7LkFgrqZWf5/A46YvWxQkmte1Vr+qfOKKhDu/RJT5LEMozdRywNSs9g1AIg+ghBY vusxepk+qkpDrzg66eI+u/nh4C1wZYg= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E54BA169C; Mon, 4 Dec 2023 02:56:12 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3D9193F6C4; Mon, 4 Dec 2023 02:55:22 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , Anshuman Khandual , Matthew Wilcox , Yu Zhao , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/15] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit Date: Mon, 4 Dec 2023 10:54:33 +0000 Message-Id: <20231204105440.61448-9-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204105440.61448-1-ryan.roberts@arm.com> References: <20231204105440.61448-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: pqkpcrssipdnqfuq7p6isbxfjtpwuj1m X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3CD201C000C X-HE-Tag: 1701687326-628806 X-HE-Meta: U2FsdGVkX19v5b7y0lxu5zk98LHaWE7dm285/wR+hgYy2mnuQZ1/raDbqXEjepCo9gZe/BLS03mKZBH623bvMDFOp0IqycnRP0AL1IurmBlbjWShyr/hoMf63bBBIRGRGW3zbMt1gLclOB6SuWsfe+qi4vFZWkDhUu5jaGKedoOas6e0hCxmZO0Hg91Jue0NwHv4axfLwlq5x7PVTurXiv8Y16su2y2x3TEOunNspd1Vdn2HhPfF2yUE+ZZQKqpIa/nYisUgdAWYBAVus4CPq52tIesKcy27g4MdgmmqghoLEzWr1WvPcm5VvUSOJ03bNAMZhDevOXifUO3nX7QQBMWwsJTcNXe0gw+Ti7737CG/SXIttdCDS/JR+bgeko1c2jtT4OLVI3Kvw63liCQjiQh5EWYqq6OAjjsvPDh4FK7cCxzd5/QwQJf/88wX3nEgpCSCB+6LmIYWYAFtEBz7fFrFb6Jdav7EfEz0Q35zytPMO3RO07z74lv3LT1U0Yu6u9UVzUlRxNDQNkJwPQk6T8rtNOULv2RFHkFcHzzu5vza3U2n8riAoKG1CLnKDs/rGBuP0xEg7Tx+z9riWdHkrKEa/Ima8FgsHpioSoN+n6Een88FiYgagMyClHwGOiTGI0eyGG7GHBjjiU/b8gckF4+iJmMgRb1JsHw7D/VT01Z46Xz+IKybr9xZ4g84bYe349IW5KgvW4ny7LU8MIpRAnJo5a7Vleny0AyQa4h6cjWfgfs+4GA30jlFxySr1nSeuN5XU5r1DSLFR296X5xJJpTRRhTeG0/HATS7Dz8EShrnkW4zqeQqVQrXfgRK3XGfm/XnM6HOwXF71sJksy3neB5Ov/CAXQnh1pY0sy3dFmfuP/yg7JkB2RsURXrdJFac+tzVbkv4xuXzsd9FFPyTjt0XxhHksCdjmbHaQELoWh/JvIA9xHYUD77J7h5vTtwLgSgB5ufLIUcZVkhadht pvTzKANE 0S2MJjIUGAkPBup6XXgjGXMhgmmD0tMRH4UzoILGzNrrNUNOzp+0PeAWxIPVwGY5/2XAq+E3k/rxLtPIUbwCdPFJl+L2yHTAUjeKp1pn18afeOoR4Q/Z4g7ESMkVjH/wlQ22lkZlzL3uxXRtFcF3rmWHKfSOPcNtL+RPxrYvkPakgOGvVdMGVwrzJuLPW0vReF/GxFpHsGAIYv/H9IrOt0jeeymEwyNHW/6bUHsFvfbnNQNH38y+89RrgfHlG0ylbH/10RQ5brgaTE3w1c+ges9FdmA== 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: Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently manipulate the contiguous bit where appropriate. But since there are already some contig-aware users (e.g. hugetlb, kernel mapper), we must first ensure those users use the private API directly so that the future contig-bit manipulations in the public API do not interfere with those existing uses. Signed-off-by: Ryan Roberts --- arch/arm64/include/asm/pgtable.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 9b4a9909fd5b..fc1005222ee4 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -138,7 +138,7 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys) * so that we don't erroneously return false for pages that have been * remapped as PROT_NONE but are yet to be flushed from the TLB. * Note that we can't make any assumptions based on the state of the access - * flag, since ptep_clear_flush_young() elides a DSB when invalidating the + * flag, since __ptep_clear_flush_young() elides a DSB when invalidating the * TLB. */ #define pte_accessible(mm, pte) \ @@ -904,8 +904,7 @@ static inline int __ptep_test_and_clear_young(struct vm_area_struct *vma, return pte_young(pte); } -#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH -static inline int ptep_clear_flush_young(struct vm_area_struct *vma, +static inline int __ptep_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { int young = __ptep_test_and_clear_young(vma, address, ptep); @@ -1119,6 +1118,8 @@ extern void ptep_modify_prot_commit(struct vm_area_struct *vma, #define ptep_get_and_clear __ptep_get_and_clear #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define ptep_test_and_clear_young __ptep_test_and_clear_young +#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH +#define ptep_clear_flush_young __ptep_clear_flush_young #endif /* !__ASSEMBLY__ */