Lines Matching refs:args
77 static void __init pte_basic_tests(struct pgtable_debug_args *args, int idx) in pte_basic_tests() argument
80 pte_t pte = pfn_pte(args->fixed_pte_pfn, prot); in pte_basic_tests()
97 WARN_ON(!pte_write(pte_mkwrite(pte_wrprotect(pte), args->vma))); in pte_basic_tests()
100 WARN_ON(pte_write(pte_wrprotect(pte_mkwrite(pte, args->vma)))); in pte_basic_tests()
105 static void __init pte_advanced_tests(struct pgtable_debug_args *args) in pte_advanced_tests() argument
121 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in pte_advanced_tests()
126 if (WARN_ON(!args->ptep)) in pte_advanced_tests()
129 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
130 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
132 ptep_set_wrprotect(args->mm, args->vaddr, args->ptep); in pte_advanced_tests()
133 pte = ptep_get(args->ptep); in pte_advanced_tests()
135 ptep_get_and_clear(args->mm, args->vaddr, args->ptep); in pte_advanced_tests()
136 pte = ptep_get(args->ptep); in pte_advanced_tests()
139 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
142 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
144 pte = pte_mkwrite(pte, args->vma); in pte_advanced_tests()
146 ptep_set_access_flags(args->vma, args->vaddr, args->ptep, pte, 1); in pte_advanced_tests()
147 pte = ptep_get(args->ptep); in pte_advanced_tests()
149 ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); in pte_advanced_tests()
150 pte = ptep_get(args->ptep); in pte_advanced_tests()
153 pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_advanced_tests()
155 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_advanced_tests()
157 ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep); in pte_advanced_tests()
158 pte = ptep_get(args->ptep); in pte_advanced_tests()
161 ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1); in pte_advanced_tests()
165 static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) in pmd_basic_tests() argument
175 pmd = pfn_pmd(args->fixed_pmd_pfn, prot); in pmd_basic_tests()
190 WARN_ON(!pmd_write(pmd_mkwrite(pmd_wrprotect(pmd), args->vma))); in pmd_basic_tests()
193 WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma)))); in pmd_basic_tests()
203 static void __init pmd_advanced_tests(struct pgtable_debug_args *args) in pmd_advanced_tests() argument
207 unsigned long vaddr = args->vaddr; in pmd_advanced_tests()
212 page = (args->pmd_pfn != ULONG_MAX) ? pfn_to_page(args->pmd_pfn) : NULL; in pmd_advanced_tests()
227 pgtable_trans_huge_deposit(args->mm, args->pmdp, args->start_ptep); in pmd_advanced_tests()
229 pmd = pfn_pmd(args->pmd_pfn, args->page_prot); in pmd_advanced_tests()
230 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
232 pmdp_set_wrprotect(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
233 pmd = READ_ONCE(*args->pmdp); in pmd_advanced_tests()
235 pmdp_huge_get_and_clear(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
236 pmd = READ_ONCE(*args->pmdp); in pmd_advanced_tests()
239 pmd = pfn_pmd(args->pmd_pfn, args->page_prot); in pmd_advanced_tests()
242 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
244 pmd = pmd_mkwrite(pmd, args->vma); in pmd_advanced_tests()
246 pmdp_set_access_flags(args->vma, vaddr, args->pmdp, pmd, 1); in pmd_advanced_tests()
247 pmd = READ_ONCE(*args->pmdp); in pmd_advanced_tests()
249 pmdp_huge_get_and_clear_full(args->vma, vaddr, args->pmdp, 1); in pmd_advanced_tests()
250 pmd = READ_ONCE(*args->pmdp); in pmd_advanced_tests()
253 pmd = pmd_mkhuge(pfn_pmd(args->pmd_pfn, args->page_prot)); in pmd_advanced_tests()
255 set_pmd_at(args->mm, vaddr, args->pmdp, pmd); in pmd_advanced_tests()
257 pmdp_test_and_clear_young(args->vma, vaddr, args->pmdp); in pmd_advanced_tests()
258 pmd = READ_ONCE(*args->pmdp); in pmd_advanced_tests()
262 pmdp_huge_get_and_clear(args->mm, vaddr, args->pmdp); in pmd_advanced_tests()
263 pgtable_trans_huge_withdraw(args->mm, args->pmdp); in pmd_advanced_tests()
266 static void __init pmd_leaf_tests(struct pgtable_debug_args *args) in pmd_leaf_tests() argument
274 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_leaf_tests()
284 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) in pud_basic_tests() argument
294 pud = pfn_pud(args->fixed_pud_pfn, prot); in pud_basic_tests()
315 if (mm_pmd_folded(args->mm)) in pud_basic_tests()
325 static void __init pud_advanced_tests(struct pgtable_debug_args *args) in pud_advanced_tests() argument
328 unsigned long vaddr = args->vaddr; in pud_advanced_tests()
334 page = (args->pud_pfn != ULONG_MAX) ? pfn_to_page(args->pud_pfn) : NULL; in pud_advanced_tests()
349 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
356 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
358 pudp_set_wrprotect(args->mm, vaddr, args->pudp); in pud_advanced_tests()
359 pud = READ_ONCE(*args->pudp); in pud_advanced_tests()
363 pudp_huge_get_and_clear(args->mm, vaddr, args->pudp); in pud_advanced_tests()
364 pud = READ_ONCE(*args->pudp); in pud_advanced_tests()
367 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
371 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
375 pudp_set_access_flags(args->vma, vaddr, args->pudp, pud, 1); in pud_advanced_tests()
376 pud = READ_ONCE(*args->pudp); in pud_advanced_tests()
380 pudp_huge_get_and_clear_full(args->vma, vaddr, args->pudp, 1); in pud_advanced_tests()
381 pud = READ_ONCE(*args->pudp); in pud_advanced_tests()
385 pud = pfn_pud(args->pud_pfn, args->page_prot); in pud_advanced_tests()
388 set_pud_at(args->mm, vaddr, args->pudp, pud); in pud_advanced_tests()
390 pudp_test_and_clear_young(args->vma, vaddr, args->pudp); in pud_advanced_tests()
391 pud = READ_ONCE(*args->pudp); in pud_advanced_tests()
394 pudp_huge_get_and_clear(args->mm, vaddr, args->pudp); in pud_advanced_tests()
397 static void __init pud_leaf_tests(struct pgtable_debug_args *args) in pud_leaf_tests() argument
405 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_leaf_tests()
413 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { } in pud_basic_tests() argument
414 static void __init pud_advanced_tests(struct pgtable_debug_args *args) { } in pud_advanced_tests() argument
415 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { } in pud_leaf_tests() argument
418 static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx) { } in pmd_basic_tests() argument
419 static void __init pud_basic_tests(struct pgtable_debug_args *args, int idx) { } in pud_basic_tests() argument
420 static void __init pmd_advanced_tests(struct pgtable_debug_args *args) { } in pmd_advanced_tests() argument
421 static void __init pud_advanced_tests(struct pgtable_debug_args *args) { } in pud_advanced_tests() argument
422 static void __init pmd_leaf_tests(struct pgtable_debug_args *args) { } in pmd_leaf_tests() argument
423 static void __init pud_leaf_tests(struct pgtable_debug_args *args) { } in pud_leaf_tests() argument
427 static void __init pmd_huge_tests(struct pgtable_debug_args *args) in pmd_huge_tests() argument
431 if (!arch_vmap_pmd_supported(args->page_prot) || in pmd_huge_tests()
432 args->fixed_alignment < PMD_SIZE) in pmd_huge_tests()
440 WRITE_ONCE(*args->pmdp, __pmd(0)); in pmd_huge_tests()
441 WARN_ON(!pmd_set_huge(args->pmdp, __pfn_to_phys(args->fixed_pmd_pfn), args->page_prot)); in pmd_huge_tests()
442 WARN_ON(!pmd_clear_huge(args->pmdp)); in pmd_huge_tests()
443 pmd = READ_ONCE(*args->pmdp); in pmd_huge_tests()
447 static void __init pud_huge_tests(struct pgtable_debug_args *args) in pud_huge_tests() argument
451 if (!arch_vmap_pud_supported(args->page_prot) || in pud_huge_tests()
452 args->fixed_alignment < PUD_SIZE) in pud_huge_tests()
460 WRITE_ONCE(*args->pudp, __pud(0)); in pud_huge_tests()
461 WARN_ON(!pud_set_huge(args->pudp, __pfn_to_phys(args->fixed_pud_pfn), args->page_prot)); in pud_huge_tests()
462 WARN_ON(!pud_clear_huge(args->pudp)); in pud_huge_tests()
463 pud = READ_ONCE(*args->pudp); in pud_huge_tests()
467 static void __init pmd_huge_tests(struct pgtable_debug_args *args) { } in pmd_huge_tests() argument
468 static void __init pud_huge_tests(struct pgtable_debug_args *args) { } in pud_huge_tests() argument
471 static void __init p4d_basic_tests(struct pgtable_debug_args *args) in p4d_basic_tests() argument
480 static void __init pgd_basic_tests(struct pgtable_debug_args *args) in pgd_basic_tests() argument
490 static void __init pud_clear_tests(struct pgtable_debug_args *args) in pud_clear_tests() argument
492 pud_t pud = READ_ONCE(*args->pudp); in pud_clear_tests()
494 if (mm_pmd_folded(args->mm)) in pud_clear_tests()
499 pud_clear(args->pudp); in pud_clear_tests()
500 pud = READ_ONCE(*args->pudp); in pud_clear_tests()
504 static void __init pud_populate_tests(struct pgtable_debug_args *args) in pud_populate_tests() argument
508 if (mm_pmd_folded(args->mm)) in pud_populate_tests()
516 pud_populate(args->mm, args->pudp, args->start_pmdp); in pud_populate_tests()
517 pud = READ_ONCE(*args->pudp); in pud_populate_tests()
521 static void __init pud_clear_tests(struct pgtable_debug_args *args) { } in pud_clear_tests() argument
522 static void __init pud_populate_tests(struct pgtable_debug_args *args) { } in pud_populate_tests() argument
526 static void __init p4d_clear_tests(struct pgtable_debug_args *args) in p4d_clear_tests() argument
528 p4d_t p4d = READ_ONCE(*args->p4dp); in p4d_clear_tests()
530 if (mm_pud_folded(args->mm)) in p4d_clear_tests()
535 p4d_clear(args->p4dp); in p4d_clear_tests()
536 p4d = READ_ONCE(*args->p4dp); in p4d_clear_tests()
540 static void __init p4d_populate_tests(struct pgtable_debug_args *args) in p4d_populate_tests() argument
544 if (mm_pud_folded(args->mm)) in p4d_populate_tests()
552 pud_clear(args->pudp); in p4d_populate_tests()
553 p4d_clear(args->p4dp); in p4d_populate_tests()
554 p4d_populate(args->mm, args->p4dp, args->start_pudp); in p4d_populate_tests()
555 p4d = READ_ONCE(*args->p4dp); in p4d_populate_tests()
559 static void __init pgd_clear_tests(struct pgtable_debug_args *args) in pgd_clear_tests() argument
561 pgd_t pgd = READ_ONCE(*(args->pgdp)); in pgd_clear_tests()
563 if (mm_p4d_folded(args->mm)) in pgd_clear_tests()
568 pgd_clear(args->pgdp); in pgd_clear_tests()
569 pgd = READ_ONCE(*args->pgdp); in pgd_clear_tests()
573 static void __init pgd_populate_tests(struct pgtable_debug_args *args) in pgd_populate_tests() argument
577 if (mm_p4d_folded(args->mm)) in pgd_populate_tests()
585 p4d_clear(args->p4dp); in pgd_populate_tests()
586 pgd_clear(args->pgdp); in pgd_populate_tests()
587 pgd_populate(args->mm, args->pgdp, args->start_p4dp); in pgd_populate_tests()
588 pgd = READ_ONCE(*args->pgdp); in pgd_populate_tests()
592 static void __init p4d_clear_tests(struct pgtable_debug_args *args) { } in p4d_clear_tests() argument
593 static void __init pgd_clear_tests(struct pgtable_debug_args *args) { } in pgd_clear_tests() argument
594 static void __init p4d_populate_tests(struct pgtable_debug_args *args) { } in p4d_populate_tests() argument
595 static void __init pgd_populate_tests(struct pgtable_debug_args *args) { } in pgd_populate_tests() argument
598 static void __init pte_clear_tests(struct pgtable_debug_args *args) in pte_clear_tests() argument
601 pte_t pte = pfn_pte(args->pte_pfn, args->page_prot); in pte_clear_tests()
603 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in pte_clear_tests()
615 if (WARN_ON(!args->ptep)) in pte_clear_tests()
618 set_pte_at(args->mm, args->vaddr, args->ptep, pte); in pte_clear_tests()
622 ptep_clear(args->mm, args->vaddr, args->ptep); in pte_clear_tests()
623 pte = ptep_get(args->ptep); in pte_clear_tests()
627 static void __init pmd_clear_tests(struct pgtable_debug_args *args) in pmd_clear_tests() argument
629 pmd_t pmd = READ_ONCE(*args->pmdp); in pmd_clear_tests()
633 pmd_clear(args->pmdp); in pmd_clear_tests()
634 pmd = READ_ONCE(*args->pmdp); in pmd_clear_tests()
638 static void __init pmd_populate_tests(struct pgtable_debug_args *args) in pmd_populate_tests() argument
647 pmd_populate(args->mm, args->pmdp, args->start_ptep); in pmd_populate_tests()
648 pmd = READ_ONCE(*args->pmdp); in pmd_populate_tests()
652 static void __init pte_special_tests(struct pgtable_debug_args *args) in pte_special_tests() argument
654 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_special_tests()
663 static void __init pte_protnone_tests(struct pgtable_debug_args *args) in pte_protnone_tests() argument
665 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot_none); in pte_protnone_tests()
676 static void __init pmd_protnone_tests(struct pgtable_debug_args *args) in pmd_protnone_tests() argument
687 pmd = pmd_mkhuge(pfn_pmd(args->fixed_pmd_pfn, args->page_prot_none)); in pmd_protnone_tests()
692 static void __init pmd_protnone_tests(struct pgtable_debug_args *args) { } in pmd_protnone_tests() argument
696 static void __init pte_devmap_tests(struct pgtable_debug_args *args) in pte_devmap_tests() argument
698 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_devmap_tests()
705 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) in pmd_devmap_tests() argument
713 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_devmap_tests()
718 static void __init pud_devmap_tests(struct pgtable_debug_args *args) in pud_devmap_tests() argument
726 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_devmap_tests()
730 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
733 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { } in pmd_devmap_tests() argument
734 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
737 static void __init pte_devmap_tests(struct pgtable_debug_args *args) { } in pte_devmap_tests() argument
738 static void __init pmd_devmap_tests(struct pgtable_debug_args *args) { } in pmd_devmap_tests() argument
739 static void __init pud_devmap_tests(struct pgtable_debug_args *args) { } in pud_devmap_tests() argument
742 static void __init pte_soft_dirty_tests(struct pgtable_debug_args *args) in pte_soft_dirty_tests() argument
744 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_soft_dirty_tests()
754 static void __init pte_swap_soft_dirty_tests(struct pgtable_debug_args *args) in pte_swap_soft_dirty_tests() argument
756 pte_t pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_swap_soft_dirty_tests()
767 static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args) in pmd_soft_dirty_tests() argument
778 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_soft_dirty_tests()
783 static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args) in pmd_swap_soft_dirty_tests() argument
795 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_swap_soft_dirty_tests()
800 static void __init pmd_soft_dirty_tests(struct pgtable_debug_args *args) { } in pmd_soft_dirty_tests() argument
801 static void __init pmd_swap_soft_dirty_tests(struct pgtable_debug_args *args) { } in pmd_swap_soft_dirty_tests() argument
804 static void __init pte_swap_exclusive_tests(struct pgtable_debug_args *args) in pte_swap_exclusive_tests() argument
838 static void __init pte_swap_tests(struct pgtable_debug_args *args) in pte_swap_tests() argument
844 pte = pfn_pte(args->fixed_pte_pfn, args->page_prot); in pte_swap_tests()
847 WARN_ON(args->fixed_pte_pfn != pte_pfn(pte)); in pte_swap_tests()
851 static void __init pmd_swap_tests(struct pgtable_debug_args *args) in pmd_swap_tests() argument
860 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_swap_tests()
863 WARN_ON(args->fixed_pmd_pfn != pmd_pfn(pmd)); in pmd_swap_tests()
866 static void __init pmd_swap_tests(struct pgtable_debug_args *args) { } in pmd_swap_tests() argument
869 static void __init swap_migration_tests(struct pgtable_debug_args *args) in swap_migration_tests() argument
884 page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; in swap_migration_tests()
910 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) in hugetlb_basic_tests() argument
920 page = pfn_to_page(args->fixed_pmd_pfn); in hugetlb_basic_tests()
921 pte = mk_huge_pte(page, args->page_prot); in hugetlb_basic_tests()
928 pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot); in hugetlb_basic_tests()
934 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { } in hugetlb_basic_tests() argument
938 static void __init pmd_thp_tests(struct pgtable_debug_args *args) in pmd_thp_tests() argument
957 pmd = pfn_pmd(args->fixed_pmd_pfn, args->page_prot); in pmd_thp_tests()
967 static void __init pud_thp_tests(struct pgtable_debug_args *args) in pud_thp_tests() argument
975 pud = pfn_pud(args->fixed_pud_pfn, args->page_prot); in pud_thp_tests()
987 static void __init pud_thp_tests(struct pgtable_debug_args *args) { } in pud_thp_tests() argument
990 static void __init pmd_thp_tests(struct pgtable_debug_args *args) { } in pmd_thp_tests() argument
991 static void __init pud_thp_tests(struct pgtable_debug_args *args) { } in pud_thp_tests() argument
1006 static void __init destroy_args(struct pgtable_debug_args *args) in destroy_args() argument
1013 args->pud_pfn != ULONG_MAX) { in destroy_args()
1014 if (args->is_contiguous_page) { in destroy_args()
1015 free_contig_range(args->pud_pfn, in destroy_args()
1018 page = pfn_to_page(args->pud_pfn); in destroy_args()
1022 args->pud_pfn = ULONG_MAX; in destroy_args()
1023 args->pmd_pfn = ULONG_MAX; in destroy_args()
1024 args->pte_pfn = ULONG_MAX; in destroy_args()
1029 args->pmd_pfn != ULONG_MAX) { in destroy_args()
1030 if (args->is_contiguous_page) { in destroy_args()
1031 free_contig_range(args->pmd_pfn, (1 << HPAGE_PMD_ORDER)); in destroy_args()
1033 page = pfn_to_page(args->pmd_pfn); in destroy_args()
1037 args->pmd_pfn = ULONG_MAX; in destroy_args()
1038 args->pte_pfn = ULONG_MAX; in destroy_args()
1041 if (args->pte_pfn != ULONG_MAX) { in destroy_args()
1042 page = pfn_to_page(args->pte_pfn); in destroy_args()
1045 args->pte_pfn = ULONG_MAX; in destroy_args()
1049 if (args->start_ptep) { in destroy_args()
1050 pte_free(args->mm, args->start_ptep); in destroy_args()
1051 mm_dec_nr_ptes(args->mm); in destroy_args()
1054 if (args->start_pmdp) { in destroy_args()
1055 pmd_free(args->mm, args->start_pmdp); in destroy_args()
1056 mm_dec_nr_pmds(args->mm); in destroy_args()
1059 if (args->start_pudp) { in destroy_args()
1060 pud_free(args->mm, args->start_pudp); in destroy_args()
1061 mm_dec_nr_puds(args->mm); in destroy_args()
1064 if (args->start_p4dp) in destroy_args()
1065 p4d_free(args->mm, args->start_p4dp); in destroy_args()
1068 if (args->vma) in destroy_args()
1069 vm_area_free(args->vma); in destroy_args()
1071 if (args->mm) in destroy_args()
1072 mmdrop(args->mm); in destroy_args()
1076 debug_vm_pgtable_alloc_huge_page(struct pgtable_debug_args *args, int order) in debug_vm_pgtable_alloc_huge_page() argument
1085 args->is_contiguous_page = true; in debug_vm_pgtable_alloc_huge_page()
1122 static void __init init_fixed_pfns(struct pgtable_debug_args *args) in init_fixed_pfns() argument
1144 args->fixed_alignment = PAGE_SIZE; in init_fixed_pfns()
1149 &args->fixed_alignment); in init_fixed_pfns()
1152 if (args->fixed_alignment == PUD_SIZE) in init_fixed_pfns()
1159 if (args->fixed_alignment < PMD_SIZE) in init_fixed_pfns()
1161 &args->fixed_alignment); in init_fixed_pfns()
1164 args->fixed_pgd_pfn = __phys_to_pfn(phys & PGDIR_MASK); in init_fixed_pfns()
1165 args->fixed_p4d_pfn = __phys_to_pfn(phys & P4D_MASK); in init_fixed_pfns()
1166 args->fixed_pud_pfn = __phys_to_pfn(phys & PUD_MASK); in init_fixed_pfns()
1167 args->fixed_pmd_pfn = __phys_to_pfn(phys & PMD_MASK); in init_fixed_pfns()
1168 args->fixed_pte_pfn = __phys_to_pfn(phys & PAGE_MASK); in init_fixed_pfns()
1169 WARN_ON(!pfn_valid(args->fixed_pte_pfn)); in init_fixed_pfns()
1173 static int __init init_args(struct pgtable_debug_args *args) in init_args() argument
1185 memset(args, 0, sizeof(*args)); in init_args()
1186 args->vaddr = get_random_vaddr(); in init_args()
1187 args->page_prot = vm_get_page_prot(VM_ACCESS_FLAGS); in init_args()
1188 args->page_prot_none = vm_get_page_prot(VM_NONE); in init_args()
1189 args->is_contiguous_page = false; in init_args()
1190 args->pud_pfn = ULONG_MAX; in init_args()
1191 args->pmd_pfn = ULONG_MAX; in init_args()
1192 args->pte_pfn = ULONG_MAX; in init_args()
1193 args->fixed_pgd_pfn = ULONG_MAX; in init_args()
1194 args->fixed_p4d_pfn = ULONG_MAX; in init_args()
1195 args->fixed_pud_pfn = ULONG_MAX; in init_args()
1196 args->fixed_pmd_pfn = ULONG_MAX; in init_args()
1197 args->fixed_pte_pfn = ULONG_MAX; in init_args()
1200 args->mm = mm_alloc(); in init_args()
1201 if (!args->mm) { in init_args()
1207 args->vma = vm_area_alloc(args->mm); in init_args()
1208 if (!args->vma) { in init_args()
1219 args->pgdp = pgd_offset(args->mm, args->vaddr); in init_args()
1220 args->p4dp = p4d_alloc(args->mm, args->pgdp, args->vaddr); in init_args()
1221 if (!args->p4dp) { in init_args()
1226 args->start_p4dp = p4d_offset(args->pgdp, 0UL); in init_args()
1227 WARN_ON(!args->start_p4dp); in init_args()
1229 args->pudp = pud_alloc(args->mm, args->p4dp, args->vaddr); in init_args()
1230 if (!args->pudp) { in init_args()
1235 args->start_pudp = pud_offset(args->p4dp, 0UL); in init_args()
1236 WARN_ON(!args->start_pudp); in init_args()
1238 args->pmdp = pmd_alloc(args->mm, args->pudp, args->vaddr); in init_args()
1239 if (!args->pmdp) { in init_args()
1244 args->start_pmdp = pmd_offset(args->pudp, 0UL); in init_args()
1245 WARN_ON(!args->start_pmdp); in init_args()
1247 if (pte_alloc(args->mm, args->pmdp)) { in init_args()
1252 args->start_ptep = pmd_pgtable(READ_ONCE(*args->pmdp)); in init_args()
1253 WARN_ON(!args->start_ptep); in init_args()
1255 init_fixed_pfns(args); in init_args()
1264 page = debug_vm_pgtable_alloc_huge_page(args, in init_args()
1267 args->pud_pfn = page_to_pfn(page); in init_args()
1268 args->pmd_pfn = args->pud_pfn; in init_args()
1269 args->pte_pfn = args->pud_pfn; in init_args()
1276 page = debug_vm_pgtable_alloc_huge_page(args, HPAGE_PMD_ORDER); in init_args()
1278 args->pmd_pfn = page_to_pfn(page); in init_args()
1279 args->pte_pfn = args->pmd_pfn; in init_args()
1286 args->pte_pfn = page_to_pfn(page); in init_args()
1291 destroy_args(args); in init_args()
1297 struct pgtable_debug_args args; in debug_vm_pgtable() local
1302 ret = init_args(&args); in debug_vm_pgtable()
1320 pte_basic_tests(&args, idx); in debug_vm_pgtable()
1321 pmd_basic_tests(&args, idx); in debug_vm_pgtable()
1322 pud_basic_tests(&args, idx); in debug_vm_pgtable()
1332 p4d_basic_tests(&args); in debug_vm_pgtable()
1333 pgd_basic_tests(&args); in debug_vm_pgtable()
1335 pmd_leaf_tests(&args); in debug_vm_pgtable()
1336 pud_leaf_tests(&args); in debug_vm_pgtable()
1338 pte_special_tests(&args); in debug_vm_pgtable()
1339 pte_protnone_tests(&args); in debug_vm_pgtable()
1340 pmd_protnone_tests(&args); in debug_vm_pgtable()
1342 pte_devmap_tests(&args); in debug_vm_pgtable()
1343 pmd_devmap_tests(&args); in debug_vm_pgtable()
1344 pud_devmap_tests(&args); in debug_vm_pgtable()
1346 pte_soft_dirty_tests(&args); in debug_vm_pgtable()
1347 pmd_soft_dirty_tests(&args); in debug_vm_pgtable()
1348 pte_swap_soft_dirty_tests(&args); in debug_vm_pgtable()
1349 pmd_swap_soft_dirty_tests(&args); in debug_vm_pgtable()
1351 pte_swap_exclusive_tests(&args); in debug_vm_pgtable()
1353 pte_swap_tests(&args); in debug_vm_pgtable()
1354 pmd_swap_tests(&args); in debug_vm_pgtable()
1356 swap_migration_tests(&args); in debug_vm_pgtable()
1358 pmd_thp_tests(&args); in debug_vm_pgtable()
1359 pud_thp_tests(&args); in debug_vm_pgtable()
1361 hugetlb_basic_tests(&args); in debug_vm_pgtable()
1368 args.ptep = pte_offset_map_lock(args.mm, args.pmdp, args.vaddr, &ptl); in debug_vm_pgtable()
1369 pte_clear_tests(&args); in debug_vm_pgtable()
1370 pte_advanced_tests(&args); in debug_vm_pgtable()
1371 if (args.ptep) in debug_vm_pgtable()
1372 pte_unmap_unlock(args.ptep, ptl); in debug_vm_pgtable()
1374 ptl = pmd_lock(args.mm, args.pmdp); in debug_vm_pgtable()
1375 pmd_clear_tests(&args); in debug_vm_pgtable()
1376 pmd_advanced_tests(&args); in debug_vm_pgtable()
1377 pmd_huge_tests(&args); in debug_vm_pgtable()
1378 pmd_populate_tests(&args); in debug_vm_pgtable()
1381 ptl = pud_lock(args.mm, args.pudp); in debug_vm_pgtable()
1382 pud_clear_tests(&args); in debug_vm_pgtable()
1383 pud_advanced_tests(&args); in debug_vm_pgtable()
1384 pud_huge_tests(&args); in debug_vm_pgtable()
1385 pud_populate_tests(&args); in debug_vm_pgtable()
1388 spin_lock(&(args.mm->page_table_lock)); in debug_vm_pgtable()
1389 p4d_clear_tests(&args); in debug_vm_pgtable()
1390 pgd_clear_tests(&args); in debug_vm_pgtable()
1391 p4d_populate_tests(&args); in debug_vm_pgtable()
1392 pgd_populate_tests(&args); in debug_vm_pgtable()
1393 spin_unlock(&(args.mm->page_table_lock)); in debug_vm_pgtable()
1395 destroy_args(&args); in debug_vm_pgtable()