Home
last modified time | relevance | path

Searched refs:uffd (Results 1 – 21 of 21) sorted by relevance

/linux-6.6.21/tools/testing/selftests/kvm/lib/
Duserfaultfd_util.c31 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/
Dbpf_mod_race.c67 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/
Duffd-unit-tests.c126 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 …]
Duffd-common.c15 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 …]
Duffd-stress.c139 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 …]
Dhugepage-mremap.c63 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()
Dmkdirty.c275 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()
Dvm_util.c229 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()
DMakefile65 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
Dvm_util.h49 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,
Dksm_functional_tests.c342 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.gitignore25 uffd-stress
26 uffd-unit-tests
Duffd-common.h95 extern int uffd, uffd_flags, finished, *pipefd, test_type;
Drun_vmtests.sh244 CATEGORY="userfaultfd" run_test ./uffd-unit-tests
245 uffd_stress_bin=./uffd-stress
/linux-6.6.21/tools/testing/selftests/powerpc/tm/
Dtm-signal-pagefault.c86 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/
Duserfaultfd_util.h18 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/
Dtest_shadow_stack.c457 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/
Ddemand_paging_test.c60 static int handle_uffd_page_request(int uffd_mode, int uffd, in handle_uffd_page_request() argument
79 r = ioctl(uffd, UFFDIO_COPY, &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/
Dpage_fault_test.c310 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, &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/
Duserfaultfd.rst184 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
Dpagemap.rst22 * Bit 57 pte is uffd-wp write-protected (since 5.13) (see