selftests-mm-uffd_open_devsys.patch removed from -mm tree
The quilt patch titled
Subject: selftests/mm: uffd_open_{dev|sys}()
has been removed from the -mm tree. Its filename was
selftests-mm-uffd_open_devsys.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: uffd_open_{dev|sys}()
Date: Wed, 12 Apr 2023 12:42:54 -0400
Provide two helpers to open an uffd handle. Drop the error checks around SKIPs because it's inside an errexit() anyway, which IMHO doesn't really help much if the test will not continue.
---
tools/testing/selftests/mm/uffd-common.c | 28 +++------------------ tools/testing/selftests/mm/vm_util.c | 24 ++++++++++++++++++ tools/testing/selftests/mm/vm_util.h | 2 + 3 files changed, 31 insertions(+), 23 deletions(-)
tools/testing/selftests/mm/uffd-common.c renamed from tools/testing/selftests/mm/uffd-common.c~selftests-mm-uffd_open_devsys +5 -23
@@ -192,34 +192,16 @@ void uffd_stats_report(struct uffd_statsprintf ("\n" ); } -static int __userfaultfd_open_dev (void ) -{ -int fd, _uffd; - - fd =open ("/dev/userfaultfd" ,O_RDWR |O_CLOEXEC ); -if (fd <0 ) -errexit (KSFT_SKIP ,"opening /dev/userfaultfd failed" ); - - _uffd =ioctl (fd,USERFAULTFD_IOC_NEW ,UFFD_FLAGS ); -if (_uffd <0 ) -errexit (errno ==ENOTTY ?KSFT_SKIP :1 , -"creating userfaultfd failed" ); -close (fd); -return _uffd; -} -void userfaultfd_open (uint64_t *features) {struct uffdio_api uffdio_api;if (test_dev_userfaultfd) - uffd =__userfaultfd_open_dev (); -else { - uffd =syscall (__NR_userfaultfd,UFFD_FLAGS ); -if (uffd <0 ) -errexit (errno ==ENOSYS ?KSFT_SKIP :1 , -"creating userfaultfd failed" ); - } + uffd =uffd_open_dev (UFFD_FLAGS ); +else + uffd =uffd_open_sys (UFFD_FLAGS ); +if (uffd <0 ) +err ("uffd open failed (dev=%d)" , test_dev_userfaultfd); uffd_flags =fcntl (uffd,F_GETFD ,NULL ); uffdio_api.api =UFFD_API ;
tools/testing/selftests/mm/vm_util.c renamed from tools/testing/selftests/mm/vm_util.c~selftests-mm-uffd_open_devsys +24 -0
@@ -3,6 +3,8 @@#include <fcntl.h> #include <sys/ioctl.h> #include <linux/userfaultfd.h> +#include <sys/syscall.h> +#include <unistd.h> #include "../kselftest.h" #include "vm_util.h"
@@ -230,3 +232,25 @@ int uffd_unregister(int uffd, void *addrreturn ret; } + +int uffd_open_dev (unsigned int flags) +{ +int fd, uffd; + + fd =open ("/dev/userfaultfd" ,O_RDWR |O_CLOEXEC ); +if (fd <0 ) +return fd; + uffd =ioctl (fd,USERFAULTFD_IOC_NEW , flags); +close (fd); + +return uffd; +} + +int uffd_open_sys (unsigned int flags) +{ +#ifdef __NR_userfaultfd +return syscall (__NR_userfaultfd, flags); +#else +return -1 ; +#endif +}
tools/testing/selftests/mm/vm_util.h renamed from tools/testing/selftests/mm/vm_util.h~selftests-mm-uffd_open_devsys +2 -0
@@ -48,6 +48,8 @@ unsigned long default_huge_page_size(voiint uffd_register (int uffd,void *addr,uint64_t len,bool miss,bool wp,bool minor);int uffd_unregister (int uffd,void *addr,uint64_t len); +int uffd_open_dev (unsigned int flags); +int uffd_open_sys (unsigned int flags);/* * On ppc64 this will only work with radix 2M hugepage size
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-uffdio_api-test.patch selftests-mm-drop-global-mem_fd-in-uffd-tests.patch selftests-mm-drop-global-hpage_size-in-uffd-tests.patch selftests-mm-rename-uffd_stats-to-uffd_args.patch selftests-mm-let-uffd_handle_page_fault-take-wp-parameter.patch selftests-mm-allow-allocate_area-to-fail-properly.patch selftests-mm-add-framework-for-uffd-unit-test.patch selftests-mm-move-uffd-pagemap-test-to-unit-test.patch selftests-mm-move-uffd-minor-test-to-unit-test.patch 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