Message ID | 20250211161404.850215-5-ajd@linux.ibm.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Support page table check on PowerPC | expand |
On Wed, 12 Feb 2025 03:13:57 +1100 Andrew Donnellan <ajd@linux.ibm.com> wrote: > This reverts commit 931c38e16499 ("mm/page_table_check: remove unused > parameter in [__]page_table_check_pud_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. My x86-64 allmodconfig exploded. ./arch/x86/include/asm/pgtable.h: In function 'pudp_establish': ./arch/x86/include/asm/pgtable.h:1443:46: error: passing argument 2 of 'page_table_check_pud_set' makes integer from pointer without a cast [-Werror=int-conversion] 1443 | page_table_check_pud_set(vma->vm_mm, pudp, pud); | ^~~~ | | | pud_t * #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD static inline pud_t pudp_establish(struct vm_area_struct *vma, unsigned long address, pud_t *pudp, pud_t pud) { page_table_check_pud_set(vma->vm_mm, pudp, pud); ...
On Thu, 2025-03-13 at 16:10 -0700, Andrew Morton wrote: > On Wed, 12 Feb 2025 03:13:57 +1100 Andrew Donnellan > <ajd@linux.ibm.com> wrote: > > > This reverts commit 931c38e16499 ("mm/page_table_check: remove > > unused > > parameter in [__]page_table_check_pud_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. > > My x86-64 allmodconfig exploded. > > ./arch/x86/include/asm/pgtable.h: In function 'pudp_establish': > ./arch/x86/include/asm/pgtable.h:1443:46: error: passing argument 2 > of 'page_table_check_pud_set' makes integer from pointer without a > cast [-Werror=int-conversion] > 1443 | page_table_check_pud_set(vma->vm_mm, pudp, pud); > | ^~~~ > | | > | pud_t * > > > > #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD > static inline pud_t pudp_establish(struct vm_area_struct *vma, > unsigned long address, pud_t *pudp, pud_t pud) > { > page_table_check_pud_set(vma->vm_mm, pudp, pud); > ... > Sorry, my email filters sent this to the wrong folder for some reason and I didn't see this. I've sent v14: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=452247 Thanks,
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 366cdb9d75d9..5ec052ef07ff 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1398,7 +1398,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, { pud_t pud = native_pudp_get_and_clear(pudp); - page_table_check_pud_clear(mm, pud); + page_table_check_pud_clear(mm, addr, pud); return pud; } diff --git a/include/linux/page_table_check.h b/include/linux/page_table_check.h index 9243c920ed02..d01a00ffc1f9 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -16,7 +16,8 @@ extern struct page_ext_operations page_table_check_ops; void __page_table_check_zero(struct page *page, unsigned int order); void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte); void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd); -void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud); +void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, + pud_t pud); void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned int nr); void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, @@ -59,12 +60,13 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) __page_table_check_pmd_clear(mm, pmd); } -static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +static inline void page_table_check_pud_clear(struct mm_struct *mm, + unsigned long addr, pud_t pud) { if (static_branch_likely(&page_table_check_disabled)) return; - __page_table_check_pud_clear(mm, pud); + __page_table_check_pud_clear(mm, addr, pud); } static inline void page_table_check_ptes_set(struct mm_struct *mm, @@ -125,7 +127,8 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) { } -static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +static inline void page_table_check_pud_clear(struct mm_struct *mm, + unsigned long addr, pud_t pud) { } diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 2b25dd17ec67..e41cf0622aa4 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -648,7 +648,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, pud_t pud = *pudp; pud_clear(pudp); - page_table_check_pud_clear(mm, pud); + page_table_check_pud_clear(mm, address, pud); return pud; } diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 959e11e1af24..7c2f3f93e377 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -182,7 +182,8 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd) } EXPORT_SYMBOL(__page_table_check_pmd_clear); -void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud) +void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, + pud_t pud) { if (&init_mm == mm) return; @@ -256,7 +257,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, if (&init_mm == mm) return; - __page_table_check_pud_clear(mm, *pudp); + __page_table_check_pud_clear(mm, addr, *pudp); if (pud_user_accessible_page(pud)) { page_table_check_set(pud_pfn(pud), PUD_SIZE >> PAGE_SHIFT, pud_write(pud));