Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp686514rdb; Fri, 2 Feb 2024 00:12:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7oXu4QTBaKjc2e9y0SI84ZsjkJs7EDC3lrxcI+V4FEVspgNkluh/VMAxPJaNpSZeLSMaM X-Received: by 2002:aa7:da52:0:b0:55f:d93a:2efd with SMTP id w18-20020aa7da52000000b0055fd93a2efdmr794332eds.17.1706861560810; Fri, 02 Feb 2024 00:12:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706861560; cv=pass; d=google.com; s=arc-20160816; b=ICmLWtqSPkHhMYtSbRpn5w/ew2EtJ73bIk8ZAOXwxlUHFDuC+7zeV46oqQJPjQruyr 381TH/UArJYUkn+dNHF0AWzt0tvO8wYLM9mZncfWegVgqS/eER3OIPOk/hotn2G+VINL axxgL4gM50zm558y9huIVAfd0fCWZabgFHyG+EMP7OnDGkvrpqV2U0Q7TCDknQiPxOuD sZxO9ZxxW7I5yvyuvpg76E44FJNOdgJLI1nCeXfPyKM0/8zpHVA12Fza9+d3m9hquf3l ToG2THSWnibW/GHGfYpal7p91yHFmcGVh2CX4+cMIYWWtcvU6I/JirWuKrP3m2JaC92n HuAw== ARC-Message-Signature: i=2; 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=/BCYDUOM6grDx0BQxG+5TvCOyfppgVqDK+cfK1dp4FA=; fh=5aJ/Nb3QdARKiXEjucS5uxWnebQ1nFcrIeuATxqpz1k=; b=HFV2lV0vPAgYK2UflF/Kiiq0aq/+FAek198ng8jV/7SKqoVay5Tp3DKHLTJGZg+Fj1 uIuOAzeQFkcUZzhOtUV6v4eIqFusc7/J0Sq+OKqxO2nY0CoqVotDM34hBB2OW9vAIa9N Jc8wtuy6oxD8xc8iitCaVBVs2cXSTrh5BRGQ6uAsTuhbYeozhE+SESV4lJbz0ViKCete O84pdjqgH9Mq/uJ65tZzpi390pQccbfY/k8KlDmQ5GrjQkJnk55UytoN9P5XqNjJUY12 cTFMq9WSufJDwHGK6HTav2VQDX5pVCdMOHuSYp7WRX3WliyTpFKCAQr12PdoRuIc8GtJ Yj/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49427-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49427-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCVh6Ai1BPVjfeLUaF5fhf4G+KoruMmJ72EXfPY8CRVutjYefN2x/t/VvXj2QM58c4YKez+wabqMT1bSgIDaQnEUaeiMeoAfOo8LAujWqw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n19-20020aa7d053000000b0055f61cf92b4si608520edo.553.2024.02.02.00.12.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:12:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49427-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49427-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49427-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 823B21F22C45 for ; Fri, 2 Feb 2024 08:12:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C35C2482F6; Fri, 2 Feb 2024 08:09:12 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F8BF482ED for ; Fri, 2 Feb 2024 08:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861352; cv=none; b=eWeByGqNjktAyzvQqmDVjlcihPuEDV/HJChDHa0MQzmEa/gEBv/mA4dhf46px8lB5Pz6Nm6+O6S+RIM96ma3WTrLA+XFsURHTvBLcfkOeceZ1396RHjGgSlJ8YUo32c5toixrzUo4fAQM7ReA96J7vd34gFXvpTrAmf/VTlroHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861352; c=relaxed/simple; bh=DISFiz7x8niwaKKZXO9emIBlhJg2MSwu1nX86NpwteE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HIElL5Xg2CsPOrvKzB5SQxad+8AH/0EPqdZOIwRNmvw59dRPZsB1sQI3B2vQW53Zq5aLSbhBGSOdXphprBS7eSVcfQ9D/yJOjOGyZDsviVOWn4g4/azPH+j9ftXEl0OK6A10HaI2Z0jbgaXwRGY9xNQqyWcMwn6vKlu6t8O2z8o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 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 159451A00; Fri, 2 Feb 2024 00:09:52 -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 29E883F5A1; Fri, 2 Feb 2024 00:09:06 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 14/25] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit Date: Fri, 2 Feb 2024 08:07:45 +0000 Message-Id: <20240202080756.1453939-15-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202080756.1453939-1-ryan.roberts@arm.com> References: <20240202080756.1453939-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 77a8b100e1cd..2870bc12f288 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) \ @@ -916,8 +916,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); @@ -1138,6 +1137,8 @@ void vmemmap_update_pte(unsigned long addr, pte_t *ptep, pte_t pte); #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