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_pmd_clear()

This reverts commit 1831414cd729 ("mm/page_table_check: remove unused
parameter in [__]page_table_check_pmd_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 on arm64 changes]
Link: https://lkml.kernel.org/r/20251219-pgtable_check_v18rebase-v18-7-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
649ec9e3 2e6ac078

+14 -10
+1 -1
arch/arm64/include/asm/pgtable.h
··· 1345 1345 page_table_check_pte_clear(mm, pte); 1346 1346 break; 1347 1347 case PMD_SIZE: 1348 - page_table_check_pmd_clear(mm, pte_pmd(pte)); 1348 + page_table_check_pmd_clear(mm, address, pte_pmd(pte)); 1349 1349 break; 1350 1350 #ifndef __PAGETABLE_PMD_FOLDED 1351 1351 case PUD_SIZE:
+1 -1
arch/riscv/include/asm/pgtable.h
··· 1007 1007 pmd_clear(pmdp); 1008 1008 #endif 1009 1009 1010 - page_table_check_pmd_clear(mm, pmd); 1010 + page_table_check_pmd_clear(mm, address, pmd); 1011 1011 1012 1012 return pmd; 1013 1013 }
+1 -1
arch/x86/include/asm/pgtable.h
··· 1319 1319 { 1320 1320 pmd_t pmd = native_pmdp_get_and_clear(pmdp); 1321 1321 1322 - page_table_check_pmd_clear(mm, pmd); 1322 + page_table_check_pmd_clear(mm, addr, pmd); 1323 1323 1324 1324 return pmd; 1325 1325 }
+7 -4
include/linux/page_table_check.h
··· 15 15 16 16 void __page_table_check_zero(struct page *page, unsigned int order); 17 17 void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); 18 - void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd); 18 + void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, 19 + pmd_t pmd); 19 20 void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, 20 21 pud_t pud); 21 22 void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, ··· 53 52 __page_table_check_pte_clear(mm, pte); 54 53 } 55 54 56 - static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) 55 + static inline void page_table_check_pmd_clear(struct mm_struct *mm, 56 + unsigned long addr, pmd_t pmd) 57 57 { 58 58 if (static_branch_likely(&page_table_check_disabled)) 59 59 return; 60 60 61 - __page_table_check_pmd_clear(mm, pmd); 61 + __page_table_check_pmd_clear(mm, addr, pmd); 62 62 } 63 63 64 64 static inline void page_table_check_pud_clear(struct mm_struct *mm, ··· 123 121 { 124 122 } 125 123 126 - static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) 124 + static inline void page_table_check_pmd_clear(struct mm_struct *mm, 125 + unsigned long addr, pmd_t pmd) 127 126 { 128 127 } 129 128
+1 -1
include/linux/pgtable.h
··· 788 788 pmd_t pmd = *pmdp; 789 789 790 790 pmd_clear(pmdp); 791 - page_table_check_pmd_clear(mm, pmd); 791 + page_table_check_pmd_clear(mm, address, pmd); 792 792 793 793 return pmd; 794 794 }
+3 -2
mm/page_table_check.c
··· 156 156 } 157 157 EXPORT_SYMBOL(__page_table_check_pte_clear); 158 158 159 - void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) 159 + void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, 160 + pmd_t pmd) 160 161 { 161 162 if (&init_mm == mm) 162 163 return; ··· 239 238 page_table_check_pmd_flags(pmd); 240 239 241 240 for (i = 0; i < nr; i++) 242 - __page_table_check_pmd_clear(mm, *(pmdp + i)); 241 + __page_table_check_pmd_clear(mm, addr + PMD_SIZE * i, *(pmdp + i)); 243 242 if (pmd_user_accessible_page(pmd)) 244 243 page_table_check_set(pmd_pfn(pmd), stride * nr, pmd_write(pmd)); 245 244 }