selftests-mm-move-uffd-minor-test-to-unit-test.patch removed from -mm tree
The quilt patch titled
Subject: selftests/mm: move uffd minor test to unit test
has been removed from the -mm tree. Its filename was
selftests-mm-move-uffd-minor-test-to-unit-test.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Peter Xu <[email protected]>
Subject: selftests/mm: move uffd minor test to unit test
Date: Wed, 12 Apr 2023 12:43:57 -0400
This moves the minor test to the new unit test.
Rewrite the content check with char* opeartions to avoid fiddling with my_bcmp().
Drop global vars test_uffdio_minor and test_collapse, just assume test them always in common code for now.
OTOH make this single test into five tests:
- minor test on [shmem, hugetlb] with wp=false
- minor test on [shmem, hugetlb] with wp=true
- minor test + collapse on shmem only
One thing to mention that we used to test COLLAPSE+WP but that doesn't sound right at all. It's possible it's silently broken but unnoticed because COLLAPSE is not part of the default test suite.
Make the MADV_COLLAPSE test fail-able (by skip it when failing), because it's not guaranteed to success anyway.
Drop a bunch of useless code after the move, because the unit test always use aligned num of pages and has nothing to do with n_cpus.
---
tools/testing/selftests/mm/uffd-common.c | 25 +-- tools/testing/selftests/mm/uffd-common.h | 4 tools/testing/selftests/mm/uffd-stress.c | 131 ----------------- tools/testing/selftests/mm/uffd-unit-tests.c | 120 +++++++++++++++ 4 files changed, 135 insertions(+), 145 deletions(-)
tools/testing/selftests/mm/uffd-common.c renamed from tools/testing/selftests/mm/uffd-common.c~selftests-mm-move-uffd-minor-test-to-unit-test +12 -13
@@ -13,8 +13,8 @@ volatile bool test_uffdio_copy_eexist =unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;char *area_src, *area_src_alias, *area_dst, *area_dst_alias, *area_remap;int uffd =-1 , uffd_flags, finished, *pipefd, test_type; -bool map_shared, test_collapse, test_dev_userfaultfd; -bool test_uffdio_wp = true, test_uffdio_minor = false; +bool map_shared, test_dev_userfaultfd; +bool test_uffdio_wp = true;unsigned long long *count_verify;uffd_test_ops_t *uffd_test_ops;
@@ -128,15 +128,14 @@ static int shmem_allocate_area(void **alchar *p =NULL , *p_alias =NULL ;int mem_fd =uffd_mem_fd_create (bytes *2 , false); -if (test_collapse) { - p =BASE_PMD_ADDR ; -if (!is_src) -/* src map + alias + interleaved hpages */ - p +=2 * (bytes + hpage_size); - p_alias = p; - p_alias += bytes; - p_alias += hpage_size;/* Prevent src/dst VMA merge */ - } +/* TODO: clean this up. Use a static addr is ugly */ + p =BASE_PMD_ADDR ; +if (!is_src) +/* src map + alias + interleaved hpages */ + p +=2 * (bytes + hpage_size); + p_alias = p; + p_alias += bytes; + p_alias += hpage_size;/* Prevent src/dst VMA merge */ *alloc_area =mmap (p, bytes,PROT_READ |PROT_WRITE ,MAP_SHARED , mem_fd, offset);
@@ -144,7 +143,7 @@ static int shmem_allocate_area(void **al *alloc_area =NULL ;return -errno; } -if (test_collapse && *alloc_area != p) +if (*alloc_area != p)err ("mmap of memfd failed at %p" , p); area_alias = mmap(p_alias, bytes, PROT_READ | PROT_WRITE, MAP_SHARED,
@@ -154,7 +153,7 @@ static int shmem_allocate_area(void **al *alloc_area =NULL ;return -errno; } -if (test_collapse && area_alias != p_alias) +if (area_alias != p_alias)err ("mmap of anonymous memory failed at %p" , p_alias);if (is_src)
tools/testing/selftests/mm/uffd-common.h renamed from tools/testing/selftests/mm/uffd-common.h~selftests-mm-move-uffd-minor-test-to-unit-test +2 -2
@@ -90,8 +90,8 @@ typedef struct uffd_test_ops uffd_test_oextern unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;extern char *area_src, *area_src_alias, *area_dst, *area_dst_alias, *area_remap;extern int uffd, uffd_flags, finished, *pipefd, test_type; -extern bool map_shared, test_collapse, test_dev_userfaultfd; -extern bool test_uffdio_wp, test_uffdio_minor; +extern bool map_shared, test_dev_userfaultfd; +extern bool test_uffdio_wp;extern unsigned long long *count_verify;extern volatile bool test_uffdio_copy_eexist;
tools/testing/selftests/mm/uffd-stress.c renamed from tools/testing/selftests/mm/uffd-stress.c~selftests-mm-move-uffd-minor-test-to-unit-test +1 -130
197 lines not on this page · raw message
tools/testing/selftests/mm/uffd-unit-tests.c renamed from tools/testing/selftests/mm/uffd-unit-tests.c~selftests-mm-move-uffd-minor-test-to-unit-test +120 -0
132 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-move-uffd-sig-events-tests-into-uffd-unit-tests.patch selftests-mm-move-zeropage-test-into-uffd-unit-tests.patch selftests-mm-workaround-no-way-to-detect-uffd-minor-wp.patch selftests-mm-allow-uffd-test-to-skip-properly-with-no-privilege.patch selftests-mm-drop-sys-dev-test-in-uffd-stress-test.patch selftests-mm-add-shmem-private-test-to-uffd-stress.patch selftests-mm-add-uffdio-register-ioctls-test.patch mm-hugetlb-fix-uffd-wp-during-fork.patch mm-hugetlb-fix-uffd-wp-bit-lost-when-unsharing-happens.patch selftests-mm-add-a-few-options-for-uffd-unit-test.patch selftests-mm-extend-and-rename-uffd-pagemap-test.patch selftests-mm-rename-cow_extra_libs-to-iouring_extra_libs.patch selftests-mm-add-tests-for-ro-pinning-vs-fork.patch