Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp12945rdh; Mon, 18 Dec 2023 02:53:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8YH21aPx5OBawVv0qrCL7Nmrp33tZDsIKsHp5r6T0Tv0GkgQ2GWrhUWZ5aBDOBPlzpJtz X-Received: by 2002:a9d:4e85:0:b0:6d9:db33:39a5 with SMTP id v5-20020a9d4e85000000b006d9db3339a5mr15592760otk.75.1702896815125; Mon, 18 Dec 2023 02:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702896815; cv=none; d=google.com; s=arc-20160816; b=T4OuX8v5I18FEE2SlEwjlgxXvvHd8t/tefq8l77sNmC7kfGqaA9gGza90esrAAOkyN FHdLl3qxUMyq/5pQImhXRY/ZFn+2fEmCgCF2dlxNdTgRsDdecwsZsk13cTACJ/Cl4R3L ulZLXXPhvVOShmkMSZSyXjtzrOdqGe8sCd9bQzTz0y8NQSffoGAdKo6vH7QPK/a/8+A7 lX6QU2sJdNdLSTJOOIwQImwO5EXr9KXVK2BVY/SalaSifkcCKFAR8Nb5/k+OnNQYEZ6t Ai1qudiK5KcUphdQgSchZXAvoPSlFuhdT8H5O2KaFjaHg1JP3vryrGAms8Dzft6T8fiF hQRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=80eWkD1e3ScDQ5SjUCye7wOJgIG+FP4dY1bE4B1pVFU=; fh=a3gZESXuO1ptbCtzvzEnZL5xUl+WC4Vy5hoF2yaOXSs=; b=ivRkr0Y2h/4SXMeX0ECFkzXWbhjYg0M/8C/0qOXjcTdj4XJwKa3sBYDrI2Lp/xBFcZ WiRVsu4DqqAK4/bjKs/6u2V2qWHgMihh/fbGHQ25EDlF+DhoI9ApUvqcFNVxIT/dVCrX TDGujFcxQ/bylWgh9ha2uHqKn5I9QzCwYiA2V91CuOtt/veIwGzycdH/N1cnPjHf8kZK vowAXYdyC0BxA2Yzi1XoLijOvRXOHBVNMIk2T4y/Ac7q6/7pvU1wetw6uSCkQpN8gaiP wHR5CSW/Q9jr39y4KnPIIWT3qGMclVEIU49/ghhSDNytoAICj1woZyMUj4NfIbksUv2x gRKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m7-20020a635807000000b005c673949a8dsi17624396pgb.129.2023.12.18.02.53.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 02:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1A170B20D95 for ; Mon, 18 Dec 2023 10:53:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C3AD22329; Mon, 18 Dec 2023 10:51:54 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B28562136B for ; Mon, 18 Dec 2023 10:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 843712F4; Mon, 18 Dec 2023 02:52:35 -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 A89773F738; Mon, 18 Dec 2023 02:51:47 -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 v4 09/16] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit Date: Mon, 18 Dec 2023 10:50:53 +0000 Message-Id: <20231218105100.172635-10-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231218105100.172635-1-ryan.roberts@arm.com> References: <20231218105100.172635-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Tested-by: John Hubbard 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__ */ -- 2.25.1