From patchwork Thu Jun 22 14:42:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 111701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5125799vqr; Thu, 22 Jun 2023 07:52:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5adlmwGWxjD9wXVkpanK+1MCZ2JpwJCPC/R1P0MpmxUBgpwdMBMj+tIexxWo3aDpHffkqd X-Received: by 2002:a05:6a21:7897:b0:122:9e67:1d77 with SMTP id bf23-20020a056a21789700b001229e671d77mr7716888pzc.38.1687445556768; Thu, 22 Jun 2023 07:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687445556; cv=none; d=google.com; s=arc-20160816; b=vTK1nl++FkFRUE/QgYVkGV1JIhPsaD9mk3jCgM1FhJx8B9vxaXXhtMaMMRyc2sCix6 3wybG5eLkMRn5L243j1THnaKbs9gdMuxA9V3BrGJRAnws2dYv0IkbETvF/pajRB80v77 jN+PEZrSDxajFwOjBdmft2OZmW2vMOE7qeQQmZ1g+w0y7wXokxj3uQMAvYS2rwi1vn/4 Ky3kXrj8kiFPZXZcl3GNK5sGG/uZ5VhhuY8dqBcuZgZGTPlBJ6SC+BeviKScA2FlCEFb XP4HdRahYFCNp9FchoZHkyKU3Bp674u3Qx5CK9NTSPv76EBrIt7D2APKBAtkwH97XFSj URGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RSoTM1LsxTuhuluqju/tIeLVsAKwQnd+CnuMIDbAx3Q=; b=ccjpDRZSGt+cJ/uzOYQG8ebaf00dGTkS/HEfeZh4VbkU9Vp0SyKkjjOoe+FybF5pje R6Bxsd0bSMBgrvYxAqhivOhBJqSve7yFqWKnfQlGtxgMi80Mlmt9oslnEhLmpecwnYEi mun0fCSlsLsALMT3aM+o3PRu6EV0Av1W7+iHd16YZTF45DDwchL4iVaHo6s7dn/icWxH QBAnTa7zYLsekPhTU2fZ5lp1Mt3+Niuyz1XsD5n6wW9Oho4mxitGOU96aNGBvTOB9e6b H557iO2+wIQWAyOU1TN3At/w1YF7S52r+7GKNb+VINALASWGANBL7OOfhLRK25YCWXrc 8CYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l65-20020a639144000000b005573d0a4de4si2898220pge.218.2023.06.22.07.52.23; Thu, 22 Jun 2023 07:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbjFVOnP (ORCPT + 99 others); Thu, 22 Jun 2023 10:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231593AbjFVOm5 (ORCPT ); Thu, 22 Jun 2023 10:42:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 817EB2118 for ; Thu, 22 Jun 2023 07:42:45 -0700 (PDT) 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 C707A113E; Thu, 22 Jun 2023 07:43:28 -0700 (PDT) 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 431FC3F663; Thu, 22 Jun 2023 07:42:42 -0700 (PDT) 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 Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 06/14] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit Date: Thu, 22 Jun 2023 15:42:01 +0100 Message-Id: <20230622144210.2623299-7-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622144210.2623299-1-ryan.roberts@arm.com> References: <20230622144210.2623299-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769414912324539356?= X-GMAIL-MSGID: =?utf-8?q?1769414912324539356?= 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. No behavioural changes intended. Signed-off-by: Ryan Roberts --- arch/arm64/include/asm/pgtable.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 1f4efa17cc39..450428b11c49 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -137,7 +137,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); @@ -1153,6 +1152,13 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, return __ptep_test_and_clear_young(vma, addr, ptep); } +#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH +static inline int ptep_clear_flush_young(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ + return __ptep_clear_flush_young(vma, addr, ptep); +} + #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */