Files
linux/tools/testing/selftests/mm/.gitignore
David Hildenbrand 2616b37032 selftests/mm: add simple VM_PFNMAP tests based on mmap'ing /dev/mem
Let's test some basic functionality using /dev/mem.  These tests will
implicitly cover some PAT (Page Attribute Handling) handling on x86.

These tests will only run when /dev/mem access to the first two pages in
physical address space is possible and allowed; otherwise, the tests are
skipped.

On current x86-64 with PAT inside a VM, all tests pass:

	TAP version 13
	1..6
	# Starting 6 tests from 1 test cases.
	#  RUN           pfnmap.madvise_disallowed ...
	#            OK  pfnmap.madvise_disallowed
	ok 1 pfnmap.madvise_disallowed
	#  RUN           pfnmap.munmap_split ...
	#            OK  pfnmap.munmap_split
	ok 2 pfnmap.munmap_split
	#  RUN           pfnmap.mremap_fixed ...
	#            OK  pfnmap.mremap_fixed
	ok 3 pfnmap.mremap_fixed
	#  RUN           pfnmap.mremap_shrink ...
	#            OK  pfnmap.mremap_shrink
	ok 4 pfnmap.mremap_shrink
	#  RUN           pfnmap.mremap_expand ...
	#            OK  pfnmap.mremap_expand
	ok 5 pfnmap.mremap_expand
	#  RUN           pfnmap.fork ...
	#            OK  pfnmap.fork
	ok 6 pfnmap.fork
	# PASSED: 6 / 6 tests passed.
	# Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0

However, we are able to trigger:

[   27.888251] x86/PAT: pfnmap:1790 freeing invalid memtype [mem 0x00000000-0x00000fff]

There are probably more things worth testing in the future, such as
MAP_PRIVATE handling.  But this set of tests is sufficient to cover most
of the things we will rework regarding PAT handling.

Link: https://lkml.kernel.org/r/20250509153033.952746-1-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Dev Jain <dev.jain@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-05-22 14:55:36 -07:00

63 lines
964 B
Plaintext

# SPDX-License-Identifier: GPL-2.0-only
cow
hugepage-mmap
hugepage-mremap
hugepage-shm
hugepage-vmemmap
hugetlb-madvise
hugetlb-read-hwpoison
hugetlb-soft-offline
khugepaged
map_hugetlb
map_populate
thuge-gen
compaction_test
migration
mlock2-tests
mrelease_test
mremap_dontunmap
mremap_test
on-fault-limit
transhuge-stress
pagemap_ioctl
pfnmap
*.tmp*
protection_keys
protection_keys_32
protection_keys_64
madv_populate
uffd-stress
uffd-unit-tests
uffd-wp-mremap
mlock-intersect-test
mlock-random-test
virtual_address_range
gup_test
va_128TBswitch
map_fixed_noreplace
write_to_hugetlbfs
hmm-tests
memfd_secret
hugetlb_dio
pkey_sighandler_tests_32
pkey_sighandler_tests_64
soft-dirty
split_huge_page_test
ksm_tests
local_config.h
local_config.mk
ksm_functional_tests
mdwe_test
gup_longterm
mkdirty
va_high_addr_switch
hugetlb_fault_after_madv
hugetlb_madv_vs_map
mseal_test
droppable
hugetlb_dio
pkey_sighandler_tests_32
pkey_sighandler_tests_64
guard-regions
merge