From patchwork Wed Nov 15 16:30:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13457062 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 15767C072A2 for ; Wed, 15 Nov 2023 16:31:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A17166B0390; Wed, 15 Nov 2023 11:30:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9EE426B0392; Wed, 15 Nov 2023 11:30:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B6636B0393; Wed, 15 Nov 2023 11:30:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 79D386B0390 for ; Wed, 15 Nov 2023 11:30:59 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F02E0803CF for ; Wed, 15 Nov 2023 16:30:58 +0000 (UTC) X-FDA: 81460727796.11.B3C05CB Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id E133410002B for ; Wed, 15 Nov 2023 16:30:56 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.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=1700065857; a=rsa-sha256; cv=none; b=fbtjrvw0RAFRfhz8+LkvhFKyUDzPDFVFw/fHGIBddRIFlMv8paAxS9ITD/MJDqv7BCBoSd 7QN6lYeA79MwymYsolx/7Abmb2JwcDLvZ6zW/XWxp251uQCt6qkiiFueuArENyQHFYOX8I Zs6jHqXHzPRBQNC3Jy7MB1a3438ZFOU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.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=1700065857; 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=n3Dk9U5057p5/xg1IJZmG+ZYTB954BAk3wAGupxp79A9FCKu8wUFIehVJV0t6IuYgTN1nZ gUf1FLOg2KUgDfrGmpiXWn4oBzgDxmi3SCq8WDWM73fGh7+zbdcSTD/6bbw9GxOaD6NEoK CijQXEfHUjszJOdP15a1FO0v65JF7gs= 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 70C3115DB; Wed, 15 Nov 2023 08:31:41 -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 B6F783F641; Wed, 15 Nov 2023 08:30:52 -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 Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/14] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit Date: Wed, 15 Nov 2023 16:30:11 +0000 Message-Id: <20231115163018.1303287-8-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231115163018.1303287-1-ryan.roberts@arm.com> References: <20231115163018.1303287-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E133410002B X-Stat-Signature: rt87ipqopb941nctny4bte5ynz3nxra7 X-Rspam-User: X-HE-Tag: 1700065856-230803 X-HE-Meta: U2FsdGVkX18HKTUpGVwhIT1OELq0DTcsQ3/fgpz8qnS8q34zPVgei4jP7B3ThKDLmgCgKvVprGEFSpWIIYL6IhVPLebXmW2bOBdzO91+LowDrtBocVkNyxsF47T5l9fUMkiraWYGtwhEEpnm5JtZGnwVEKWoiLO2uC3UVfkVRH7LNjefBhTo97mWpzXSyTgWiqrJwSIXD4LEpZy7QT48YmeSLmEfSYLhcb091T82z8T6NHbGUsQoHVG1XYIq+blB2CNCcXx4sDlFDz2RCDrr2jH+EF/aaKU+qS1OYCz6/cP1eO1EPEoxRwHt99TKZTozWnRRhxG3AlbXC7BEVpGJ85NYRw6u9uoOaa7m6iey9JaSxBRv26i86qeIktpnaRZ318O3UTmBBWy4tdekesv+4rELFAlFGDVGpG6fkD1RfBcKhficmF22WoXaNFziFI8Xvp2I5pppMUHBZ21juIURQYyZ6gvIJd/MdVsj72u85nd+jlJT/SUNxU0dmG4usx8LIGo+Wd6AWy8BvVrIswcZy+MF9IZx9psL/waIkLwR7Us8wy+Lfj8wnOJX3hJCZdPtVFghbtbjjsNq3TDEWitVXEHjRiixp0argDOMCl+oAOoEZsnII2b6IgTZ/rsYoA0Fgh8/pk5nsA1C6eVwrMy4QiyOBoXQw6UcbmSLpjgNwAjAgQvL7f9dFWdg8ddbo51HkbcFKnrH5QALCTkvvrts3LqwAsohmEqkoTJZ9TddhXXBlLLwxJ5xECDSYCFAJwLZuqOWTlGasUyHz9ggMANSXEeJfHNt3K36tPd8FYC32Uef179wo/mxACJI0l2MeQf+ygaLtJy16FTUkhZsoauyR9Pa/BPYSMXdHqbEYK2hMNYwYZBHB0SZgnFCNvsc0OqFGG62X1VKegWQxGgbPHowxY0bDPckMY513lwDLC2t5aFtUNLbRYkVWi8tFAN6lvy3x37ZxdoIvbHwlntEyjr kP0IggfB vgxds+nf75fOvmtbQvCvxl3iCUuWH+ffwj1YIn2C1tZ1jXNu1X7gTh2g92HF+cyzNfMvbfASf61mK2OqTgu9UJG7iMU2Hd/T3CjTwG6hA0Ld24c72XdVf2/W2mJNssuygldFvUFzmGkYPmYglx8Xec1ujYGsP76Y9UQdQa/UwwIKS5Cmep7Kgf8Gal1zjOoLGRPFEH04e+hNE2lqBwd/WqE8qUnlf6B8jZYMGig8lliek/HaWEdJ1/WTNCBa4zGSv5sdfuCrgOVrf+x8RUST1UzsK/g== 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__ */