mm/hmm/test: add self tests for HMM
Subsystems (5)
v9 cover mm/hmm/test: add self tests for HMM
This series adds basic self tests for HMM and are intended for Jason Gunthorpe's rdma tree since I believe he is planning to make some HMM related changes that this can help test.
Changes v8 -> v9:
Rebased to linux-5.7.0-rc1.
Moved include/uapi/linux/test_hmm.h to lib/test_hmm_uapi.h Added calls to release_mem_region() to free device private addresses Applied Jason's suggested changes for v8.
Added a check for no VMA read access before migrating to device private
memory.
Changes v7 -> v8:
Rebased to Jason's rdma/hmm tree, plus Jason's 6 patch series
"Small hmm_range_fault() cleanups".
Applied a number of changes from Jason's comments.
Changes v6 -> v7:
Rebased to linux-5.6.0-rc6
Reverted back to just using mmu_interval_notifier_insert() and making
this series only introduce HMM self tests.
Changes v5 -> v6:
Rebased to linux-5.5.0-rc6
Refactored mmu interval notifier patches Converted nouveau to use the new mmu interval notifier API
Changes v4 -> v5:
Added mmu interval notifier insert/remove/update callable from the
invalidate() callback
Updated HMM tests to use the new core interval notifier API
Changes v1 -> v4:
https://lore.kernel.org/linux-mm/[email protected]
Ralph Campbell (3):
mm/hmm/test: add selftest driver for HMM
mm/hmm/test: add selftests for HMM
MAINTAINERS: add HMM selftests
MAINTAINERS | 3 + lib/Kconfig.debug | 13 + lib/Makefile | 1 + lib/test_hmm.c | 1175 ++++++++++++++++++++ lib/test_hmm_uapi.h | 59 + tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 3 + tools/testing/selftests/vm/config | 2 + tools/testing/selftests/vm/hmm-tests.c | 1359 ++++++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests | 16 + tools/testing/selftests/vm/test_hmm.sh | 97 ++ 11 files changed, 2729 insertions(+) create mode 100644 lib/test_hmm.c create mode 100644 lib/test_hmm_uapi.h create mode 100644 tools/testing/selftests/vm/hmm-tests.c create mode 100755 tools/testing/selftests/vm/test_hmm.sh
Signature · 1 line
2.25.2
PATCH v9 1/3 mm/hmm/test: add selftest driver for HMM
This driver is for testing device private memory migration and devices which use hmm_range_fault() to access system memory via device page tables.
--- lib/Kconfig.debug | 13 + lib/Makefile | 1 + lib/test_hmm.c | 1175 +++++++++++++++++++++++++++++++++++++++++++ lib/test_hmm_uapi.h | 59 +++ 4 files changed, 1248 insertions(+) create mode 100644 lib/test_hmm.c create mode 100644 lib/test_hmm_uapi.h
lib/Kconfig.debug +13 -0
@@ -2199,6 +2199,19 @@ config TEST_MEMINIT If unsure, say N. +config TEST_HMM + tristate "Test HMM (Heterogeneous Memory Management)" + depends on TRANSPARENT_HUGEPAGE + select DEVICE_PRIVATE + select HMM_MIRROR + select MMU_NOTIFIER + help + This is a pseudo device driver solely for testing HMM. + Say M here if you want to build the HMM test module. + Doing so will allow you to run tools/testing/selftest/vm/hmm-tests. + + If unsure, say N. + endif # RUNTIME_TESTING_MENU config MEMTEST
lib/Makefile +1 -0
@@ -92,6 +92,7 @@ obj-$(CONFIG_TEST_STACKINIT) += test_stackinit.o obj-$(CONFIG_TEST_BLACKHOLE_DEV) += test_blackhole_dev.o obj-$(CONFIG_TEST_MEMINIT) += test_meminit.o obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o +obj-$(CONFIG_TEST_HMM) += test_hmm.o obj-$(CONFIG_TEST_LIVEPATCH) += livepatch/
lib/test_hmm.c new file +1175 -0
1,175 lines not on this page · raw message
lib/test_hmm_uapi.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.25.2
PATCH v9 2/3 mm/hmm/test: add selftests for HMM
In reply to Ralph CampbellAdd some basic stand alone self tests for HMM.
The test program and shell scripts use the test_hmm.ko driver to exercise HMM functionality in the kernel.
--- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 3 + tools/testing/selftests/vm/config | 2 + tools/testing/selftests/vm/hmm-tests.c | 1359 ++++++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests | 16 + tools/testing/selftests/vm/test_hmm.sh | 97 ++ 6 files changed, 1478 insertions(+) create mode 100644 tools/testing/selftests/vm/hmm-tests.c create mode 100755 tools/testing/selftests/vm/test_hmm.sh
tools/testing/selftests/vm/.gitignore +1 -0
@@ -16,3 +16,4 @@ gup_benchmark va_128TBswitch map_fixed_noreplace write_to_hugetlbfs +hmm-tests
tools/testing/selftests/vm/Makefile +3 -0
@@ -7,6 +7,7 @@ CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) LDLIBS = -lrt TEST_GEN_FILES = compaction_test TEST_GEN_FILES += gup_benchmark +TEST_GEN_FILES += hmm-tests TEST_GEN_FILES += hugepage-mmap TEST_GEN_FILES += hugepage-shm TEST_GEN_FILES += map_hugetlb
@@ -33,6 +34,8 @@ TEST_FILES := test_vmalloc.sh KSFT_KHDR_INSTALL := 1 include ../lib.mk +$(OUTPUT)/hmm-tests: LDLIBS += -lhugetlbfs -lpthread + $(OUTPUT)/userfaultfd: LDLIBS += -lpthread $(OUTPUT)/mlock-random-test: LDLIBS += -lcap
tools/testing/selftests/vm/config +2 -0
@@ -1,3 +1,5 @@ CONFIG_SYSVIPC=y CONFIG_USERFAULTFD=y CONFIG_TEST_VMALLOC=m +CONFIG_DEVICE_PRIVATE=y +CONFIG_TEST_HMM=m
tools/testing/selftests/vm/hmm-tests.c new file +1359 -0
1,359 lines not on this page · raw message
tools/testing/selftests/vm/run_vmtests +16 -0
@@ -307,4 +307,20 @@ else echo "[FAIL]" exitcode=1 fi + +echo "running HMM smoke test" +echo "------------------------------------" +./test_hmm.sh smoke +ret_val=$? + +if [ $ret_val -eq 0 ]; then + echo "[PASS]" +elif [ $ret_val -eq $ksft_skip ]; then + echo "[SKIP]" + exitcode=$ksft_skip +else + echo "[FAIL]" + exitcode=1 +fi + exit $exitcode
tools/testing/selftests/vm/test_hmm.sh new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
2.25.2
PATCH v9 3/3 MAINTAINERS: add HMM selftests
In reply to Ralph CampbellAdd files for HMM selftests.
--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm* +F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm* HOST AP DRIVER M: Jouni Malinen <[email protected]>
Signature · 1 line
2.25.2
Re: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
Quoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 7734
Quoted 6 lines
MAINTAINERS +3
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm* +F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm*
file patterns in alphabetic order please:
F Documentation/vm/hmm.rst
F: include/linux/hmm*
F: include/uapi/linux/test_hmm*
F: lib/test_hmm*
F: mm/hmm*
F: tools/testing/selftests/vm/*hmm*
Andrew Morton
maintainerRe: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
Quoted 22 lines · On Fri, 17 Apr 2020 17:59:03 -0700 Joe Perches <[email protected]> wrote:
Quoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 7734
Quoted 6 lines
MAINTAINERS +3
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm* +F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm*file patterns in alphabetic order please:
Quoted 6 lines
F
Documentation/vm/hmm.rst
F:include/linux/hmm*
F:include/uapi/linux/test_hmm*
F:lib/test_hmm*
F:mm/hmm*
F:tools/testing/selftests/vm/*hmm*
checkpatch rule for this, please ;)
Re: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
Quoted 24 lines · Andrew Morton
Quoted 22 lines · On Fri, 17 Apr 2020 17:59:03 -0700 Joe Perches <[email protected]> wrote:
Quoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 7734
Quoted 6 lines
MAINTAINERS +3
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm* +F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm*file patterns in alphabetic order please:
Quoted 8 lines
Quoted 6 lines
F
Documentation/vm/hmm.rst
F:include/linux/hmm*
F:include/uapi/linux/test_hmm*
F:lib/test_hmm*
F:mm/hmm*
F:tools/testing/selftests/vm/*hmm*checkpatch rule for this, please ;)
Already sent a few days ago to you ;)
https://lore.kernel.org/lkml/[email protected]/
And somehow already in -mm too, at least by the email you sent me:
The patch titled
Subject: checkpatch: additional MAINTAINER section entry ordering checks
has been added to the -mm tree. Its filename is
checkpatch-additional-maintainer-section-entry-ordering-checks.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-additional-maintainer-section-entry-ordering-checks.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-additional-maintainer-section-entry-ordering-checks.patch
Re: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
In reply to Joe PerchesQuoted 22 lines · Joe Perches
Quoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 7734
Quoted 6 lines
MAINTAINERS +3
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm* +F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm*file patterns in alphabetic order please:
Quoted 7 lines
F
Documentation/vm/hmm.rst
F:include/linux/hmm*
F:include/uapi/linux/test_hmm*
F:lib/test_hmm*
F:mm/hmm*
F:tools/testing/selftests/vm/*hmm*
No problem. Will fix in the next posting.
Thanks.
Re: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
In reply to Ralph CampbellQuoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 7732
Quoted 4 lines
MAINTAINERS +1
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm*
This line is not needed anymore.
Thanks
Quoted 9 lines
MAINTAINERS +2
-1+F: lib/test_hmm* +F: tools/testing/selftests/vm/*hmm* HOST AP DRIVER M: Jouni Malinen <[email protected]> --2.25.2
Re: [PATCH v9 3/3] MAINTAINERS: add HMM selftests
Quoted 20 lines · Leon Romanovsky
Quoted 12 lines · Ralph Campbell
Add files for HMM selftests.
Signed-off-by Ralph Campbell <[email protected]>--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 7732
Quoted 4 lines
MAINTAINERS +1
-0@@ -7729,6 +7729,9 @@ S: Maintained F: Documentation/vm/hmm.rst F: include/linux/hmm* F: mm/hmm* +F: include/uapi/linux/test_hmm*This line is not needed anymore.
Quoted 1 line
Thanks
Thank you. I'll fix this in the next posting.