powerpc: Fix bad pmd error with book3E config
PATCH 1/1 powerpc: Fix bad pmd error with book3E config
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the pmd_bad check throws error. Infact the current code will never take the free_hugepd_range call at all because it will clear the pmd if it find a hugepd pointer.
--- arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
arch/powerpc/mm/hugetlbpage.c +18 -11
@@ -536,19 +536,26 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,do { pmd =pmd_offset (pud, addr); next =pmd_addr_end (addr, end); -if (pmd_none_or_clear_bad (pmd)) -continue ; +if (!is_hugepd (pmd)) { +/* +* if it is not hugepd pointer, we should already find +* it cleared. +*/ +if (!pmd_none_or_clear_bad (pmd)) +WARN_ON (1 ); + }else {#ifdef CONFIG_PPC_FSL_BOOK3E -/* -* Increment next by the size of the huge mapping since -* there may be more than one entry at this level for a -* single hugepage, but all of them point to -* the same kmem cache that holds the hugepte. -*/ - next = addr + (1 <<hugepd_shift (*(hugepd_t *)pmd)); +/* +* Increment next by the size of the huge mapping since +* there may be more than one entry at this level for a +* single hugepage, but all of them point to +* the same kmem cache that holds the hugepte. +*/ + next = addr + (1 <<hugepd_shift (*(hugepd_t *)pmd));#endif -free_hugepd_range (tlb, (hugepd_t *)pmd,PMD_SHIFT , - addr, next, floor, ceiling); +free_hugepd_range (tlb, (hugepd_t *)pmd,PMD_SHIFT , + addr, next, floor, ceiling); + } }while (addr = next, addr != end); start &=PUD_MASK ;
Signature · 1 line
1.8.1.2
Quoted 8 lines · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the
pmd_badcheck throws error. Infact the current code will never take thefree_hugepd_rangecall at all because it will clear the pmd if it find a hugepd pointer.
Quoted 5 lines
Reported-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
Thanks; this fixes the error for me.
-Scott
Quoted 10 lines · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the
pmd_badcheck throws error. Infact the current code will never take thefree_hugepd_rangecall at all because it will clear the pmd if it find a hugepd pointer.Reported-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>
Ben,
This is regression introduced by e2b3d202d1dba8f3546ed28224ce485bc50010be
"powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format"
and should go upstream in 3.10
$git describe --contains e2b3d202d1dba8f3546ed28224ce485bc50010be v3.10-rc1~121^2~15
Without this path, we leak hugepd with all subarchs using old huge page directory format.
-aneesh
Quoted 8 lines · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the
pmd_badcheck throws error. Infact the current code will never take thefree_hugepd_rangecall at all because it will clear the pmd if it find a hugepd pointer.
Please explain what changes you are making. Currently you are only describing what the issue is.
Also include which the SHA1 which caused the regression (ie e2b3d202d1dba8f3546ed28224ce485bc50010be "powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format")
Mikey
Quoted 13 lines
Reported-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)arch/powerpc/mm/hugetlbpage.c +0
-0@@ -536,19 +536,26 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, do { pmd = pmd_offset(pud, addr);
arch/powerpc/mm/hugetlbpage.c static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, · line 545
Quoted 10 lines
arch/powerpc/mm/hugetlbpage.c +7
-2next =pmd_addr_end (addr, end); -if (pmd_none_or_clear_bad (pmd)) -continue ; +if (!is_hugepd (pmd)) { +/* +* if it is not hugepd pointer, we should already find +* it cleared. +*/ +if (!pmd_none_or_clear_bad (pmd)) +WARN_ON (1 );
How often are we going to hit this? Should this be a warn_on once or
even a bug_on?
Also just make it:
WARN_ON(!pmd_none_or_clear_bad(pmd))
Mikey
Quoted 33 lines
arch/powerpc/mm/hugetlbpage.c +11
-9+ }else {#ifdef CONFIG_PPC_FSL_BOOK3E -/* -* Increment next by the size of the huge mapping since -* there may be more than one entry at this level for a -* single hugepage, but all of them point to -* the same kmem cache that holds the hugepte. -*/ - next = addr + (1 <<hugepd_shift (*(hugepd_t *)pmd)); +/* +* Increment next by the size of the huge mapping since +* there may be more than one entry at this level for a +* single hugepage, but all of them point to +* the same kmem cache that holds the hugepte. +*/ + next = addr + (1 <<hugepd_shift (*(hugepd_t *)pmd));#endif -free_hugepd_range (tlb, (hugepd_t *)pmd,PMD_SHIFT , - addr, next, floor, ceiling); +free_hugepd_range (tlb, (hugepd_t *)pmd,PMD_SHIFT , + addr, next, floor, ceiling); + } }while (addr = next, addr != end); start &=PUD_MASK ;Signature · 6 lines
1.8.1.2 _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 11 lines · Michael Neuling
Quoted 8 lines · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the
pmd_badcheck throws error. Infact the current code will never take thefree_hugepd_rangecall at all because it will clear the pmd if it find a hugepd pointer.
Quoted 2 lines
Please explain what changes you are making. Currently you are only describing what the issue is.
will do
Quoted 4 lines
Also include which the SHA1 which caused the regression (ie
e2b3d202d1dba8f3546ed28224ce485bc50010be"powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format")
will add
Quoted 21 lines
Mikey
Quoted 18 lines
Reported-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)arch/powerpc/mm/hugetlbpage.c +2
-2@@ -536,19 +536,26 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, do { pmd = pmd_offset(pud, addr); next = pmd_addr_end(addr, end); - if (pmd_none_or_clear_bad(pmd)) - continue; + if (!is_hugepd(pmd)) { + /*
Quoted 8 lines
arch/powerpc/mm/hugetlbpage.c static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, · line 545
Quoted 5 lines
arch/powerpc/mm/hugetlbpage.c +5
-0+* if it is not hugepd pointer, we should already find +* it cleared. +*/ +if (!pmd_none_or_clear_bad (pmd)) +WARN_ON (1 );How often are we going to hit this? Should this be a
warn_ononce or
even abug_on?
it should never happen. But i was thinking killing the system may a bit too much, hence WARN_ON
Quoted 4 lines
Also just make it:
WARN_ON(!pmd_none_or_clear_bad(pmd))
will do
-aneesh
Quoted 55 lines · Aneesh Kumar K.V
Quoted 11 lines · Michael Neuling
Quoted 8 lines · Aneesh Kumar K.V
From: "Aneesh Kumar K.V" <[email protected]>
Book3E uses the hugepd at PMD level and don't encode pte directly at the pmd level. So it will find the lower bits of pmd set and the
pmd_badcheck throws error. Infact the current code will never take thefree_hugepd_rangecall at all because it will clear the pmd if it find a hugepd pointer.Quoted 2 lines
Please explain what changes you are making. Currently you are only describing what the issue is.
will do
Quoted 4 lines
Also include which the SHA1 which caused the regression (ie
e2b3d202d1dba8f3546ed28224ce485bc50010be"powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format")will add
Quoted 21 lines
Mikey
Quoted 18 lines
Reported-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)arch/powerpc/mm/hugetlbpage.c +2
-2@@ -536,19 +536,26 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, do { pmd = pmd_offset(pud, addr); next = pmd_addr_end(addr, end); - if (pmd_none_or_clear_bad(pmd)) - continue; + if (!is_hugepd(pmd)) { + /*Quoted 8 lines
arch/powerpc/mm/hugetlbpage.c static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, · line 545
Quoted 5 lines
arch/powerpc/mm/hugetlbpage.c +5
-0+* if it is not hugepd pointer, we should already find +* it cleared. +*/ +if (!pmd_none_or_clear_bad (pmd)) +WARN_ON (1 );How often are we going to hit this? Should this be a
warn_ononce or
even abug_on?
Quoted 2 lines
it should never happen. But i was thinking killing the system may a bit too much, hence
WARN_ON
Maybe WARN_ON_ONCE. If you do hit it once, you are going to hit it a lot?
Mikey
Quoted 10 lines
Quoted 5 lines
Also just make it:
WARN_ON(!pmd_none_or_clear_bad(pmd))will do
-aneesh