Message ID | 20200812063358.369514-7-aneesh.kumar@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/16] powerpc/mm: Add DEBUG_VM WARN for pmd_clear | expand |
On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: > kernel expect entries to be marked huge before we use set_pud_at(). > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > --- > mm/debug_vm_pgtable.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index b6aca2526e01..cd609a212dd4 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -265,7 +265,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm, > unsigned long pfn, unsigned long vaddr, > pgprot_t prot) > { > - pud_t pud = pfn_pud(pfn, prot); > + pud_t pud; > > if (!has_transparent_hugepage()) > return; > @@ -274,25 +274,28 @@ static void __init pud_advanced_tests(struct mm_struct *mm, > /* Align the address wrt HPAGE_PUD_SIZE */ > vaddr = (vaddr & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE; > > + pud = pud_mkhuge(pfn_pud(pfn, prot)); > set_pud_at(mm, vaddr, pudp, pud); > pudp_set_wrprotect(mm, vaddr, pudp); > pud = READ_ONCE(*pudp); > WARN_ON(pud_write(pud)); > > #ifndef __PAGETABLE_PMD_FOLDED > - pud = pfn_pud(pfn, prot); > + > + pud = pud_mkhuge(pfn_pud(pfn, prot)); > set_pud_at(mm, vaddr, pudp, pud); > pudp_huge_get_and_clear(mm, vaddr, pudp); > pud = READ_ONCE(*pudp); > WARN_ON(!pud_none(pud)); > > - pud = pfn_pud(pfn, prot); > + pud = pud_mkhuge(pfn_pud(pfn, prot)); > set_pud_at(mm, vaddr, pudp, pud); > pudp_huge_get_and_clear_full(mm, vaddr, pudp, 1); > pud = READ_ONCE(*pudp); > WARN_ON(!pud_none(pud)); > #endif /* __PAGETABLE_PMD_FOLDED */ > - pud = pfn_pud(pfn, prot); > + > + pud = pud_mkhuge(pfn_pud(pfn, prot)); > pud = pud_wrprotect(pud); > pud = pud_mkclean(pud); > set_pud_at(mm, vaddr, pudp, pud); > Looks very similar to the previous patch, hence please fold it back. Seems fair enough that pxx_set_at() expects given entry to be huge. But would need to run them across enabled platforms to be sure.
diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index b6aca2526e01..cd609a212dd4 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -265,7 +265,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm, unsigned long pfn, unsigned long vaddr, pgprot_t prot) { - pud_t pud = pfn_pud(pfn, prot); + pud_t pud; if (!has_transparent_hugepage()) return; @@ -274,25 +274,28 @@ static void __init pud_advanced_tests(struct mm_struct *mm, /* Align the address wrt HPAGE_PUD_SIZE */ vaddr = (vaddr & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE; + pud = pud_mkhuge(pfn_pud(pfn, prot)); set_pud_at(mm, vaddr, pudp, pud); pudp_set_wrprotect(mm, vaddr, pudp); pud = READ_ONCE(*pudp); WARN_ON(pud_write(pud)); #ifndef __PAGETABLE_PMD_FOLDED - pud = pfn_pud(pfn, prot); + + pud = pud_mkhuge(pfn_pud(pfn, prot)); set_pud_at(mm, vaddr, pudp, pud); pudp_huge_get_and_clear(mm, vaddr, pudp); pud = READ_ONCE(*pudp); WARN_ON(!pud_none(pud)); - pud = pfn_pud(pfn, prot); + pud = pud_mkhuge(pfn_pud(pfn, prot)); set_pud_at(mm, vaddr, pudp, pud); pudp_huge_get_and_clear_full(mm, vaddr, pudp, 1); pud = READ_ONCE(*pudp); WARN_ON(!pud_none(pud)); #endif /* __PAGETABLE_PMD_FOLDED */ - pud = pfn_pud(pfn, prot); + + pud = pud_mkhuge(pfn_pud(pfn, prot)); pud = pud_wrprotect(pud); pud = pud_mkclean(pud); set_pud_at(mm, vaddr, pudp, pud);
kernel expect entries to be marked huge before we use set_pud_at(). Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> --- mm/debug_vm_pgtable.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)