This series adds a test validation for architecture exported page table helpers. Patch in the series adds basic transformation tests at various levels of the page table. Before that it exports gigantic page allocation function from HugeTLB.
This test was originally suggested by Catalin during arm64 THP migration RFC discussion earlier. Going forward it can include more specific tests with respect to various generic MM functions like THP, HugeTLB etc and platform specific tests. https://lore.kernel.org/linux-mm/[email protected]/ Changes in V4: - Disable DEBUG_ARCH_PGTABLE_TEST for ARM and IA64 platforms Changes in V3: (https://lore.kernel.org/patchwork/project/lkml/list/?series=411216) - Changed test trigger from module format into late_initcall() - Marked all functions with __init to be freed after completion - Changed all __PGTABLE_PXX_FOLDED checks as mm_pxx_folded() - Folded in PPC32 fixes from Christophe Changes in V2: https://lore.kernel.org/linux-mm/[email protected]/T/#t - Fixed small typo error in MODULE_DESCRIPTION() - Fixed m64k build problems for lvalue concerns in pmd_xxx_tests() - Fixed dynamic page table level folding problems on x86 as per Kirril - Fixed second pointers during pxx_populate_tests() per Kirill and Gerald - Allocate and free pte table with pte_alloc_one/pte_free per Kirill - Modified pxx_clear_tests() to accommodate s390 lower 12 bits situation - Changed RANDOM_NZVALUE value from 0xbe to 0xff - Changed allocation, usage, free sequence for saved_ptep - Renamed VMA_FLAGS as VMFLAGS - Implemented a new method for random vaddr generation - Implemented some other cleanups - Dropped extern reference to mm_alloc() - Created and exported new alloc_gigantic_page_order() - Dropped the custom allocator and used new alloc_gigantic_page_order() Changes in V1: https://lore.kernel.org/linux-mm/[email protected]/ - Added fallback mechanism for PMD aligned memory allocation failure Changes in RFC V2: https://lore.kernel.org/linux-mm/[email protected]/T/#u - Moved test module and it's config from lib/ to mm/ - Renamed config TEST_ARCH_PGTABLE as DEBUG_ARCH_PGTABLE_TEST - Renamed file from test_arch_pgtable.c to arch_pgtable_test.c - Added relevant MODULE_DESCRIPTION() and MODULE_AUTHOR() details - Dropped loadable module config option - Basic tests now use memory blocks with required size and alignment - PUD aligned memory block gets allocated with alloc_contig_range() - If PUD aligned memory could not be allocated it falls back on PMD aligned memory block from page allocator and pud_* tests are skipped - Clear and populate tests now operate on real in memory page table entries - Dummy mm_struct gets allocated with mm_alloc() - Dummy page table entries get allocated with [pud|pmd|pte]_alloc_[map]() - Simplified [p4d|pgd]_basic_tests(), now has random values in the entries Original RFC V1: https://lore.kernel.org/linux-mm/[email protected]/ Cc: Andrew Morton <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Dan Williams <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mark Brown <[email protected]> Cc: Steven Price <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Kees Cook <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Sri Krishna chowdary <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Russell King - ARM Linux <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: James Hogan <[email protected]> Cc: Paul Burton <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Anshuman Khandual (2): mm/hugetlb: Make alloc_gigantic_page() available for general use mm/pgtable/debug: Add test validating architecture page table helpers arch/x86/include/asm/pgtable_64_types.h | 2 + include/linux/hugetlb.h | 9 + mm/Kconfig.debug | 15 + mm/Makefile | 1 + mm/arch_pgtable_test.c | 440 ++++++++++++++++++++++++ mm/hugetlb.c | 24 +- 6 files changed, 489 insertions(+), 2 deletions(-) create mode 100644 mm/arch_pgtable_test.c -- 2.20.1

