Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: Allow arches to provide ptep_get()

Since commit 9e343b467c70 ("READ_ONCE: Enforce atomicity for
{READ,WRITE}_ONCE() memory accesses") it is not possible anymore to
use READ_ONCE() to access complex page table entries like the one
defined for powerpc 8xx with 16k size pages.

Define a ptep_get() helper that architectures can override instead
of performing a READ_ONCE() on the page table entry pointer.

Fixes: 9e343b467c70 ("READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/087fa12b6e920e32315136b998aa834f99242695.1592225558.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
481e980a 55ca2263

+9 -2
+1 -1
include/asm-generic/hugetlb.h
··· 122 122 #ifndef __HAVE_ARCH_HUGE_PTEP_GET 123 123 static inline pte_t huge_ptep_get(pte_t *ptep) 124 124 { 125 - return READ_ONCE(*ptep); 125 + return ptep_get(ptep); 126 126 } 127 127 #endif 128 128
+7
include/linux/pgtable.h
··· 249 249 } 250 250 #endif 251 251 252 + #ifndef __HAVE_ARCH_PTEP_GET 253 + static inline pte_t ptep_get(pte_t *ptep) 254 + { 255 + return READ_ONCE(*ptep); 256 + } 257 + #endif 258 + 252 259 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 253 260 #ifndef __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR 254 261 static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
+1 -1
mm/gup.c
··· 2196 2196 */ 2197 2197 static inline pte_t gup_get_pte(pte_t *ptep) 2198 2198 { 2199 - return READ_ONCE(*ptep); 2199 + return ptep_get(ptep); 2200 2200 } 2201 2201 #endif /* CONFIG_GUP_GET_PTE_LOW_HIGH */ 2202 2202