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_pud[s]_set()

This reverts commit 6d144436d954 ("mm/page_table_check: remove unused
parameter in [__]page_table_check_pud_set").

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.

Apply this to __page_table_check_puds_set(), page_table_check_puds_set()
and the page_table_check_pud_set() wrapper macro.

[ajd@linux.ibm.com: rebase on riscv + arm64 changes, update commit message]
Link: https://lkml.kernel.org/r/20251219-pgtable_check_v18rebase-v18-3-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
c4a0c5ff ee329c29

+14 -13
+2 -1
arch/arm64/include/asm/pgtable.h
··· 688 688 break; 689 689 #ifndef __PAGETABLE_PMD_FOLDED 690 690 case PUD_SIZE: 691 - page_table_check_puds_set(mm, (pud_t *)ptep, pte_pud(pte), nr); 691 + page_table_check_puds_set(mm, addr, (pud_t *)ptep, 692 + pte_pud(pte), nr); 692 693 break; 693 694 #endif 694 695 default:
+2 -2
arch/riscv/include/asm/pgtable.h
··· 953 953 static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, 954 954 pud_t *pudp, pud_t pud) 955 955 { 956 - page_table_check_pud_set(mm, pudp, pud); 956 + page_table_check_pud_set(mm, addr, pudp, pud); 957 957 return __set_pte_at(mm, (pte_t *)pudp, pud_pte(pud)); 958 958 } 959 959 ··· 1122 1122 static inline pud_t pudp_establish(struct vm_area_struct *vma, 1123 1123 unsigned long address, pud_t *pudp, pud_t pud) 1124 1124 { 1125 - page_table_check_pud_set(vma->vm_mm, pudp, pud); 1125 + page_table_check_pud_set(vma->vm_mm, address, pudp, pud); 1126 1126 return __pud(atomic_long_xchg((atomic_long_t *)pudp, pud_val(pud))); 1127 1127 } 1128 1128
+2 -2
arch/x86/include/asm/pgtable.h
··· 1221 1221 static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, 1222 1222 pud_t *pudp, pud_t pud) 1223 1223 { 1224 - page_table_check_pud_set(mm, pudp, pud); 1224 + page_table_check_pud_set(mm, addr, pudp, pud); 1225 1225 native_set_pud(pudp, pud); 1226 1226 } 1227 1227 ··· 1372 1372 static inline pud_t pudp_establish(struct vm_area_struct *vma, 1373 1373 unsigned long address, pud_t *pudp, pud_t pud) 1374 1374 { 1375 - page_table_check_pud_set(vma->vm_mm, pudp, pud); 1375 + page_table_check_pud_set(vma->vm_mm, address, pudp, pud); 1376 1376 if (IS_ENABLED(CONFIG_SMP)) { 1377 1377 return xchg(pudp, pud); 1378 1378 } else {
+6 -6
include/linux/page_table_check.h
··· 21 21 unsigned int nr); 22 22 void __page_table_check_pmds_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t pmd, 23 23 unsigned int nr); 24 - void __page_table_check_puds_set(struct mm_struct *mm, pud_t *pudp, pud_t pud, 25 - unsigned int nr); 24 + void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr, 25 + pud_t *pudp, pud_t pud, unsigned int nr); 26 26 void __page_table_check_pte_clear_range(struct mm_struct *mm, 27 27 unsigned long addr, 28 28 pmd_t pmd); ··· 86 86 } 87 87 88 88 static inline void page_table_check_puds_set(struct mm_struct *mm, 89 - pud_t *pudp, pud_t pud, unsigned int nr) 89 + unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr) 90 90 { 91 91 if (static_branch_likely(&page_table_check_disabled)) 92 92 return; 93 93 94 - __page_table_check_puds_set(mm, pudp, pud, nr); 94 + __page_table_check_puds_set(mm, addr, pudp, pud, nr); 95 95 } 96 96 97 97 static inline void page_table_check_pte_clear_range(struct mm_struct *mm, ··· 137 137 } 138 138 139 139 static inline void page_table_check_puds_set(struct mm_struct *mm, 140 - pud_t *pudp, pud_t pud, unsigned int nr) 140 + unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr) 141 141 { 142 142 } 143 143 ··· 150 150 #endif /* CONFIG_PAGE_TABLE_CHECK */ 151 151 152 152 #define page_table_check_pmd_set(mm, pmdp, pmd) page_table_check_pmds_set(mm, pmdp, pmd, 1) 153 - #define page_table_check_pud_set(mm, pudp, pud) page_table_check_puds_set(mm, pudp, pud, 1) 153 + #define page_table_check_pud_set(mm, addr, pudp, pud) page_table_check_puds_set(mm, addr, pudp, pud, 1) 154 154 155 155 #endif /* __LINUX_PAGE_TABLE_CHECK_H */
+2 -2
mm/page_table_check.c
··· 243 243 } 244 244 EXPORT_SYMBOL(__page_table_check_pmds_set); 245 245 246 - void __page_table_check_puds_set(struct mm_struct *mm, pud_t *pudp, pud_t pud, 247 - unsigned int nr) 246 + void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr, 247 + pud_t *pudp, pud_t pud, unsigned int nr) 248 248 { 249 249 unsigned long stride = PUD_SIZE >> PAGE_SHIFT; 250 250 unsigned int i;