mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:44:45 +01:00
mm/page_table_check: reinstate address parameter in [__]page_table_check_pte_clear()
This reverts commit aa232204c4 ("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>
This commit is contained in:
parent
649ec9e3d0
commit
d7b4b67eb6
6 changed files with 17 additions and 13 deletions
|
|
@ -1342,7 +1342,7 @@ static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,
|
|||
|
||||
switch (pgsize) {
|
||||
case PAGE_SIZE:
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, address, pte);
|
||||
break;
|
||||
case PMD_SIZE:
|
||||
page_table_check_pmd_clear(mm, address, pte_pmd(pte));
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
|
|||
set_pte(ptep, __pte(0));
|
||||
#endif
|
||||
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, address, pte);
|
||||
|
||||
return pte;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1252,7 +1252,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
|
|||
pte_t *ptep)
|
||||
{
|
||||
pte_t pte = native_ptep_get_and_clear(ptep);
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, addr, pte);
|
||||
return pte;
|
||||
}
|
||||
|
||||
|
|
@ -1268,7 +1268,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
|
|||
* care about updates and native needs no locking
|
||||
*/
|
||||
pte = native_local_ptep_get_and_clear(ptep);
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, addr, pte);
|
||||
} else {
|
||||
pte = ptep_get_and_clear(mm, addr, ptep);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ extern struct static_key_true page_table_check_disabled;
|
|||
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_pte_clear(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t pte);
|
||||
void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
|
||||
pmd_t pmd);
|
||||
void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
|
||||
|
|
@ -45,12 +46,13 @@ static inline void page_table_check_free(struct page *page, unsigned int order)
|
|||
__page_table_check_zero(page, order);
|
||||
}
|
||||
|
||||
static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte)
|
||||
static inline void page_table_check_pte_clear(struct mm_struct *mm,
|
||||
unsigned long addr, pte_t pte)
|
||||
{
|
||||
if (static_branch_likely(&page_table_check_disabled))
|
||||
return;
|
||||
|
||||
__page_table_check_pte_clear(mm, pte);
|
||||
__page_table_check_pte_clear(mm, addr, pte);
|
||||
}
|
||||
|
||||
static inline void page_table_check_pmd_clear(struct mm_struct *mm,
|
||||
|
|
@ -119,7 +121,8 @@ static inline void page_table_check_free(struct page *page, unsigned int order)
|
|||
{
|
||||
}
|
||||
|
||||
static inline void page_table_check_pte_clear(struct mm_struct *mm, pte_t pte)
|
||||
static inline void page_table_check_pte_clear(struct mm_struct *mm,
|
||||
unsigned long addr, pte_t pte)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
|
|||
{
|
||||
pte_t pte = ptep_get(ptep);
|
||||
pte_clear(mm, address, ptep);
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, address, pte);
|
||||
return pte;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -693,7 +693,7 @@ static inline void ptep_clear(struct mm_struct *mm, unsigned long addr,
|
|||
* No need for ptep_get_and_clear(): page table check doesn't care about
|
||||
* any bits that could have been set by HW concurrently.
|
||||
*/
|
||||
page_table_check_pte_clear(mm, pte);
|
||||
page_table_check_pte_clear(mm, addr, pte);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GUP_GET_PXX_LOW_HIGH
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ void __page_table_check_zero(struct page *page, unsigned int order)
|
|||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte)
|
||||
void __page_table_check_pte_clear(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t pte)
|
||||
{
|
||||
if (&init_mm == mm)
|
||||
return;
|
||||
|
|
@ -209,7 +210,7 @@ void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr,
|
|||
page_table_check_pte_flags(pte);
|
||||
|
||||
for (i = 0; i < nr; i++)
|
||||
__page_table_check_pte_clear(mm, ptep_get(ptep + i));
|
||||
__page_table_check_pte_clear(mm, addr + PAGE_SIZE * i, ptep_get(ptep + i));
|
||||
if (pte_user_accessible_page(pte))
|
||||
page_table_check_set(pte_pfn(pte), nr, pte_write(pte));
|
||||
}
|
||||
|
|
@ -275,7 +276,7 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm,
|
|||
if (WARN_ON(!ptep))
|
||||
return;
|
||||
for (i = 0; i < PTRS_PER_PTE; i++) {
|
||||
__page_table_check_pte_clear(mm, ptep_get(ptep));
|
||||
__page_table_check_pte_clear(mm, addr, ptep_get(ptep));
|
||||
addr += PAGE_SIZE;
|
||||
ptep++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue