[RFC PATCH v1 4/5] selftests/mm: Enable soft-dirty tests on arm64

Ryan Roberts ryan.roberts at arm.com
Fri Apr 19 00:43:43 PDT 2024


Now that arm64 supports soft-dirty tracking lets enable the tests, which
were previously disabled for arm64 to reduce noise.

This reverts commit f6dd4e223d87 ("selftests/mm: skip soft-dirty tests
on arm64").

Signed-off-by: Ryan Roberts <ryan.roberts at arm.com>
---
 tools/testing/selftests/mm/Makefile        |  5 +----
 tools/testing/selftests/mm/madv_populate.c | 26 ++--------------------
 tools/testing/selftests/mm/run_vmtests.sh  |  5 +----
 3 files changed, 4 insertions(+), 32 deletions(-)

diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index eb5f39a2668b..7f1a6ad09534 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -65,6 +65,7 @@ TEST_GEN_FILES += thuge-gen
 TEST_GEN_FILES += transhuge-stress
 TEST_GEN_FILES += uffd-stress
 TEST_GEN_FILES += uffd-unit-tests
+TEST_GEN_FILES += soft-dirty
 TEST_GEN_FILES += split_huge_page_test
 TEST_GEN_FILES += ksm_tests
 TEST_GEN_FILES += ksm_functional_tests
@@ -72,10 +73,6 @@ TEST_GEN_FILES += mdwe_test
 TEST_GEN_FILES += hugetlb_fault_after_madv
 TEST_GEN_FILES += hugetlb_madv_vs_map

-ifneq ($(ARCH),arm64)
-TEST_GEN_FILES += soft-dirty
-endif
-
 ifeq ($(ARCH),x86_64)
 CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_32bit_program.c -m32)
 CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_64bit_program.c)
diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c
index 17bcb07f19f3..60547245e479 100644
--- a/tools/testing/selftests/mm/madv_populate.c
+++ b/tools/testing/selftests/mm/madv_populate.c
@@ -264,35 +264,14 @@ static void test_softdirty(void)
 	munmap(addr, SIZE);
 }

-static int system_has_softdirty(void)
-{
-	/*
-	 * There is no way to check if the kernel supports soft-dirty, other
-	 * than by writing to a page and seeing if the bit was set. But the
-	 * tests are intended to check that the bit gets set when it should, so
-	 * doing that check would turn a potentially legitimate fail into a
-	 * skip. Fortunately, we know for sure that arm64 does not support
-	 * soft-dirty. So for now, let's just use the arch as a corse guide.
-	 */
-#if defined(__aarch64__)
-	return 0;
-#else
-	return 1;
-#endif
-}
-
 int main(int argc, char **argv)
 {
-	int nr_tests = 16;
 	int err;

 	pagesize = getpagesize();

-	if (system_has_softdirty())
-		nr_tests += 5;
-
 	ksft_print_header();
-	ksft_set_plan(nr_tests);
+	ksft_set_plan(21);

 	sense_support();
 	test_prot_read();
@@ -300,8 +279,7 @@ int main(int argc, char **argv)
 	test_holes();
 	test_populate_read();
 	test_populate_write();
-	if (system_has_softdirty())
-		test_softdirty();
+	test_softdirty();

 	err = ksft_get_fail_cnt();
 	if (err)
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index c2c542fe7b17..29806d352c73 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -395,10 +395,7 @@ then
 	CATEGORY="pkey" run_test ./protection_keys_64
 fi

-if [ -x ./soft-dirty ]
-then
-	CATEGORY="soft_dirty" run_test ./soft-dirty
-fi
+CATEGORY="soft_dirty" run_test ./soft-dirty

 CATEGORY="pagemap" run_test ./pagemap_ioctl

--
2.25.1




More information about the linux-arm-kernel mailing list