/linux-6.6.21/tools/testing/selftests/kvm/lib/ |
D | userfaultfd_util.c | 31 int uffd = uffd_desc->uffd; in uffd_handler_thread_fn() local 45 pollfd[0].fd = uffd; in uffd_handler_thread_fn() 79 r = read(uffd, &msg, sizeof(msg)); in uffd_handler_thread_fn() 97 r = uffd_desc->handler(uffd_desc->uffd_mode, uffd, &msg); in uffd_handler_thread_fn() 117 int uffd; in uffd_setup_demand_paging() local 134 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in uffd_setup_demand_paging() 135 TEST_ASSERT(uffd >= 0, "uffd creation failed, errno: %d", errno); in uffd_setup_demand_paging() 139 TEST_ASSERT(ioctl(uffd, UFFDIO_API, &uffdio_api) != -1, in uffd_setup_demand_paging() 146 TEST_ASSERT(ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) != -1, in uffd_setup_demand_paging() 155 uffd_desc->uffd = uffd; in uffd_setup_demand_paging() [all …]
|
/linux-6.6.21/tools/testing/selftests/bpf/prog_tests/ |
D | bpf_mod_race.c | 67 int uffd; in test_setup_uffd() local 69 uffd = sys_userfaultfd(O_CLOEXEC); in test_setup_uffd() 70 if (uffd < 0) in test_setup_uffd() 75 if (ioctl(uffd, UFFDIO_API, &uffd_api)) { in test_setup_uffd() 76 close(uffd); in test_setup_uffd() 83 if (ioctl(uffd, UFFDIO_REGISTER, &uffd_register)) { in test_setup_uffd() 84 close(uffd); in test_setup_uffd() 87 return uffd; in test_setup_uffd() 97 int uffd, ret; in test_bpf_mod_race_config() local 120 uffd = test_setup_uffd(fault_addr); in test_bpf_mod_race_config() [all …]
|
/linux-6.6.21/tools/testing/selftests/mm/ |
D | uffd-unit-tests.c | 126 int uffd; in test_uffd_api() local 132 uffd = uffd_open_dev(UFFD_FLAGS); in test_uffd_api() 134 uffd = uffd_open_sys(UFFD_FLAGS); in test_uffd_api() 135 if (uffd < 0) { in test_uffd_api() 143 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == 0) { in test_uffd_api() 151 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == 0) { in test_uffd_api() 159 if (ioctl(uffd, UFFDIO_API, &uffdio_api)) { in test_uffd_api() 166 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == 0) { in test_uffd_api() 173 close(uffd); in test_uffd_api() 297 static int pagemap_test_fork(int uffd, bool with_event, bool test_pin) in pagemap_test_fork() argument [all …]
|
D | uffd-common.c | 15 int uffd = -1, uffd_flags, finished, *pipefd, test_type; variable 239 uffd = uffd_open(UFFD_FLAGS); in userfaultfd_open() 240 if (uffd < 0) in userfaultfd_open() 242 uffd_flags = fcntl(uffd, F_GETFD, NULL); in userfaultfd_open() 246 if (ioctl(uffd, UFFDIO_API, &uffdio_api)) in userfaultfd_open() 283 if (uffd != -1) { in uffd_test_ctx_clear() 284 if (close(uffd)) in uffd_test_ctx_clear() 286 uffd = -1; in uffd_test_ctx_clear() 409 int ret = read(uffd, msg, sizeof(*msg)); in uffd_read_msg() 433 wp_range(uffd, msg->arg.pagefault.address, page_size, false); in uffd_handle_page_fault() [all …]
|
D | uffd-stress.c | 139 if (uffd_read_msg(uffd, &msg)) in uffd_read_thread() 158 copy_page_retry(uffd, page_nr * page_size); in background_thread() 166 wp_range(uffd, (unsigned long)area_dst + start_nr * page_size, in background_thread() 174 copy_page_retry(uffd, page_nr * page_size); in background_thread() 282 fcntl(uffd, F_SETFL, uffd_flags | O_NONBLOCK); in userfaultfd_stress() 284 fcntl(uffd, F_SETFL, uffd_flags & ~O_NONBLOCK); in userfaultfd_stress() 287 if (uffd_register(uffd, area_dst, mem_size, in userfaultfd_stress() 292 if (uffd_register(uffd, area_dst_alias, mem_size, in userfaultfd_stress() 331 wp_range(uffd, (unsigned long)area_dst, in userfaultfd_stress() 335 if (uffd_unregister(uffd, area_dst, mem_size)) in userfaultfd_stress() [all …]
|
D | hugepage-mremap.c | 63 long uffd; /* userfaultfd file descriptor */ in register_region_with_uffd() local 68 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in register_region_with_uffd() 69 if (uffd == -1) { in register_region_with_uffd() 76 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1) { in register_region_with_uffd() 100 if (uffd_register(uffd, addr, len, true, false, false)) { in register_region_with_uffd()
|
D | mkdirty.c | 275 int uffd; in test_uffdio_copy() local 287 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in test_uffdio_copy() 288 if (uffd < 0) { in test_uffdio_copy() 295 if (ioctl(uffd, UFFDIO_API, &uffdio_api) < 0) { in test_uffdio_copy() 303 if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) { in test_uffdio_copy() 313 if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy)) { in test_uffdio_copy() 320 close(uffd); in test_uffdio_copy()
|
D | vm_util.c | 229 int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len, in uffd_register_with_ioctls() argument 247 if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) in uffd_register_with_ioctls() 255 int uffd_register(int uffd, void *addr, uint64_t len, in uffd_register() argument 258 return uffd_register_with_ioctls(uffd, addr, len, in uffd_register() 262 int uffd_unregister(int uffd, void *addr, uint64_t len) in uffd_unregister() argument 267 if (ioctl(uffd, UFFDIO_UNREGISTER, &range) == -1) in uffd_unregister()
|
D | Makefile | 65 TEST_GEN_FILES += uffd-stress 66 TEST_GEN_FILES += uffd-unit-tests 121 $(OUTPUT)/uffd-stress: uffd-common.c 122 $(OUTPUT)/uffd-unit-tests: uffd-common.c
|
D | vm_util.h | 49 int uffd_register(int uffd, void *addr, uint64_t len, 51 int uffd_unregister(int uffd, void *addr, uint64_t len); 52 int uffd_register_with_ioctls(int uffd, void *addr, uint64_t len,
|
D | ksm_functional_tests.c | 342 int uffd; in test_unmerge_uffd_wp() local 351 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in test_unmerge_uffd_wp() 352 if (uffd < 0) { in test_unmerge_uffd_wp() 360 if (ioctl(uffd, UFFDIO_API, &uffdio_api) < 0) { in test_unmerge_uffd_wp() 370 if (uffd_register(uffd, map, size, false, true, false)) { in test_unmerge_uffd_wp() 379 if (ioctl(uffd, UFFDIO_WRITEPROTECT, &uffd_writeprotect)) { in test_unmerge_uffd_wp() 392 close(uffd); in test_unmerge_uffd_wp()
|
D | .gitignore | 25 uffd-stress 26 uffd-unit-tests
|
D | uffd-common.h | 95 extern int uffd, uffd_flags, finished, *pipefd, test_type;
|
D | run_vmtests.sh | 244 CATEGORY="userfaultfd" run_test ./uffd-unit-tests 245 uffd_stress_bin=./uffd-stress
|
/linux-6.6.21/tools/testing/selftests/powerpc/tm/ |
D | tm-signal-pagefault.c | 86 long uffd; /* userfaultfd file descriptor */ in fault_handler_thread() local 91 uffd = (long) arg; in fault_handler_thread() 94 pollfd.fd = uffd; in fault_handler_thread() 101 nread = read(uffd, &msg, sizeof(msg)); in fault_handler_thread() 130 if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1) { in fault_handler_thread() 139 long uffd; /* userfaultfd file descriptor */ in setup_uf_mem() local 148 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in setup_uf_mem() 149 if (uffd == -1) { in setup_uf_mem() 155 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1) { in setup_uf_mem() 180 if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) { in setup_uf_mem() [all …]
|
/linux-6.6.21/tools/testing/selftests/kvm/include/ |
D | userfaultfd_util.h | 18 typedef int (*uffd_handler_t)(int uffd_mode, int uffd, struct uffd_msg *msg); 22 int uffd; member 33 void uffd_stop_demand_paging(struct uffd_desc *uffd);
|
/linux-6.6.21/tools/testing/selftests/x86/ |
D | test_shadow_stack.c | 457 int uffd = *(int *)arg; in uffd_thread() local 462 ret = read(uffd, &msg, sizeof(msg)); in uffd_thread() 475 if (ioctl(uffd, UFFDIO_COPY, &req)) in uffd_thread() 488 int uffd; in test_userfaultfd() local 495 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); in test_userfaultfd() 496 if (uffd < 0) { in test_userfaultfd() 505 if (ioctl(uffd, UFFDIO_API, &uffdio_api)) in test_userfaultfd() 511 if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register)) in test_userfaultfd() 514 if (pthread_create(&thread, NULL, &uffd_thread, &uffd)) in test_userfaultfd() 535 close(uffd); in test_userfaultfd()
|
/linux-6.6.21/tools/testing/selftests/kvm/ |
D | demand_paging_test.c | 60 static int handle_uffd_page_request(int uffd_mode, int uffd, in handle_uffd_page_request() argument 79 r = ioctl(uffd, UFFDIO_COPY, ©); in handle_uffd_page_request() 91 r = ioctl(uffd, UFFDIO_CONTINUE, &cont); in handle_uffd_page_request()
|
/linux-6.6.21/tools/testing/selftests/kvm/aarch64/ |
D | page_fault_test.c | 310 static int uffd_generic_handler(int uffd_mode, int uffd, struct uffd_msg *msg, in uffd_generic_handler() argument 330 ret = ioctl(uffd, UFFDIO_COPY, ©); in uffd_generic_handler() 343 static int uffd_pt_handler(int mode, int uffd, struct uffd_msg *msg) in uffd_pt_handler() argument 345 return uffd_generic_handler(mode, uffd, msg, &pt_args); in uffd_pt_handler() 348 static int uffd_data_handler(int mode, int uffd, struct uffd_msg *msg) in uffd_data_handler() argument 350 return uffd_generic_handler(mode, uffd, msg, &data_args); in uffd_data_handler() 400 static int uffd_no_handler(int mode, int uffd, struct uffd_msg *msg) in uffd_no_handler() argument 790 .name = SCAT4(uffd, _access, _with_af, #_mark_cmd), \
|
/linux-6.6.21/Documentation/admin-guide/mm/ |
D | userfaultfd.rst | 184 uffd. You can supply as many pages as you want with these IOCTLs. 200 ``ioctl(uffd, UFFDIO_WRITEPROTECT, struct *uffdio_writeprotect)`` 205 Then, in the thread reading from uffd the struct will have 207 ``ioctl(uffd, UFFDIO_WRITEPROTECT, struct *uffdio_writeprotect)`` 210 allows you to do the bookkeeping about the write in the uffd reading
|
D | pagemap.rst | 22 * Bit 57 pte is uffd-wp write-protected (since 5.13) (see
|