Lines Matching full:vec
43 static long pagemap_ioctl(void *start, int len, void *vec, int vec_len, int flag, in pagemap_ioctl() argument
51 arg.vec = (uintptr_t)vec; in pagemap_ioctl()
64 static long pagemap_ioc(void *start, int len, void *vec, int vec_len, int flag, in pagemap_ioc() argument
73 arg.vec = (uintptr_t)vec; in pagemap_ioc()
188 char *mem, *vec; in userfaultfd_tests() local
211 vec = malloc(sizeof(struct page_region) * vec_size); in userfaultfd_tests()
213 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in userfaultfd_tests()
222 free(vec); in userfaultfd_tests()
226 int get_reads(struct page_region *vec, int vec_size) in get_reads() argument
231 sum += LEN(vec[i]); in get_reads()
240 struct page_region *vec, *vec2; in sanity_tests_sd() local
247 vec = malloc(sizeof(struct page_region) * vec_size); in sanity_tests_sd()
248 if (!vec) in sanity_tests_sd()
263 ksft_test_result(pagemap_ioctl(mem, 0, vec, vec_size, 0, in sanity_tests_sd()
271 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, 0, 0, in sanity_tests_sd()
279 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, -1, in sanity_tests_sd()
283 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
288 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
292 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
296 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
300 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
305 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
311 /* 2. Clear area with larger vec size */ in sanity_tests_sd()
312 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
315 ksft_test_result(ret >= 0, "%s Clear area with larger vec size\n", __func__); in sanity_tests_sd()
321 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, PAGE_IS_WRITTEN, 0, in sanity_tests_sd()
330 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
336 ret2 = pagemap_ioctl(mem, mem_size, vec, 2, 0, 0, PAGE_IS_WRITTEN, 0, 0, in sanity_tests_sd()
341 ret3 = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
356 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
362 ret2 = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
377 ret = pagemap_ioctl(mem + page_size, 2 * page_size, vec, 1, in sanity_tests_sd()
388 ksft_test_result(ret == 1 && LEN(vec[0]) == 2 && in sanity_tests_sd()
389 vec[0].start == (uintptr_t)(mem + page_size) && in sanity_tests_sd()
416 ret = pagemap_ioctl(m[1], mem_size, vec, 1, 0, 0, PAGE_IS_WRITTEN, 0, 0, in sanity_tests_sd()
421 ksft_test_result(ret == 1 && LEN(vec[0]) == mem_size/page_size, in sanity_tests_sd()
429 free(vec); in sanity_tests_sd()
432 /* 8. Smaller vec */ in sanity_tests_sd()
436 vec = malloc(sizeof(struct page_region) * vec_size); in sanity_tests_sd()
437 if (!vec) in sanity_tests_sd()
447 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
456 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
464 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
472 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests_sd()
482 free(vec); in sanity_tests_sd()
487 /* 9. Smaller vec */ in sanity_tests_sd()
491 vec = malloc(sizeof(struct page_region) * vec_size); in sanity_tests_sd()
492 if (!vec) in sanity_tests_sd()
514 ret = pagemap_ioc((void *)walk_end, mem_size-(walk_end - (long)mem), vec, in sanity_tests_sd()
523 reads = get_reads(vec, ret); in sanity_tests_sd()
531 ksft_test_result(count == TEST_ITERATIONS, "Smaller vec\n"); in sanity_tests_sd()
533 free(vec); in sanity_tests_sd()
541 vec = malloc(sizeof(struct page_region) * vec_size); in sanity_tests_sd()
542 if (!vec) in sanity_tests_sd()
554 ret = pagemap_ioc(mem, 0, vec, vec_size, 0, in sanity_tests_sd()
561 ret = pagemap_ioc(mem, 0, vec, vec_size, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in sanity_tests_sd()
568 ret = pagemap_ioc(mem, 0, vec, 0, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in sanity_tests_sd()
575 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
580 "Walk_end: Big vec\n"); in sanity_tests_sd()
582 ret = pagemap_ioc(mem, mem_size, vec, 1, 0, in sanity_tests_sd()
587 "Walk_end: vec of minimum length\n"); in sanity_tests_sd()
589 ret = pagemap_ioc(mem, mem_size, vec, 1, 0, in sanity_tests_sd()
596 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
603 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
610 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
621 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
626 "Walk_end sparse: Big vec\n"); in sanity_tests_sd()
628 ret = pagemap_ioc(mem, mem_size, vec, 1, 0, in sanity_tests_sd()
633 "Walk_end sparse: vec of minimum length\n"); in sanity_tests_sd()
635 ret = pagemap_ioc(mem, mem_size, vec, 1, 0, in sanity_tests_sd()
642 ret = pagemap_ioc(mem, mem_size, vec, vec_size/2, 0, in sanity_tests_sd()
649 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
656 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
663 ret = pagemap_ioc(mem, mem_size, vec, vec_size, 0, in sanity_tests_sd()
670 free(vec); in sanity_tests_sd()
680 struct page_region *vec, *vec2; in base_tests() local
694 vec = malloc(sizeof(struct page_region) * vec_size); in base_tests()
698 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in base_tests()
708 written = pagemap_ioctl(mem, mem_size, vec, 1, 0, 0, PAGE_IS_WRITTEN, 0, 0, in base_tests()
713 ksft_test_result(written == 1 && LEN(vec[0]) == mem_size/page_size, in base_tests()
717 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in base_tests()
724 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in base_tests()
729 ksft_test_result(written == 1 && LEN(vec[0]) >= vec_size - 2 && LEN(vec[0]) <= vec_size, in base_tests()
732 written = pagemap_ioctl(mem, mem_size, vec, 1, 0, 0, in base_tests()
741 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in base_tests()
748 written = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, PAGE_IS_WRITTEN, in base_tests()
753 ksft_test_result(written == 1 && LEN(vec[0]) >= 1, in base_tests()
757 written = pagemap_ioctl(mem, mem_size, vec, 1, PM_SCAN_WP_MATCHING | PM_SCAN_CHECK_WPASYNC, in base_tests()
765 written = pagemap_ioctl(&mem[vec_size/2 * page_size], 2 * page_size, vec, 1, 0, in base_tests()
770 ksft_test_result(written == 1 && vec[0].start == (uintptr_t)(&mem[vec_size/2 * page_size]) in base_tests()
771 && LEN(vec[0]) == 2, in base_tests()
774 free(vec); in base_tests()
804 struct page_region *vec, *vec2; in hpage_unit_tests() local
806 vec = malloc(sizeof(struct page_region) * vec_size); in hpage_unit_tests()
808 if (!vec || !vec2) in hpage_unit_tests()
817 ret = pagemap_ioctl(map, map_size, vec, vec_size, in hpage_unit_tests()
827 ret = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
836 ret = pagemap_ioctl(map, map_size, vec, vec_size, in hpage_unit_tests()
842 ksft_test_result(ret == 1 && vec[0].start == (uintptr_t)map && in hpage_unit_tests()
843 LEN(vec[0]) == vec_size && vec[0].categories == PAGE_IS_WRITTEN, in hpage_unit_tests()
854 ret = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
859 ksft_test_result(ret == 1 && LEN(vec[0]) > 0, in hpage_unit_tests()
881 ret = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
886 ksft_test_result(ret == 1 && LEN(vec[0]) == vec_size/2 && in hpage_unit_tests()
887 vec[0].start == (uintptr_t)(map + map_size/2), in hpage_unit_tests()
903 ret = pagemap_ioctl(map, map_size, vec, vec_size, in hpage_unit_tests()
909 ret = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
914 ksft_test_result(ret == 1 && LEN(vec[0]) == vec_size/2 && in hpage_unit_tests()
915 vec[0].start == (uintptr_t)(map + map_size/2), in hpage_unit_tests()
933 ret = pagemap_ioctl(map + map_size/2, map_size/2, vec, vec_size, in hpage_unit_tests()
939 ret = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
944 ksft_test_result(ret == 1 && LEN(vec[0]) == vec_size/2, in hpage_unit_tests()
961 ret = pagemap_ioctl(map, map_size, vec, 1, in hpage_unit_tests()
968 ksft_test_result(ret == 1 && LEN(vec[0]) == hpage_size/(2*page_size), in hpage_unit_tests()
971 ret2 = pagemap_ioctl(map, map_size, vec, vec_size, 0, 0, in hpage_unit_tests()
976 ksft_test_result(ret2 == 1 && LEN(vec[0]) == (map_size - hpage_size/2)/page_size, in hpage_unit_tests()
986 free(vec); in hpage_unit_tests()
996 struct page_region *vec = malloc(sizeof(struct page_region) * vec_size); in unmapped_region_tests() local
999 written = pagemap_ioctl(start, len, vec, vec_size, 0, 0, in unmapped_region_tests()
1006 free(vec); in unmapped_region_tests()
1014 struct page_region vec; in test_simple() local
1024 if (pagemap_ioctl(map, page_size, &vec, 1, 0, 0, in test_simple()
1034 if (pagemap_ioctl(map, page_size, &vec, 1, 0, 0, in test_simple()
1051 struct page_region *vec; in sanity_tests() local
1060 vec = malloc(sizeof(struct page_region) * vec_size); in sanity_tests()
1062 if (mem == MAP_FAILED || vec == MAP_FAILED) in sanity_tests()
1068 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests()
1072 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1075 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1078 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1081 ksft_test_result(pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1097 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1099 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)mem && LEN(vec[0]) == vec_size && in sanity_tests()
1100 (vec[0].categories & (PAGE_IS_WRITTEN | PAGE_IS_PRESENT)) == in sanity_tests()
1105 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1107 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)mem && LEN(vec[0]) == vec_size && in sanity_tests()
1108 (vec[0].categories & (PAGE_IS_WRITTEN | PAGE_IS_PRESENT)) == in sanity_tests()
1113 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1115 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)mem && LEN(vec[0]) == vec_size && in sanity_tests()
1116 (vec[0].categories & (PAGE_IS_WRITTEN | PAGE_IS_PRESENT)) == in sanity_tests()
1122 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1127 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, 0, 0, in sanity_tests()
1143 ret = pagemap_ioctl(mem, mem_size, vec, vec_size, in sanity_tests()
1146 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)mem && LEN(vec[0]) == vec_size && in sanity_tests()
1147 vec[0].categories == PAGE_IS_WRITTEN, in sanity_tests()
1168 ret = pagemap_ioctl(fmem, sbuf.st_size, vec, vec_size, 0, 0, in sanity_tests()
1171 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)fmem && in sanity_tests()
1172 LEN(vec[0]) == ceilf((float)sbuf.st_size/page_size) && in sanity_tests()
1173 (vec[0].categories & PAGE_IS_FILE), in sanity_tests()
1203 ret = pagemap_ioctl(fmem, buf_size, vec, vec_size, 0, 0, in sanity_tests()
1207 ksft_test_result(ret >= 0 && vec[0].start == (uintptr_t)fmem && in sanity_tests()
1208 LEN(vec[0]) == (buf_size/page_size) && in sanity_tests()
1209 (vec[0].categories & PAGE_IS_WRITTEN), in sanity_tests()
1216 free(vec); in sanity_tests()
1224 struct page_region vec; in mprotect_tests() local
1242 ret = pagemap_ioctl(mem, 2 * page_size, &vec, 1, 0, 0, PAGE_IS_WRITTEN, in mprotect_tests()
1247 ksft_test_result(ret == 1 && LEN(vec) == 2, "%s Both pages written\n", __func__); in mprotect_tests()
1252 ksft_test_result(pagemap_ioctl(mem, 2 * page_size, &vec, 1, 0, 0, in mprotect_tests()
1277 ret = pagemap_ioctl(mem, 2 * page_size, &vec, 1, 0, 0, PAGE_IS_WRITTEN, in mprotect_tests()
1282 ksft_test_result(ret == 1 && LEN(vec) == 2, in mprotect_tests()
1290 ret = pagemap_ioctl(mem, 2 * page_size, &vec, 1, 0, 0, PAGE_IS_WRITTEN, in mprotect_tests()
1295 ksft_test_result(ret == 1 && LEN(vec) == 2, in mprotect_tests()
1321 arg.vec = (uintptr_t)rgns; in get_dirty_pages_reset()