From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A6A4203710 for ; Tue, 24 Feb 2026 05:13:11 +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=1771909992; cv=none; b=COYNAmenzoAItdgHOF5SNfuM4oiMMP+n00KjaqfwYqsHjNw5eQly6N2yAgOXA9v1O+3a69/fsB0DvzThd9tXPY6D9WunAHZb3jSBW5hVfVDzrqzaralzJB0hitlp9UfMgDm4W5tJixcNVZ7nSWsGQWcVrCODjgAvCZYVfmcjD94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771909992; c=relaxed/simple; bh=zhIAYQbWI8v5Ijzzar47sqKghM6RIJwxUjotj+12eJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X5Mh03tY+yvydKDhP88zbL4UCBhyGIxlzo2RfIfHE1L6vb2vH59+eBed5n9rYK3tSQieMQal6ON3yc3Qf698fHnBSB3CpP48X9otBNRrC+KixpZIEgeNpugiv015myvkdGytBZLGihGg20lZmyT/lUZdReSKWRQjfyoM2joA3m0= 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 B7F0B497; Mon, 23 Feb 2026 21:13:04 -0800 (PST) Received: from a085714.blr.arm.com (a085714.arm.com [10.164.18.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D52463F7BD; Mon, 23 Feb 2026 21:13:06 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Ryan Roberts , Mark Rutland , Lorenzo Stoakes , Andrew Morton , David Hildenbrand , Mike Rapoport , Linu Cherian , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC V1 09/16] arm64/mm: Route all pgtable reads via ptdesc_get() Date: Tue, 24 Feb 2026 10:41:46 +0530 Message-ID: <20260224051153.3150613-10-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260224051153.3150613-1-anshuman.khandual@arm.com> References: <20260224051153.3150613-1-anshuman.khandual@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 Define arm64 platform specific implementations for new pXdp_get() helpers. These resolve into READ_ONCE(), thus ensuring required single copy atomic semantics for the page table entry reads. In future this infrastructure can be used for D128 to maintain single copy atomicity semantics with inline asm blocks. Cc: Catalin Marinas Cc: Will Deacon Cc: Ryan Roberts Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/pgtable.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 257af1c3015d..804ef49aea88 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -84,6 +84,32 @@ static inline void arch_leave_lazy_mmu_mode(void) arch_flush_lazy_mmu_mode(); } +#define ptdesc_get(x) READ_ONCE(x) + +#define pmdp_get pmdp_get +static inline pmd_t pmdp_get(pmd_t *pmdp) +{ + return ptdesc_get(*pmdp); +} + +#define pudp_get pudp_get +static inline pud_t pudp_get(pud_t *pudp) +{ + return ptdesc_get(*pudp); +} + +#define p4dp_get p4dp_get +static inline p4d_t p4dp_get(p4d_t *p4dp) +{ + return ptdesc_get(*p4dp); +} + +#define pgdp_get pgdp_get +static inline pgd_t pgdp_get(pgd_t *pgdp) +{ + return ptdesc_get(*pgdp); +} + #ifdef CONFIG_TRANSPARENT_HUGEPAGE #define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE @@ -384,7 +410,7 @@ static inline void __set_pte(pte_t *ptep, pte_t pte) static inline pte_t __ptep_get(pte_t *ptep) { - return READ_ONCE(*ptep); + return ptdesc_get(*ptep); } extern void __sync_icache_dcache(pte_t pteval); -- 2.43.0