Message ID | 20200812063358.369514-8-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: > set_pmd_at() should not be used to set a pte entry at locations that > already holds a valid pte entry. Architectures like ppc64 don't do TLB > invalidate in set_pmd_at() and hence expect it to be used to set locations > that are not a valid PTE. > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > --- > mm/debug_vm_pgtable.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index cd609a212dd4..60bf876081b8 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -164,8 +164,6 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, > pmd = READ_ONCE(*pmdp); > WARN_ON(pmd_write(pmd)); > > - pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); > - set_pmd_at(mm, vaddr, pmdp, pmd); > pmdp_huge_get_and_clear(mm, vaddr, pmdp); > pmd = READ_ONCE(*pmdp); > WARN_ON(!pmd_none(pmd)); > @@ -180,12 +178,11 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, > pmd = READ_ONCE(*pmdp); > WARN_ON(!(pmd_write(pmd) && pmd_dirty(pmd))); > > - pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); > - set_pmd_at(mm, vaddr, pmdp, pmd); > pmdp_huge_get_and_clear_full(vma, vaddr, pmdp, 1); > pmd = READ_ONCE(*pmdp); > WARN_ON(!pmd_none(pmd)); > > + pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); > pmd = pmd_mkyoung(pmd); > set_pmd_at(mm, vaddr, pmdp, pmd); > pmdp_test_and_clear_young(vma, vaddr, pmdp); > Very similar to [PATCH 3/16] wrt set_pte_at(), please fold it.
diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index cd609a212dd4..60bf876081b8 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -164,8 +164,6 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, pmd = READ_ONCE(*pmdp); WARN_ON(pmd_write(pmd)); - pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); - set_pmd_at(mm, vaddr, pmdp, pmd); pmdp_huge_get_and_clear(mm, vaddr, pmdp); pmd = READ_ONCE(*pmdp); WARN_ON(!pmd_none(pmd)); @@ -180,12 +178,11 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, pmd = READ_ONCE(*pmdp); WARN_ON(!(pmd_write(pmd) && pmd_dirty(pmd))); - pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); - set_pmd_at(mm, vaddr, pmdp, pmd); pmdp_huge_get_and_clear_full(vma, vaddr, pmdp, 1); pmd = READ_ONCE(*pmdp); WARN_ON(!pmd_none(pmd)); + pmd = pmd_mkhuge(pfn_pmd(pfn, prot)); pmd = pmd_mkyoung(pmd); set_pmd_at(mm, vaddr, pmdp, pmd); pmdp_test_and_clear_young(vma, vaddr, pmdp);
set_pmd_at() should not be used to set a pte entry at locations that already holds a valid pte entry. Architectures like ppc64 don't do TLB invalidate in set_pmd_at() and hence expect it to be used to set locations that are not a valid PTE. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> --- mm/debug_vm_pgtable.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)