Skip to content

Commit 720da1e

Browse files
kvaneeshakpm00
authored andcommitted
mm/debug_vm_pgtable: fix BUG_ON with pud advanced test
Architectures like powerpc add debug checks to ensure we find only devmap PUD pte entries. These debug checks are only done with CONFIG_DEBUG_VM. This patch marks the ptes used for PUD advanced test devmap pte entries so that we don't hit on debug checks on architecture like ppc64 as below. WARNING: CPU: 2 PID: 1 at arch/powerpc/mm/book3s64/radix_pgtable.c:1382 radix__pud_hugepage_update+0x38/0x138 .... NIP [c0000000000a7004] radix__pud_hugepage_update+0x38/0x138 LR [c0000000000a77a8] radix__pudp_huge_get_and_clear+0x28/0x60 Call Trace: [c000000004a2f950] [c000000004a2f9a0] 0xc000000004a2f9a0 (unreliable) [c000000004a2f980] [000d34c100000000] 0xd34c100000000 [c000000004a2f9a0] [c00000000206ba98] pud_advanced_tests+0x118/0x334 [c000000004a2fa40] [c00000000206db34] debug_vm_pgtable+0xcbc/0x1c48 [c000000004a2fc10] [c00000000000fd28] do_one_initcall+0x60/0x388 Also kernel BUG at arch/powerpc/mm/book3s64/pgtable.c:202! .... NIP [c000000000096510] pudp_huge_get_and_clear_full+0x98/0x174 LR [c00000000206bb34] pud_advanced_tests+0x1b4/0x334 Call Trace: [c000000004a2f950] [000d34c100000000] 0xd34c100000000 (unreliable) [c000000004a2f9a0] [c00000000206bb34] pud_advanced_tests+0x1b4/0x334 [c000000004a2fa40] [c00000000206db34] debug_vm_pgtable+0xcbc/0x1c48 [c000000004a2fc10] [c00000000000fd28] do_one_initcall+0x60/0x388 Link: https://lkml.kernel.org/r/[email protected] Fixes: 27af67f ("powerpc/book3s64/mm: enable transparent pud hugepage") Signed-off-by: Aneesh Kumar K.V (IBM) <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3a75cb0 commit 720da1e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mm/debug_vm_pgtable.c

+8
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ static void __init pud_advanced_tests(struct pgtable_debug_args *args)
362362
vaddr &= HPAGE_PUD_MASK;
363363

364364
pud = pfn_pud(args->pud_pfn, args->page_prot);
365+
/*
366+
* Some architectures have debug checks to make sure
367+
* huge pud mapping are only found with devmap entries
368+
* For now test with only devmap entries.
369+
*/
370+
pud = pud_mkdevmap(pud);
365371
set_pud_at(args->mm, vaddr, args->pudp, pud);
366372
flush_dcache_page(page);
367373
pudp_set_wrprotect(args->mm, vaddr, args->pudp);
@@ -374,6 +380,7 @@ static void __init pud_advanced_tests(struct pgtable_debug_args *args)
374380
WARN_ON(!pud_none(pud));
375381
#endif /* __PAGETABLE_PMD_FOLDED */
376382
pud = pfn_pud(args->pud_pfn, args->page_prot);
383+
pud = pud_mkdevmap(pud);
377384
pud = pud_wrprotect(pud);
378385
pud = pud_mkclean(pud);
379386
set_pud_at(args->mm, vaddr, args->pudp, pud);
@@ -391,6 +398,7 @@ static void __init pud_advanced_tests(struct pgtable_debug_args *args)
391398
#endif /* __PAGETABLE_PMD_FOLDED */
392399

393400
pud = pfn_pud(args->pud_pfn, args->page_prot);
401+
pud = pud_mkdevmap(pud);
394402
pud = pud_mkyoung(pud);
395403
set_pud_at(args->mm, vaddr, args->pudp, pud);
396404
flush_dcache_page(page);

0 commit comments

Comments
 (0)