Subject: [RFC V2 0/1] mm/debug: Add tests for architecture exported page table helpers

From: Anshuman Khandual <[email-masked]>
Date: Fri, 9 Aug 2019 13:03:17 +0530

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.

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-masked]/

Questions:

Should alloc_gigantic_page() be made available as an interface for general
use in the kernel. The test module here uses very similar implementation from
HugeTLB to allocate a PUD aligned memory block. Similar for mm_alloc() which
needs to be exported through a header.

Testing:

Build and boot tested on arm64 and x86 platforms. While arm64 clears all
these tests, following errors were reported on x86.

1. WARN_ON(pud_bad(pud)) in pud_populate_tests()
2. WARN_ON(p4d_bad(p4d)) in p4d_populate_tests()

I would really appreciate if folks can help validate this test on other
platforms and report back problems if any. Suggestions, comments and
inputs welcome. Thank you.

Changes in V2:

- 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

RFC V1:

https://lore.kernel.org/linux-mm/[email-masked]/

Cc: Andrew Morton <[email-masked]>
Cc: Vlastimil Babka <[email-masked]>
Cc: Greg Kroah-Hartman <[email-masked]>
Cc: Thomas Gleixner <[email-masked]>
Cc: Mike Rapoport <[email-masked]>
Cc: Jason Gunthorpe <[email-masked]>
Cc: Dan Williams <[email-masked]>
Cc: Peter Zijlstra <[email-masked]>
Cc: Michal Hocko <[email-masked]>
Cc: Mark Rutland <[email-masked]>
Cc: Mark Brown <[email-masked]>
Cc: Steven Price <[email-masked]>
Cc: Ard Biesheuvel <[email-masked]>
Cc: Masahiro Yamada <[email-masked]>
Cc: Kees Cook <[email-masked]>
Cc: Tetsuo Handa <[email-masked]>
Cc: Matthew Wilcox <[email-masked]>
Cc: Sri Krishna chowdary <[email-masked]>
Cc: Dave Hansen <[email-masked]>
Cc: Russell King - ARM Linux <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Paul Mackerras <[email-masked]>
Cc: Martin Schwidefsky <[email-masked]>
Cc: Heiko Carstens <[email-masked]>
Cc: "David S. Miller" <[email-masked]>
Cc: Vineet Gupta <[email-masked]>
Cc: James Hogan <[email-masked]>
Cc: Paul Burton <[email-masked]>
Cc: Ralf Baechle <[email-masked]>
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]
Cc: [email-masked]

Anshuman Khandual (1):
  mm/pgtable/debug: Add test validating architecture page table helpers

 mm/Kconfig.debug       |  14 ++
 mm/Makefile            |   1 +
 mm/arch_pgtable_test.c | 400 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 415 insertions(+)
 create mode 100644 mm/arch_pgtable_test.c

-- 
2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel