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

Configure Feed

Select the types of activity you want to include in your feed.

mm/page_table_check: reinstate address parameter in [__]page_table_check_pte_clear()

This reverts commit aa232204c468 ("mm/page_table_check: remove unused
parameter in [__]page_table_check_pte_clear").

Reinstate previously unused parameters for the purpose of supporting
powerpc platforms, as many do not encode user/kernel ownership of the page
in the pte, but instead in the address of the access.

[ajd@linux.ibm.com: rebase, fix additional occurrence and loop handling]
Link: https://lkml.kernel.org/r/20251219-pgtable_check_v18rebase-v18-8-755bc151a50b@linux.ibm.com
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: Ingo Molnar <mingo@kernel.org> # x86
Acked-by: Alexandre Ghiti <alexghiti@rivosinc.com> # riscv
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Donet Tom <donettom@linux.ibm.com>
Cc: Guo Weikang <guoweikang.kernel@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Miehlbradt <nicholas@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: Thomas Huth <thuth@redhat.com>
Cc: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Rohan McLure and committed by
Andrew Morton
d7b4b67e 649ec9e3

+17 -13
+1 -1
arch/arm64/include/asm/pgtable.h
··· 1342 1342 1343 1343 switch (pgsize) { 1344 1344 case PAGE_SIZE: 1345 - page_table_check_pte_clear(mm, pte); 1345 + page_table_check_pte_clear(mm, address, pte); 1346 1346 break; 1347 1347 case PMD_SIZE: 1348 1348 page_table_check_pmd_clear(mm, address, pte_pmd(pte));
+1 -1
arch/riscv/include/asm/pgtable.h
··· 664 664 set_pte(ptep, __pte(0)); 665 665 #endif 666 666 667 - page_table_check_pte_clear(mm, pte); 667 + page_table_check_pte_clear(mm, address, pte); 668 668 669 669 return pte; 670 670 }
+2 -2
arch/x86/include/asm/pgtable.h
··· 1252 1252 pte_t *ptep) 1253 1253 { 1254 1254 pte_t pte = native_ptep_get_and_clear(ptep); 1255 - page_table_check_pte_clear(mm, pte); 1255 + page_table_check_pte_clear(mm, addr, pte); 1256 1256 return pte; 1257 1257 } 1258 1258 ··· 1268 1268 * care about updates and native needs no locking 1269 1269 */ 1270 1270 pte = native_local_ptep_get_and_clear(ptep); 1271 - page_table_check_pte_clear(mm, pte); 1271 + page_table_check_pte_clear(mm, addr, pte); 1272 1272 } else { 1273 1273 pte = ptep_get_and_clear(mm, addr, ptep); 1274 1274 }
+7 -4
include/linux/page_table_check.h
··· 14 14 extern struct page_ext_operations page_table_check_ops; 15 15 16 16 void __page_table_check_zero(struct page *page, unsigned int order); 17 - void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); 17 + void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr, 18 + pte_t pte); 18 19 void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, 19 20 pmd_t pmd); 20 21 void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, ··· 46 45 __page_table_check_zero(page, order); 47 46 } 48 47 49 - static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) 48 + static inline void page_table_check_pte_clear(struct mm_struct *mm, 49 + unsigned long addr, pte_t pte) 50 50 { 51 51 if (static_branch_likely(&page_table_check_disabled)) 52 52 return; 53 53 54 - __page_table_check_pte_clear(mm, pte); 54 + __page_table_check_pte_clear(mm, addr, pte); 55 55 } 56 56 57 57 static inline void page_table_check_pmd_clear(struct mm_struct *mm, ··· 121 119 { 122 120 } 123 121 124 - static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) 122 + static inline void page_table_check_pte_clear(struct mm_struct *mm, 123 + unsigned long addr, pte_t pte) 125 124 { 126 125 } 127 126
+2 -2
include/linux/pgtable.h
··· 634 634 { 635 635 pte_t pte = ptep_get(ptep); 636 636 pte_clear(mm, address, ptep); 637 - page_table_check_pte_clear(mm, pte); 637 + page_table_check_pte_clear(mm, address, pte); 638 638 return pte; 639 639 } 640 640 #endif ··· 693 693 * No need for ptep_get_and_clear(): page table check doesn't care about 694 694 * any bits that could have been set by HW concurrently. 695 695 */ 696 - page_table_check_pte_clear(mm, pte); 696 + page_table_check_pte_clear(mm, addr, pte); 697 697 } 698 698 699 699 #ifdef CONFIG_GUP_GET_PXX_LOW_HIGH
+4 -3
mm/page_table_check.c
··· 145 145 rcu_read_unlock(); 146 146 } 147 147 148 - void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte) 148 + void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr, 149 + pte_t pte) 149 150 { 150 151 if (&init_mm == mm) 151 152 return; ··· 210 209 page_table_check_pte_flags(pte); 211 210 212 211 for (i = 0; i < nr; i++) 213 - __page_table_check_pte_clear(mm, ptep_get(ptep + i)); 212 + __page_table_check_pte_clear(mm, addr + PAGE_SIZE * i, ptep_get(ptep + i)); 214 213 if (pte_user_accessible_page(pte)) 215 214 page_table_check_set(pte_pfn(pte), nr, pte_write(pte)); 216 215 } ··· 276 275 if (WARN_ON(!ptep)) 277 276 return; 278 277 for (i = 0; i < PTRS_PER_PTE; i++) { 279 - __page_table_check_pte_clear(mm, ptep_get(ptep)); 278 + __page_table_check_pte_clear(mm, addr, ptep_get(ptep)); 280 279 addr += PAGE_SIZE; 281 280 ptep++; 282 281 }