Lines Matching full:args

78 static void __init pte_basic_tests(struct pgtable_debug_args *args, int idx)  in pte_basic_tests()  argument
81 pte_t pte = pfn_pte(args->fixed_pte_pfn, prot); in pte_basic_tests()
98 WARN_ON(!pte_write(pte_mkwrite(pte_wrprotect(pte), args->vma))); in pte_basic_tests()
101 WARN_ON(pte_write(pte_wrprotect(pte_mkwrite(pte, args->vma)))); in pte_basic_tests()
106 static void __init pte_advanced_tests(struct pgtable_debug_args *args) in pte_advanced_tests() argument
122 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in pte_advanced_tests()
127 if (WARN_ON(!args->ptep)) in pte_advanced_tests()
130 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
131 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
133 ptep_set_wrprotect(args->mm, args->vaddr, args->ptep); in pte_advanced_tests()
134 pte = ptep_get(args->ptep); in pte_advanced_tests()
136 ptep_get_and_clear(args->mm, args->vaddr, args->ptep); in pte_advanced_tests()
137 pte = ptep_get(args->ptep); in pte_advanced_tests()
140 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
143 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
145 pte = pte_mkwrite(pte, args->vma); in pte_advanced_tests()
147 ptep_set_access_flags(args->vma, args->vaddr, args->ptep, pte, 1); in pte_advanced_tests()
148 pte = ptep_get(args->ptep); in pte_advanced_tests()
150 ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); in pte_advanced_tests()
151 pte = ptep_get(args->ptep); in pte_advanced_tests()
154 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
156 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
158 ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep); in pte_advanced_tests()
159 pte = ptep_get(args->ptep); in pte_advanced_tests()
162 ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); in pte_advanced_tests()
166 static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) in pmd_basic_tests() argument
176 pmd = pfn_pmd(args->fixed_pmd_pfn, prot); in pmd_basic_tests()
191 WARN_ON(!pmd_write(pmd_mkwrite(pmd_wrprotect(pmd), args->vma))); in pmd_basic_tests()
194 WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma)))); in pmd_basic_tests()
204 static void __init pmd_advanced_tests(struct pgtable_debug_args *args) in pmd_advanced_tests() argument
208 unsigned long vaddr = args->vaddr; in pmd_advanced_tests()
213 page = (args->pmd_pfn != ULONG_MAX) ? pfn_to_page(args->pmd_pfn) : NULL; in pmd_advanced_tests()
228 pgtable_trans_huge_deposit(args->mm, args->pmdp, args->start_ptep); in pmd_advanced_tests()
230 pmd = pfn_pmd(args->pmd_pfn, args->page_prot); in pmd_advanced_tests()
231 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
233 pmdp_set_wrprotect(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
234 pmd = pmdp_get(args->pmdp); in pmd_advanced_tests()
236 pmdp_huge_get_and_clear(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
237 pmd = pmdp_get(args->pmdp); in pmd_advanced_tests()
240 pmd = pfn_pmd(args->pmd_pfn, args->page_prot); in pmd_advanced_tests()
243 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
245 pmd = pmd_mkwrite(pmd, args->vma); in pmd_advanced_tests()
247 pmdp_set_access_flags(args->vma, vaddr, args->pmdp, pmd, 1); in pmd_advanced_tests()
248 pmd = pmdp_get(args->pmdp); in pmd_advanced_tests()
250 pmdp_huge_get_and_clear_full(args->vma, vaddr, args->pmdp, 1); in pmd_advanced_tests()
251 pmd = pmdp_get(args->pmdp); in pmd_advanced_tests()
254 pmd = pmd_mkhuge(pfn_pmd(args->pmd_pfn, args->page_prot)); in pmd_advanced_tests()
256 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
258 pmdp_test_and_clear_young(args->vma, vaddr, args->pmdp); in pmd_advanced_tests()
259 pmd = pmdp_get(args->pmdp); in pmd_advanced_tests()
263 pmdp_huge_get_and_clear(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
264 pgtable_trans_huge_withdraw(args->mm, args->pmdp); in pmd_advanced_tests()
267 static void __init pmd_leaf_tests(struct pgtable_debug_args *args) in pmd_leaf_tests() argument
275 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_leaf_tests()
285 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) in pud_basic_tests() argument
295 pud = pfn_pud(args->fixed_pud_pfn, prot); in pud_basic_tests()
316 if (mm_pmd_folded(args->mm)) in pud_basic_tests()
326 static void __init pud_advanced_tests(struct pgtable_debug_args *args) in pud_advanced_tests() argument
329 unsigned long vaddr = args->vaddr; in pud_advanced_tests()
335 page = (args->pud_pfn != ULONG_MAX) ? pfn_to_page(args->pud_pfn) : NULL; in pud_advanced_tests()
350 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
357 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
359 pudp_set_wrprotect(args->mm, vaddr, args->pudp); in pud_advanced_tests()
360 pud = pudp_get(args->pudp); in pud_advanced_tests()
364 pudp_huge_get_and_clear(args->mm, vaddr, args->pudp); in pud_advanced_tests()
365 pud = pudp_get(args->pudp); in pud_advanced_tests()
368 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
372 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
376 pudp_set_access_flags(args->vma, vaddr, args->pudp, pud, 1); in pud_advanced_tests()
377 pud = pudp_get(args->pudp); in pud_advanced_tests()
381 pudp_huge_get_and_clear_full(args->vma, vaddr, args->pudp, 1); in pud_advanced_tests()
382 pud = pudp_get(args->pudp); in pud_advanced_tests()
386 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
389 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
391 pudp_test_and_clear_young(args->vma, vaddr, args->pudp); in pud_advanced_tests()
392 pud = pudp_get(args->pudp); in pud_advanced_tests()
395 pudp_huge_get_and_clear(args->mm, vaddr, args->pudp); in pud_advanced_tests()
398 static void __init pud_leaf_tests(struct pgtable_debug_args *args) in pud_leaf_tests() argument
406 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_leaf_tests()
414 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { } in pud_basic_tests() argument
415 static void __init pud_advanced_tests(struct pgtable_debug_args *args) { } in pud_advanced_tests() argument
416 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { } in pud_leaf_tests() argument
419 static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) { } in pmd_basic_tests() argument
420 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { } in pud_basic_tests() argument
421 static void __init pmd_advanced_tests(struct pgtable_debug_args *args) { } in pmd_advanced_tests() argument
422 static void __init pud_advanced_tests(struct pgtable_debug_args *args) { } in pud_advanced_tests() argument
423 static void __init pmd_leaf_tests(struct pgtable_debug_args *args) { } in pmd_leaf_tests() argument
424 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { } in pud_leaf_tests() argument
428 static void __init pmd_huge_tests(struct pgtable_debug_args *args) in pmd_huge_tests() argument
432 if (!arch_vmap_pmd_supported(args->page_prot) || in pmd_huge_tests()
433 args->fixed_alignment < PMD_SIZE) in pmd_huge_tests()
441 WRITE_ONCE(*args->pmdp, __pmd(0)); in pmd_huge_tests()
442 WARN_ON(!pmd_set_huge(args->pmdp, __pfn_to_phys(args->fixed_pmd_pfn), args->page_prot)); in pmd_huge_tests()
443 WARN_ON(!pmd_clear_huge(args->pmdp)); in pmd_huge_tests()
444 pmd = pmdp_get(args->pmdp); in pmd_huge_tests()
448 static void __init pud_huge_tests(struct pgtable_debug_args *args) in pud_huge_tests() argument
452 if (!arch_vmap_pud_supported(args->page_prot) || in pud_huge_tests()
453 args->fixed_alignment < PUD_SIZE) in pud_huge_tests()
461 WRITE_ONCE(*args->pudp, __pud(0)); in pud_huge_tests()
462 WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn), args->page_prot)); in pud_huge_tests()
463 WARN_ON(!pud_clear_huge(args->pudp)); in pud_huge_tests()
464 pud = pudp_get(args->pudp); in pud_huge_tests()
468 static void __init pmd_huge_tests(struct pgtable_debug_args *args) { } in pmd_huge_tests() argument
469 static void __init pud_huge_tests(struct pgtable_debug_args *args) { } in pud_huge_tests() argument
472 static void __init p4d_basic_tests(struct pgtable_debug_args *args) in p4d_basic_tests() argument
481 static void __init pgd_basic_tests(struct pgtable_debug_args *args) in pgd_basic_tests() argument
491 static void __init pud_clear_tests(struct pgtable_debug_args *args) in pud_clear_tests() argument
493 pud_t pud = pudp_get(args->pudp); in pud_clear_tests()
495 if (mm_pmd_folded(args->mm)) in pud_clear_tests()
500 pud_clear(args->pudp); in pud_clear_tests()
501 pud = pudp_get(args->pudp); in pud_clear_tests()
505 static void __init pud_populate_tests(struct pgtable_debug_args *args) in pud_populate_tests() argument
509 if (mm_pmd_folded(args->mm)) in pud_populate_tests()
517 pud_populate(args->mm, args->pudp, args->start_pmdp); in pud_populate_tests()
518 pud = pudp_get(args->pudp); in pud_populate_tests()
522 static void __init pud_clear_tests(struct pgtable_debug_args *args) { } in pud_clear_tests() argument
523 static void __init pud_populate_tests(struct pgtable_debug_args *args) { } in pud_populate_tests() argument
527 static void __init p4d_clear_tests(struct pgtable_debug_args *args) in p4d_clear_tests() argument
529 p4d_t p4d = p4dp_get(args->p4dp); in p4d_clear_tests()
531 if (mm_pud_folded(args->mm)) in p4d_clear_tests()
536 p4d_clear(args->p4dp); in p4d_clear_tests()
537 p4d = p4dp_get(args->p4dp); in p4d_clear_tests()
541 static void __init p4d_populate_tests(struct pgtable_debug_args *args) in p4d_populate_tests() argument
545 if (mm_pud_folded(args->mm)) in p4d_populate_tests()
553 pud_clear(args->pudp); in p4d_populate_tests()
554 p4d_clear(args->p4dp); in p4d_populate_tests()
555 p4d_populate(args->mm, args->p4dp, args->start_pudp); in p4d_populate_tests()
556 p4d = p4dp_get(args->p4dp); in p4d_populate_tests()
560 static void __init pgd_clear_tests(struct pgtable_debug_args *args) in pgd_clear_tests() argument
562 pgd_t pgd = pgdp_get(args->pgdp); in pgd_clear_tests()
564 if (mm_p4d_folded(args->mm)) in pgd_clear_tests()
569 pgd_clear(args->pgdp); in pgd_clear_tests()
570 pgd = pgdp_get(args->pgdp); in pgd_clear_tests()
574 static void __init pgd_populate_tests(struct pgtable_debug_args *args) in pgd_populate_tests() argument
578 if (mm_p4d_folded(args->mm)) in pgd_populate_tests()
586 p4d_clear(args->p4dp); in pgd_populate_tests()
587 pgd_clear(args->pgdp); in pgd_populate_tests()
588 pgd_populate(args->mm, args->pgdp, args->start_p4dp); in pgd_populate_tests()
589 pgd = pgdp_get(args->pgdp); in pgd_populate_tests()
593 static void __init p4d_clear_tests(struct pgtable_debug_args *args) { } in p4d_clear_tests() argument
594 static void __init pgd_clear_tests(struct pgtable_debug_args *args) { } in pgd_clear_tests() argument
595 static void __init p4d_populate_tests(struct pgtable_debug_args *args) { } in p4d_populate_tests() argument
596 static void __init pgd_populate_tests(struct pgtable_debug_args *args) { } in pgd_populate_tests() argument
599 static void __init pte_clear_tests(struct pgtable_debug_args *args) in pte_clear_tests() argument
602 pte_t pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_clear_tests()
604 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in pte_clear_tests()
616 if (WARN_ON(!args->ptep)) in pte_clear_tests()
619 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_clear_tests()
623 ptep_clear(args->mm, args->vaddr, args->ptep); in pte_clear_tests()
624 pte = ptep_get(args->ptep); in pte_clear_tests()
628 static void __init pmd_clear_tests(struct pgtable_debug_args *args) in pmd_clear_tests() argument
630 pmd_t pmd = pmdp_get(args->pmdp); in pmd_clear_tests()
634 pmd_clear(args->pmdp); in pmd_clear_tests()
635 pmd = pmdp_get(args->pmdp); in pmd_clear_tests()
639 static void __init pmd_populate_tests(struct pgtable_debug_args *args) in pmd_populate_tests() argument
648 pmd_populate(args->mm, args->pmdp, args->start_ptep); in pmd_populate_tests()
649 pmd = pmdp_get(args->pmdp); in pmd_populate_tests()
653 static void __init pte_special_tests(struct pgtable_debug_args *args) in pte_special_tests() argument
655 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_special_tests()
664 static void __init pte_protnone_tests(struct pgtable_debug_args *args) in pte_protnone_tests() argument
666 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot_none); in pte_protnone_tests()
677 static void __init pmd_protnone_tests(struct pgtable_debug_args *args) in pmd_protnone_tests() argument
688 pmd = pmd_mkhuge(pfn_pmd(args->fixed_pmd_pfn, args->page_prot_none)); in pmd_protnone_tests()
693 static void __init pmd_protnone_tests(struct pgtable_debug_args *args) { } in pmd_protnone_tests() argument
697 static void __init pte_devmap_tests(struct pgtable_debug_args *args) in pte_devmap_tests() argument
699 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_devmap_tests()
706 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) in pmd_devmap_tests() argument
714 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_devmap_tests()
719 static void __init pud_devmap_tests(struct pgtable_debug_args *args) in pud_devmap_tests() argument
727 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_devmap_tests()
731 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
734 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { } in pmd_devmap_tests() argument
735 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
738 static void __init pte_devmap_tests(struct pgtable_debug_args *args) { } in pte_devmap_tests() argument
739 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { } in pmd_devmap_tests() argument
740 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
743 static void __init pte_soft_dirty_tests(struct pgtable_debug_args *args) in pte_soft_dirty_tests() argument
745 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_soft_dirty_tests()
755 static void __init pte_swap_soft_dirty_tests(struct pgtable_debug_args *args) in pte_swap_soft_dirty_tests() argument
757 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_swap_soft_dirty_tests()
768 static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args) in pmd_soft_dirty_tests() argument
779 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_soft_dirty_tests()
784 static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args) in pmd_swap_soft_dirty_tests() argument
796 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_swap_soft_dirty_tests()
801 static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args) { } in pmd_soft_dirty_tests() argument
802 static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args) { } in pmd_swap_soft_dirty_tests() argument
805 static void __init pte_swap_exclusive_tests(struct pgtable_debug_args *args) in pte_swap_exclusive_tests() argument
839 static void __init pte_swap_tests(struct pgtable_debug_args *args) in pte_swap_tests() argument
845 pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_swap_tests()
848 WARN_ON(args->fixed_pte_pfn != pte_pfn(pte)); in pte_swap_tests()
852 static void __init pmd_swap_tests(struct pgtable_debug_args *args) in pmd_swap_tests() argument
861 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_swap_tests()
864 WARN_ON(args->fixed_pmd_pfn != pmd_pfn(pmd)); in pmd_swap_tests()
867 static void __init pmd_swap_tests(struct pgtable_debug_args *args) { } in pmd_swap_tests() argument
870 static void __init swap_migration_tests(struct pgtable_debug_args *args) in swap_migration_tests() argument
885 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in swap_migration_tests()
911 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) in hugetlb_basic_tests() argument
921 page = pfn_to_page(args->fixed_pmd_pfn); in hugetlb_basic_tests()
922 pte = mk_huge_pte(page, args->page_prot); in hugetlb_basic_tests()
929 pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot); in hugetlb_basic_tests()
935 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { } in hugetlb_basic_tests() argument
939 static void __init pmd_thp_tests(struct pgtable_debug_args *args) in pmd_thp_tests() argument
958 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_thp_tests()
969 static void __init pud_thp_tests(struct pgtable_debug_args *args) in pud_thp_tests() argument
977 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_thp_tests()
989 static void __init pud_thp_tests(struct pgtable_debug_args *args) { } in pud_thp_tests() argument
992 static void __init pmd_thp_tests(struct pgtable_debug_args *args) { } in pmd_thp_tests() argument
993 static void __init pud_thp_tests(struct pgtable_debug_args *args) { } in pud_thp_tests() argument
1008 static void __init destroy_args(struct pgtable_debug_args *args) in destroy_args() argument
1015 args->pud_pfn != ULONG_MAX) { in destroy_args()
1016 if (args->is_contiguous_page) { in destroy_args()
1017 free_contig_range(args->pud_pfn, in destroy_args()
1020 page = pfn_to_page(args->pud_pfn); in destroy_args()
1024 args->pud_pfn = ULONG_MAX; in destroy_args()
1025 args->pmd_pfn = ULONG_MAX; in destroy_args()
1026 args->pte_pfn = ULONG_MAX; in destroy_args()
1031 args->pmd_pfn != ULONG_MAX) { in destroy_args()
1032 if (args->is_contiguous_page) { in destroy_args()
1033 free_contig_range(args->pmd_pfn, (1 << HPAGE_PMD_ORDER)); in destroy_args()
1035 page = pfn_to_page(args->pmd_pfn); in destroy_args()
1039 args->pmd_pfn = ULONG_MAX; in destroy_args()
1040 args->pte_pfn = ULONG_MAX; in destroy_args()
1043 if (args->pte_pfn != ULONG_MAX) { in destroy_args()
1044 page = pfn_to_page(args->pte_pfn); in destroy_args()
1047 args->pte_pfn = ULONG_MAX; in destroy_args()
1051 if (args->start_ptep) { in destroy_args()
1052 pte_free(args->mm, args->start_ptep); in destroy_args()
1053 mm_dec_nr_ptes(args->mm); in destroy_args()
1056 if (args->start_pmdp) { in destroy_args()
1057 pmd_free(args->mm, args->start_pmdp); in destroy_args()
1058 mm_dec_nr_pmds(args->mm); in destroy_args()
1061 if (args->start_pudp) { in destroy_args()
1062 pud_free(args->mm, args->start_pudp); in destroy_args()
1063 mm_dec_nr_puds(args->mm); in destroy_args()
1066 if (args->start_p4dp) in destroy_args()
1067 p4d_free(args->mm, args->start_p4dp); in destroy_args()
1070 if (args->vma) in destroy_args()
1071 vm_area_free(args->vma); in destroy_args()
1073 if (args->mm) in destroy_args()
1074 mmdrop(args->mm); in destroy_args()
1078 debug_vm_pgtable_alloc_huge_page(struct pgtable_debug_args *args, int order) in debug_vm_pgtable_alloc_huge_page() argument
1087 args->is_contiguous_page = true; in debug_vm_pgtable_alloc_huge_page()
1124 static void __init init_fixed_pfns(struct pgtable_debug_args *args) in init_fixed_pfns() argument
1146 args->fixed_alignment = PAGE_SIZE; in init_fixed_pfns()
1151 &args->fixed_alignment); in init_fixed_pfns()
1154 if (args->fixed_alignment == PUD_SIZE) in init_fixed_pfns()
1161 if (args->fixed_alignment < PMD_SIZE) in init_fixed_pfns()
1163 &args->fixed_alignment); in init_fixed_pfns()
1166 args->fixed_pgd_pfn = __phys_to_pfn(phys & PGDIR_MASK); in init_fixed_pfns()
1167 args->fixed_p4d_pfn = __phys_to_pfn(phys & P4D_MASK); in init_fixed_pfns()
1168 args->fixed_pud_pfn = __phys_to_pfn(phys & PUD_MASK); in init_fixed_pfns()
1169 args->fixed_pmd_pfn = __phys_to_pfn(phys & PMD_MASK); in init_fixed_pfns()
1170 args->fixed_pte_pfn = __phys_to_pfn(phys & PAGE_MASK); in init_fixed_pfns()
1171 WARN_ON(!pfn_valid(args->fixed_pte_pfn)); in init_fixed_pfns()
1175 static int __init init_args(struct pgtable_debug_args *args) in init_args() argument
1187 memset(args, 0, sizeof(*args)); in init_args()
1188 args->vaddr = get_random_vaddr(); in init_args()
1189 args->page_prot = vm_get_page_prot(VM_ACCESS_FLAGS); in init_args()
1190 args->page_prot_none = vm_get_page_prot(VM_NONE); in init_args()
1191 args->is_contiguous_page = false; in init_args()
1192 args->pud_pfn = ULONG_MAX; in init_args()
1193 args->pmd_pfn = ULONG_MAX; in init_args()
1194 args->pte_pfn = ULONG_MAX; in init_args()
1195 args->fixed_pgd_pfn = ULONG_MAX; in init_args()
1196 args->fixed_p4d_pfn = ULONG_MAX; in init_args()
1197 args->fixed_pud_pfn = ULONG_MAX; in init_args()
1198 args->fixed_pmd_pfn = ULONG_MAX; in init_args()
1199 args->fixed_pte_pfn = ULONG_MAX; in init_args()
1202 args->mm = mm_alloc(); in init_args()
1203 if (!args->mm) { in init_args()
1209 args->vma = vm_area_alloc(args->mm); in init_args()
1210 if (!args->vma) { in init_args()
1221 args->pgdp = pgd_offset(args->mm, args->vaddr); in init_args()
1222 args->p4dp = p4d_alloc(args->mm, args->pgdp, args->vaddr); in init_args()
1223 if (!args->p4dp) { in init_args()
1228 args->start_p4dp = p4d_offset(args->pgdp, 0UL); in init_args()
1229 WARN_ON(!args->start_p4dp); in init_args()
1231 args->pudp = pud_alloc(args->mm, args->p4dp, args->vaddr); in init_args()
1232 if (!args->pudp) { in init_args()
1237 args->start_pudp = pud_offset(args->p4dp, 0UL); in init_args()
1238 WARN_ON(!args->start_pudp); in init_args()
1240 args->pmdp = pmd_alloc(args->mm, args->pudp, args->vaddr); in init_args()
1241 if (!args->pmdp) { in init_args()
1246 args->start_pmdp = pmd_offset(args->pudp, 0UL); in init_args()
1247 WARN_ON(!args->start_pmdp); in init_args()
1249 if (pte_alloc(args->mm, args->pmdp)) { in init_args()
1254 args->start_ptep = pmd_pgtable(pmdp_get(args->pmdp)); in init_args()
1255 WARN_ON(!args->start_ptep); in init_args()
1257 init_fixed_pfns(args); in init_args()
1266 page = debug_vm_pgtable_alloc_huge_page(args, in init_args()
1269 args->pud_pfn = page_to_pfn(page); in init_args()
1270 args->pmd_pfn = args->pud_pfn; in init_args()
1271 args->pte_pfn = args->pud_pfn; in init_args()
1278 page = debug_vm_pgtable_alloc_huge_page(args, HPAGE_PMD_ORDER); in init_args()
1280 args->pmd_pfn = page_to_pfn(page); in init_args()
1281 args->pte_pfn = args->pmd_pfn; in init_args()
1288 args->pte_pfn = page_to_pfn(page); in init_args()
1293 destroy_args(args); in init_args()
1299 struct pgtable_debug_args args; in debug_vm_pgtable() local
1304 ret = init_args(&args); in debug_vm_pgtable()
1322 pte_basic_tests(&args, idx); in debug_vm_pgtable()
1323 pmd_basic_tests(&args, idx); in debug_vm_pgtable()
1324 pud_basic_tests(&args, idx); in debug_vm_pgtable()
1334 p4d_basic_tests(&args); in debug_vm_pgtable()
1335 pgd_basic_tests(&args); in debug_vm_pgtable()
1337 pmd_leaf_tests(&args); in debug_vm_pgtable()
1338 pud_leaf_tests(&args); in debug_vm_pgtable()
1340 pte_special_tests(&args); in debug_vm_pgtable()
1341 pte_protnone_tests(&args); in debug_vm_pgtable()
1342 pmd_protnone_tests(&args); in debug_vm_pgtable()
1344 pte_devmap_tests(&args); in debug_vm_pgtable()
1345 pmd_devmap_tests(&args); in debug_vm_pgtable()
1346 pud_devmap_tests(&args); in debug_vm_pgtable()
1348 pte_soft_dirty_tests(&args); in debug_vm_pgtable()
1349 pmd_soft_dirty_tests(&args); in debug_vm_pgtable()
1350 pte_swap_soft_dirty_tests(&args); in debug_vm_pgtable()
1351 pmd_swap_soft_dirty_tests(&args); in debug_vm_pgtable()
1353 pte_swap_exclusive_tests(&args); in debug_vm_pgtable()
1355 pte_swap_tests(&args); in debug_vm_pgtable()
1356 pmd_swap_tests(&args); in debug_vm_pgtable()
1358 swap_migration_tests(&args); in debug_vm_pgtable()
1360 pmd_thp_tests(&args); in debug_vm_pgtable()
1361 pud_thp_tests(&args); in debug_vm_pgtable()
1363 hugetlb_basic_tests(&args); in debug_vm_pgtable()
1370 args.ptep = pte_offset_map_lock(args.mm, args.pmdp, args.vaddr, &ptl); in debug_vm_pgtable()
1371 pte_clear_tests(&args); in debug_vm_pgtable()
1372 pte_advanced_tests(&args); in debug_vm_pgtable()
1373 if (args.ptep) in debug_vm_pgtable()
1374 pte_unmap_unlock(args.ptep, ptl); in debug_vm_pgtable()
1376 ptl = pmd_lock(args.mm, args.pmdp); in debug_vm_pgtable()
1377 pmd_clear_tests(&args); in debug_vm_pgtable()
1378 pmd_advanced_tests(&args); in debug_vm_pgtable()
1379 pmd_huge_tests(&args); in debug_vm_pgtable()
1380 pmd_populate_tests(&args); in debug_vm_pgtable()
1383 ptl = pud_lock(args.mm, args.pudp); in debug_vm_pgtable()
1384 pud_clear_tests(&args); in debug_vm_pgtable()
1385 pud_advanced_tests(&args); in debug_vm_pgtable()
1386 pud_huge_tests(&args); in debug_vm_pgtable()
1387 pud_populate_tests(&args); in debug_vm_pgtable()
1390 spin_lock(&(args.mm->page_table_lock)); in debug_vm_pgtable()
1391 p4d_clear_tests(&args); in debug_vm_pgtable()
1392 pgd_clear_tests(&args); in debug_vm_pgtable()
1393 p4d_populate_tests(&args); in debug_vm_pgtable()
1394 pgd_populate_tests(&args); in debug_vm_pgtable()
1395 spin_unlock(&(args.mm->page_table_lock)); in debug_vm_pgtable()
1397 destroy_args(&args); in debug_vm_pgtable()