From patchwork Thu Jul 13 13:54:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13312261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C47C04A94 for ; Thu, 13 Jul 2023 13:55:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFA1D90001E; Thu, 13 Jul 2023 09:55:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B82BE90001C; Thu, 13 Jul 2023 09:55:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ADE090001E; Thu, 13 Jul 2023 09:55:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8854690001C for ; Thu, 13 Jul 2023 09:55:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 51DAE1A0294 for ; Thu, 13 Jul 2023 13:55:08 +0000 (UTC) X-FDA: 81006735096.27.681DA43 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf22.hostedemail.com (Postfix) with ESMTP id 83797C000D for ; Thu, 13 Jul 2023 13:55:06 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf22.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689256506; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rgNh+VVG4rnJeUIVls+H/r6KasnE8DWQu2bfgPlapXg=; b=PeIfdFneeLgXxeHvNK1iZz++szFues6BeCwc9gE+mf+VA+Ks1wESabCExs1cNQjKk0D83X XwNMXcGCSM+HuHNJ6Y6zDPsQAzimxkVS7VuSR//8tNnvoh8Jj/6OxEy0RGGp7SYBRnJJ25 3MJS9HN7PWWNUz7LFmGzOI52hDOzLyQ= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf22.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689256506; a=rsa-sha256; cv=none; b=rXwj/V3QeMXT1FFRhackr/a5pjpE4V1+ExLXYs1f8PDlECzn4wIF/zqC6l3c6G61UOuejp XRfABoXSkmeENM49ujnB8QeXpm+172A3l6zPH1z2Zirrb6wrICmLkgDPKRFH9E1I33k4No IeAcv/ds4Unc4bqsMX20mCWfOe/CpDU= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA4191596; Thu, 13 Jul 2023 06:55:48 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AFCEC3F73F; Thu, 13 Jul 2023 06:55:04 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Shuah Khan , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , David Hildenbrand , Mark Brown , John Hubbard , Florent Revest , "Liam R. Howlett" Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: [PATCH v1 9/9] selftests/mm: Run all tests from run_vmtests.sh Date: Thu, 13 Jul 2023 14:54:40 +0100 Message-Id: <20230713135440.3651409-10-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230713135440.3651409-1-ryan.roberts@arm.com> References: <20230713135440.3651409-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 83797C000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: drcxfekcnpmokeh7cw1pyqz95gdkurid X-HE-Tag: 1689256506-723681 X-HE-Meta: U2FsdGVkX1/TgfID/qCEyzzNtiCHmP3b0jyTAGiizr7r3x4LsZNvkhIyyYfNQ2U1kSsxD35w9lPphX68W7BSDWm6W8Rw73K6k69lb5D2CdMRlLqpc3vQI7USidLc/Lb32N2eDwh6cilVK1Jsgh74o6TAWrsVlWODxQhEudBUl393dn0NRQ7qSaMlXFnPBBI8OgkhZ40j/grMB7eWPVCQQsvW3ggMp6E2gZbdZhU44amMKn+5Jh/K84E/URLPEpMNu/3C/NpH4mtWtrNRq9CjuobXZ5ti/Qda3tu1TLOVgsJBSg8epIooTuywEIBkWsXMTzbyxMygEOSxc4Eo34nmPxTvAt9RyYYGrZaTmFZ87ofufE67ICt0XFwbORPufC9ytNhKsV5ZRsLt8EOk0RQiBVmgmhtxtLeDJwnMMhASjpFoR2iT2/iXR5RjQFR6g/NsXxVlDpTV32oCaKGolKGPwV086G0LuJof+ZLS/Ps6K+pJJ8savGANmKwdtZljqV/vXhzBNZ0kEVZx4P1BMBhaZWylmExDU2q+UdorJbR5PcOziAsvWiaJlf0WXlY3Rp45b7L9ROrUQ2/Clwh1T06JPsb2ULahBy82VNcRkERkDX6E6xSuliZWOBz69AKzK+ecL6Zm8dj7qk/8Eg/8uIRkNF0KThs4YU+aQfbmOxi7alOKAZlsR8euXg6pdxpQNqyTx9Q/oQJT/Mn3e0tbJzznNSBgWaOrMyZgqz/YwvrlWRJbgh7J6WA1zC9sH2F19siXugdIlUJ8GExhTXawAi7pEPH91A/jVMWkxiUiMm+4ksf3XmEVe5kQZJaj7/1U3qXMAerLWf0fqGTngy0vObLtDPW+WYPpL4J8ItJ7EI+ZJWrOUDSEUoE6BQgSdbBhBqdZZ+J2OElqBIlvILuAaBMITedcsLybIURkmpi4L86n2pe4GVX13tJX3qjKhwxpPj6RUkxD6XeKVp3Ypdeaj3f mgxTNS0x is0OhF4HK/hvla8ngB4Oa6x9hH6hodbIvwgKQiHypE/dSKEpQuL16fYL2eIKAMyt/nV/usyhwGZf82jEPDljQIVjroERmhKJZYwSVIoydn/PDlDDY8kmyRB6PONXKC2uViRPH+zNmai06Aia9gg3CexVqnbtuAvNJRIqL/hLyX64Yw09hWuo2AFYh6Dif2jzSg5c0BLRRFw7REkvekzeXv5B7hQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: It is very unclear to me how one is supposed to run all the mm selftests consistently and get clear results. Most of the test programs are launched by both run_vmtests.sh and run_kselftest.sh: hugepage-mmap hugepage-shm map_hugetlb hugepage-mremap hugepage-vmemmap hugetlb-madvise map_fixed_noreplace gup_test gup_longterm uffd-unit-tests uffd-stress compaction_test on-fault-limit map_populate mlock-random-test mlock2-tests mrelease_test mremap_test thuge-gen virtual_address_range va_high_addr_switch mremap_dontunmap hmm-tests madv_populate memfd_secret ksm_tests ksm_functional_tests soft-dirty cow However, of this set, when launched by run_vmtests.sh, some of the programs are invoked multiple times with different arguments. When invoked by run_kselftest.sh, they are invoked without arguments (and as a consequence, some fail immediately). Some test programs are only launched by run_vmtests.sh: test_vmalloc.sh And some test programs and only launched by run_kselftest.sh: khugepaged migration mkdirty transhuge-stress split_huge_page_test mdwe_test write_to_hugetlbfs Furthermore, run_vmtests.sh is invoked by run_kselftest.sh, so in this case all the test programs invoked by both scripts are run twice! Needless to say, this is a bit of a mess. In the absence of fully understanding the history here, it looks to me like the best solution is to launch ALL test programs from run_vmtests.sh, and ONLY invoke run_vmtests.sh from run_kselftest.sh. This way, we get full control over the parameters, each program is only invoked the intended number of times, and regardless of which script is used, the same tests get run in the same way. The only drawback is that if using run_kselftest.sh, it's top-level tap result reporting reports only a single test and it fails if any of the contained tests fail. I don't see this as a big deal though since we still see all the nested reporting from multiple layers. The other issue with this is that all of run_vmtests.sh must execute within a single kselftest timeout period, so let's increase that to something more suitable. Signed-off-by: Ryan Roberts --- tools/testing/selftests/mm/Makefile | 79 ++++++++++++----------- tools/testing/selftests/mm/run_vmtests.sh | 23 +++++++ tools/testing/selftests/mm/settings | 2 +- 3 files changed, 64 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 66d7c07dc177..881ed96d96fd 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -35,39 +35,39 @@ MAKEFLAGS += --no-builtin-rules CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) LDLIBS = -lrt -lpthread -TEST_GEN_PROGS = cow -TEST_GEN_PROGS += compaction_test -TEST_GEN_PROGS += gup_longterm -TEST_GEN_PROGS += gup_test -TEST_GEN_PROGS += hmm-tests -TEST_GEN_PROGS += hugetlb-madvise -TEST_GEN_PROGS += hugepage-mmap -TEST_GEN_PROGS += hugepage-mremap -TEST_GEN_PROGS += hugepage-shm -TEST_GEN_PROGS += hugepage-vmemmap -TEST_GEN_PROGS += khugepaged -TEST_GEN_PROGS += madv_populate -TEST_GEN_PROGS += map_fixed_noreplace -TEST_GEN_PROGS += map_hugetlb -TEST_GEN_PROGS += map_populate -TEST_GEN_PROGS += memfd_secret -TEST_GEN_PROGS += migration -TEST_GEN_PROGS += mkdirty -TEST_GEN_PROGS += mlock-random-test -TEST_GEN_PROGS += mlock2-tests -TEST_GEN_PROGS += mrelease_test -TEST_GEN_PROGS += mremap_dontunmap -TEST_GEN_PROGS += mremap_test -TEST_GEN_PROGS += on-fault-limit -TEST_GEN_PROGS += thuge-gen -TEST_GEN_PROGS += transhuge-stress -TEST_GEN_PROGS += uffd-stress -TEST_GEN_PROGS += uffd-unit-tests -TEST_GEN_PROGS += soft-dirty -TEST_GEN_PROGS += split_huge_page_test -TEST_GEN_PROGS += ksm_tests -TEST_GEN_PROGS += ksm_functional_tests -TEST_GEN_PROGS += mdwe_test +TEST_GEN_FILES = cow +TEST_GEN_FILES += compaction_test +TEST_GEN_FILES += gup_longterm +TEST_GEN_FILES += gup_test +TEST_GEN_FILES += hmm-tests +TEST_GEN_FILES += hugetlb-madvise +TEST_GEN_FILES += hugepage-mmap +TEST_GEN_FILES += hugepage-mremap +TEST_GEN_FILES += hugepage-shm +TEST_GEN_FILES += hugepage-vmemmap +TEST_GEN_FILES += khugepaged +TEST_GEN_FILES += madv_populate +TEST_GEN_FILES += map_fixed_noreplace +TEST_GEN_FILES += map_hugetlb +TEST_GEN_FILES += map_populate +TEST_GEN_FILES += memfd_secret +TEST_GEN_FILES += migration +TEST_GEN_FILES += mkdirty +TEST_GEN_FILES += mlock-random-test +TEST_GEN_FILES += mlock2-tests +TEST_GEN_FILES += mrelease_test +TEST_GEN_FILES += mremap_dontunmap +TEST_GEN_FILES += mremap_test +TEST_GEN_FILES += on-fault-limit +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 +TEST_GEN_FILES += mdwe_test ifeq ($(ARCH),x86_64) CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_32bit_program.c -m32) @@ -83,24 +83,24 @@ CFLAGS += -no-pie endif ifeq ($(CAN_BUILD_I386),1) -TEST_GEN_PROGS += $(BINARIES_32) +TEST_GEN_FILES += $(BINARIES_32) endif ifeq ($(CAN_BUILD_X86_64),1) -TEST_GEN_PROGS += $(BINARIES_64) +TEST_GEN_FILES += $(BINARIES_64) endif else ifneq (,$(findstring $(ARCH),ppc64)) -TEST_GEN_PROGS += protection_keys +TEST_GEN_FILES += protection_keys endif endif ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sparc64 x86_64)) -TEST_GEN_PROGS += va_high_addr_switch -TEST_GEN_PROGS += virtual_address_range -TEST_GEN_PROGS += write_to_hugetlbfs +TEST_GEN_FILES += va_high_addr_switch +TEST_GEN_FILES += virtual_address_range +TEST_GEN_FILES += write_to_hugetlbfs endif TEST_PROGS := run_vmtests.sh @@ -112,6 +112,7 @@ TEST_FILES += va_high_addr_switch.sh include ../lib.mk $(TEST_GEN_PROGS): vm_util.c +$(TEST_GEN_FILES): vm_util.c $(OUTPUT)/uffd-stress: uffd-common.c $(OUTPUT)/uffd-unit-tests: uffd-common.c diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 3f26f6e15b2a..55fe1d309355 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -55,6 +55,17 @@ separated by spaces: test soft dirty page bit semantics - cow test copy-on-write semantics +- thp + test transparent huge pages +- migration + invoke move_pages(2) to exercise the migration entry code + paths in the kernel +- mkdirty + test handling of code that might set PTE/PMD dirty in + read-only VMAs +- mdwe + test prctl(PR_SET_MDWE, ...) + example: ./run_vmtests.sh -t "hmm mmap ksm" EOF exit 0 @@ -295,6 +306,18 @@ CATEGORY="soft_dirty" run_test ./soft-dirty # COW tests CATEGORY="cow" run_test ./cow +CATEGORY="thp" run_test ./khugepaged + +CATEGORY="thp" run_test ./transhuge-stress -d 20 + +CATEGORY="thp" run_test ./split_huge_page_test + +CATEGORY="migration" run_test ./migration + +CATEGORY="mkdirty" run_test ./mkdirty + +CATEGORY="mdwe" run_test ./mdwe_test + echo "SUMMARY: PASS=${count_pass} SKIP=${count_skip} FAIL=${count_fail}" exit $exitcode diff --git a/tools/testing/selftests/mm/settings b/tools/testing/selftests/mm/settings index ba4d85f74cd6..a953c96aa16e 100644 --- a/tools/testing/selftests/mm/settings +++ b/tools/testing/selftests/mm/settings @@ -1 +1 @@ -timeout=90 +timeout=180