uringmachine 0.16 → 0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +3 -0
- data/.gitmodules +4 -0
- data/CHANGELOG.md +8 -0
- data/TODO.md +12 -3
- data/examples/bm_send.rb +86 -0
- data/ext/um/um.c +28 -1
- data/ext/um/um.h +3 -0
- data/ext/um/um_class.c +17 -0
- data/ext/um/um_utils.c +38 -15
- data/lib/uringmachine/version.rb +1 -1
- data/test/test_um.rb +76 -0
- data/vendor/libressl/.github/scripts/changelog.sh +74 -0
- data/vendor/libressl/.github/workflows/android.yml +35 -0
- data/vendor/libressl/.github/workflows/cifuzz.yml +33 -0
- data/vendor/libressl/.github/workflows/cmake-config.yml +98 -0
- data/vendor/libressl/.github/workflows/coverity.yml +69 -0
- data/vendor/libressl/.github/workflows/emscripten.yml +71 -0
- data/vendor/libressl/.github/workflows/fedora-rawhide.yml +39 -0
- data/vendor/libressl/.github/workflows/freebsd.yml +71 -0
- data/vendor/libressl/.github/workflows/linux.yml +71 -0
- data/vendor/libressl/.github/workflows/macos.yml +37 -0
- data/vendor/libressl/.github/workflows/release.yml +81 -0
- data/vendor/libressl/.github/workflows/rust-openssl.yml +47 -0
- data/vendor/libressl/.github/workflows/solaris.yml +37 -0
- data/vendor/libressl/.github/workflows/windows.yml +70 -0
- data/vendor/libressl/.gitignore +333 -0
- data/vendor/libressl/CMakeLists.txt +581 -0
- data/vendor/libressl/COPYING +133 -0
- data/vendor/libressl/ChangeLog +3280 -0
- data/vendor/libressl/FindLibreSSL.cmake +232 -0
- data/vendor/libressl/LibreSSLConfig.cmake.in +36 -0
- data/vendor/libressl/Makefile.am +60 -0
- data/vendor/libressl/Makefile.am.common +20 -0
- data/vendor/libressl/OPENBSD_BRANCH +1 -0
- data/vendor/libressl/README.md +238 -0
- data/vendor/libressl/README.mingw.md +43 -0
- data/vendor/libressl/apps/CMakeLists.txt +18 -0
- data/vendor/libressl/apps/Makefile.am +5 -0
- data/vendor/libressl/apps/nc/CMakeLists.txt +67 -0
- data/vendor/libressl/apps/nc/Makefile.am +64 -0
- data/vendor/libressl/apps/nc/compat/accept4.c +17 -0
- data/vendor/libressl/apps/nc/compat/readpassphrase.c +205 -0
- data/vendor/libressl/apps/nc/compat/socket.c +29 -0
- data/vendor/libressl/apps/nc/compat/sys/socket.h +30 -0
- data/vendor/libressl/apps/ocspcheck/CMakeLists.txt +44 -0
- data/vendor/libressl/apps/ocspcheck/Makefile.am +45 -0
- data/vendor/libressl/apps/ocspcheck/compat/.gitignore +0 -0
- data/vendor/libressl/apps/openssl/CMakeLists.txt +97 -0
- data/vendor/libressl/apps/openssl/Makefile.am +108 -0
- data/vendor/libressl/apps/openssl/apps_win.c +138 -0
- data/vendor/libressl/apps/openssl/certhash_win.c +13 -0
- data/vendor/libressl/apps/openssl/compat/clock_gettime_osx.c +26 -0
- data/vendor/libressl/apps/openssl/compat/poll_win.c +329 -0
- data/vendor/libressl/appveyor.yml +53 -0
- data/vendor/libressl/autogen.sh +15 -0
- data/vendor/libressl/check-release.sh +86 -0
- data/vendor/libressl/cmake_export_symbol.cmake +71 -0
- data/vendor/libressl/cmake_uninstall.cmake.in +36 -0
- data/vendor/libressl/config +17 -0
- data/vendor/libressl/configure.ac +165 -0
- data/vendor/libressl/crypto/CMakeLists.txt +863 -0
- data/vendor/libressl/crypto/Makefile.am +962 -0
- data/vendor/libressl/crypto/Makefile.am.arc4random +46 -0
- data/vendor/libressl/crypto/Makefile.am.elf-mips +14 -0
- data/vendor/libressl/crypto/Makefile.am.elf-mips64 +14 -0
- data/vendor/libressl/crypto/Makefile.am.elf-x86_64 +35 -0
- data/vendor/libressl/crypto/Makefile.am.macosx-x86_64 +35 -0
- data/vendor/libressl/crypto/Makefile.am.masm-x86_64 +22 -0
- data/vendor/libressl/crypto/Makefile.am.mingw64-x86_64 +23 -0
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_darwin.c +60 -0
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_linux.c +62 -0
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_none.c +26 -0
- data/vendor/libressl/crypto/arch/aarch64/crypto_cpu_caps_windows.c +36 -0
- data/vendor/libressl/crypto/arch/loongarch64/crypto_arch.h +21 -0
- data/vendor/libressl/crypto/arch/mips/crypto_arch.h +21 -0
- data/vendor/libressl/crypto/bn/arch/loongarch64/bn_arch.h +23 -0
- data/vendor/libressl/crypto/bn/arch/mips/bn_arch.h +24 -0
- data/vendor/libressl/crypto/compat/.gitignore +31 -0
- data/vendor/libressl/crypto/compat/arc4random.h +41 -0
- data/vendor/libressl/crypto/compat/b_win.c +55 -0
- data/vendor/libressl/crypto/compat/bsd-asprintf.c +96 -0
- data/vendor/libressl/crypto/compat/crypto_lock_win.c +56 -0
- data/vendor/libressl/crypto/compat/explicit_bzero_win.c +13 -0
- data/vendor/libressl/crypto/compat/freezero.c +32 -0
- data/vendor/libressl/crypto/compat/getdelim.c +78 -0
- data/vendor/libressl/crypto/compat/getline.c +40 -0
- data/vendor/libressl/crypto/compat/getopt_long.c +528 -0
- data/vendor/libressl/crypto/compat/getpagesize.c +18 -0
- data/vendor/libressl/crypto/compat/getprogname_linux.c +23 -0
- data/vendor/libressl/crypto/compat/getprogname_unimpl.c +7 -0
- data/vendor/libressl/crypto/compat/getprogname_windows.c +13 -0
- data/vendor/libressl/crypto/compat/posix_win.c +296 -0
- data/vendor/libressl/crypto/compat/syslog_r.c +19 -0
- data/vendor/libressl/crypto/compat/ui_openssl_win.c +334 -0
- data/vendor/libressl/dist.sh +22 -0
- data/vendor/libressl/gen-coverage-report.sh +58 -0
- data/vendor/libressl/gen-openbsd-tags.sh +20 -0
- data/vendor/libressl/include/CMakeLists.txt +61 -0
- data/vendor/libressl/include/Makefile.am +79 -0
- data/vendor/libressl/include/arch/loongarch64/opensslconf.h +150 -0
- data/vendor/libressl/include/arch/mips/opensslconf.h +150 -0
- data/vendor/libressl/include/compat/arpa/inet.h +15 -0
- data/vendor/libressl/include/compat/arpa/nameser.h +25 -0
- data/vendor/libressl/include/compat/cet.h +19 -0
- data/vendor/libressl/include/compat/dirent.h +17 -0
- data/vendor/libressl/include/compat/dirent_msvc.h +611 -0
- data/vendor/libressl/include/compat/endian.h +161 -0
- data/vendor/libressl/include/compat/err.h +95 -0
- data/vendor/libressl/include/compat/fcntl.h +32 -0
- data/vendor/libressl/include/compat/getopt.h +50 -0
- data/vendor/libressl/include/compat/limits.h +25 -0
- data/vendor/libressl/include/compat/netdb.h +10 -0
- data/vendor/libressl/include/compat/netinet/in.h +19 -0
- data/vendor/libressl/include/compat/netinet/ip.h +49 -0
- data/vendor/libressl/include/compat/netinet/tcp.h +10 -0
- data/vendor/libressl/include/compat/poll.h +63 -0
- data/vendor/libressl/include/compat/pthread.h +122 -0
- data/vendor/libressl/include/compat/readpassphrase.h +44 -0
- data/vendor/libressl/include/compat/resolv.h +24 -0
- data/vendor/libressl/include/compat/stdint.h +31 -0
- data/vendor/libressl/include/compat/stdio.h +65 -0
- data/vendor/libressl/include/compat/stdlib.h +57 -0
- data/vendor/libressl/include/compat/string.h +98 -0
- data/vendor/libressl/include/compat/sys/_null.h +18 -0
- data/vendor/libressl/include/compat/sys/ioctl.h +11 -0
- data/vendor/libressl/include/compat/sys/mman.h +19 -0
- data/vendor/libressl/include/compat/sys/param.h +15 -0
- data/vendor/libressl/include/compat/sys/queue.h +536 -0
- data/vendor/libressl/include/compat/sys/select.h +10 -0
- data/vendor/libressl/include/compat/sys/socket.h +18 -0
- data/vendor/libressl/include/compat/sys/stat.h +129 -0
- data/vendor/libressl/include/compat/sys/time.h +37 -0
- data/vendor/libressl/include/compat/sys/tree.h +1006 -0
- data/vendor/libressl/include/compat/sys/types.h +69 -0
- data/vendor/libressl/include/compat/sys/uio.h +17 -0
- data/vendor/libressl/include/compat/syslog.h +38 -0
- data/vendor/libressl/include/compat/time.h +59 -0
- data/vendor/libressl/include/compat/unistd.h +83 -0
- data/vendor/libressl/include/compat/win32netcompat.h +57 -0
- data/vendor/libressl/include/openssl/Makefile.am.tpl +45 -0
- data/vendor/libressl/libcrypto.pc.in +28 -0
- data/vendor/libressl/libressl.pub +2 -0
- data/vendor/libressl/libssl.pc.in +28 -0
- data/vendor/libressl/libtls.pc.in +28 -0
- data/vendor/libressl/m4/ax_add_fortify_source.m4 +80 -0
- data/vendor/libressl/m4/ax_check_compile_flag.m4 +53 -0
- data/vendor/libressl/m4/check-hardening-options.m4 +110 -0
- data/vendor/libressl/m4/check-libc.m4 +189 -0
- data/vendor/libressl/m4/check-os-options.m4 +181 -0
- data/vendor/libressl/m4/disable-compiler-warnings.m4 +44 -0
- data/vendor/libressl/man/CMakeLists.txt +26 -0
- data/vendor/libressl/man/links +2780 -0
- data/vendor/libressl/man/update_links.sh +25 -0
- data/vendor/libressl/openssl.pc.in +11 -0
- data/vendor/libressl/patches/bn_shift.patch +34 -0
- data/vendor/libressl/patches/crypto_arch.h.patch +34 -0
- data/vendor/libressl/patches/crypto_namespace.h.patch +22 -0
- data/vendor/libressl/patches/netcat.c.patch +178 -0
- data/vendor/libressl/patches/openssl.c.patch +12 -0
- data/vendor/libressl/patches/opensslfeatures.h.patch +49 -0
- data/vendor/libressl/patches/patch-amd64-crypto-cpu-caps.c.patch +20 -0
- data/vendor/libressl/patches/patch-i386-crypto-cpu-caps.c.patch +20 -0
- data/vendor/libressl/patches/speed.c.patch +114 -0
- data/vendor/libressl/patches/ssl_namespace.h.patch +21 -0
- data/vendor/libressl/patches/tls.h.patch +16 -0
- data/vendor/libressl/patches/tls_config.c.patch +15 -0
- data/vendor/libressl/patches/win32_amd64_bn_arch.h.patch +28 -0
- data/vendor/libressl/patches/windows_headers.patch +80 -0
- data/vendor/libressl/scripts/config.guess +1774 -0
- data/vendor/libressl/scripts/config.sub +1907 -0
- data/vendor/libressl/scripts/i686-w64-mingw32.cmake +9 -0
- data/vendor/libressl/scripts/test +210 -0
- data/vendor/libressl/scripts/wrap-compiler-for-flag-check +31 -0
- data/vendor/libressl/scripts/x86_64-w64-mingw32.cmake +9 -0
- data/vendor/libressl/ssl/CMakeLists.txt +183 -0
- data/vendor/libressl/ssl/Makefile.am +187 -0
- data/vendor/libressl/tests/CMakeLists.txt +970 -0
- data/vendor/libressl/tests/Makefile.am +944 -0
- data/vendor/libressl/tests/aeadtest.sh +30 -0
- data/vendor/libressl/tests/arc4randomforktest.sh +21 -0
- data/vendor/libressl/tests/asn1time_small.test +10 -0
- data/vendor/libressl/tests/cmake/CMakeLists.txt +52 -0
- data/vendor/libressl/tests/cmake/crypto.c +7 -0
- data/vendor/libressl/tests/cmake/ssl.c +6 -0
- data/vendor/libressl/tests/cmake/tls.c +6 -0
- data/vendor/libressl/tests/compat/pipe2.c +186 -0
- data/vendor/libressl/tests/dtlstest.sh +28 -0
- data/vendor/libressl/tests/evptest.sh +22 -0
- data/vendor/libressl/tests/keypairtest.sh +27 -0
- data/vendor/libressl/tests/mlkem_tests.sh +39 -0
- data/vendor/libressl/tests/ocsptest.bat +25 -0
- data/vendor/libressl/tests/ocsptest.sh +23 -0
- data/vendor/libressl/tests/openssl.cnf +29 -0
- data/vendor/libressl/tests/optionstest.c +381 -0
- data/vendor/libressl/tests/pidwraptest.c +85 -0
- data/vendor/libressl/tests/pidwraptest.sh +26 -0
- data/vendor/libressl/tests/quictest.bat +27 -0
- data/vendor/libressl/tests/quictest.sh +30 -0
- data/vendor/libressl/tests/renegotiation_test.bat +27 -0
- data/vendor/libressl/tests/renegotiation_test.sh +30 -0
- data/vendor/libressl/tests/rfc5280time_small.test +10 -0
- data/vendor/libressl/tests/servertest.bat +27 -0
- data/vendor/libressl/tests/servertest.sh +30 -0
- data/vendor/libressl/tests/shutdowntest.bat +27 -0
- data/vendor/libressl/tests/shutdowntest.sh +30 -0
- data/vendor/libressl/tests/ssltest.bat +32 -0
- data/vendor/libressl/tests/ssltest.sh +48 -0
- data/vendor/libressl/tests/testdsa.bat +47 -0
- data/vendor/libressl/tests/testdsa.sh +57 -0
- data/vendor/libressl/tests/testenc.bat +85 -0
- data/vendor/libressl/tests/testenc.sh +93 -0
- data/vendor/libressl/tests/testrsa.bat +47 -0
- data/vendor/libressl/tests/testrsa.sh +57 -0
- data/vendor/libressl/tests/testssl.bat +171 -0
- data/vendor/libressl/tests/tlstest.bat +27 -0
- data/vendor/libressl/tests/tlstest.sh +28 -0
- data/vendor/libressl/tls/CMakeLists.txt +125 -0
- data/vendor/libressl/tls/Makefile.am +76 -0
- data/vendor/libressl/tls/compat/ftruncate.c +17 -0
- data/vendor/libressl/tls/compat/pread.c +29 -0
- data/vendor/libressl/tls/compat/pwrite.c +29 -0
- data/vendor/libressl/update.sh +460 -0
- data/vendor/liburing/.github/workflows/ci.yml +8 -0
- data/vendor/liburing/configure +23 -2
- data/vendor/liburing/examples/helpers.c +1 -1
- data/vendor/liburing/examples/helpers.h +1 -1
- data/vendor/liburing/examples/reg-wait.c +3 -3
- data/vendor/liburing/examples/zcrx.c +5 -5
- data/vendor/liburing/liburing.spec +1 -1
- data/vendor/liburing/src/include/liburing/io_uring.h +16 -0
- data/vendor/liburing/src/include/liburing.h +20 -4
- data/vendor/liburing/src/lib.h +2 -4
- data/vendor/liburing/src/liburing-ffi.map +7 -0
- data/vendor/liburing/src/liburing.map +7 -0
- data/vendor/liburing/src/register.c +5 -0
- data/vendor/liburing/src/sanitize.c +5 -4
- data/vendor/liburing/src/setup.c +43 -28
- data/vendor/liburing/test/Makefile +7 -0
- data/vendor/liburing/test/cmd-discard.c +2 -2
- data/vendor/liburing/test/evfd-short-read.c +84 -0
- data/vendor/liburing/test/fdinfo-sqpoll.c +117 -0
- data/vendor/liburing/test/fdinfo.c +1 -1
- data/vendor/liburing/test/fixed-buf-merge.c +2 -2
- data/vendor/liburing/test/futex-kill.c +135 -0
- data/vendor/liburing/test/helpers.c +1 -1
- data/vendor/liburing/test/helpers.h +1 -1
- data/vendor/liburing/test/init-mem.c +50 -12
- data/vendor/liburing/test/io_uring_passthrough.c +25 -6
- data/vendor/liburing/test/msg-ring.c +123 -9
- data/vendor/liburing/test/recv-bundle-short-ooo.c +16 -1
- data/vendor/liburing/test/recv-inc-ooo.c +411 -0
- data/vendor/liburing/test/recv-mshot-fair.c +513 -0
- data/vendor/liburing/test/reg-wait.c +14 -14
- data/vendor/liburing/test/send-zerocopy.c +4 -4
- data/vendor/liburing/test/timerfd-short-read.c +81 -0
- data/vendor/liburing/test/timestamp.c +382 -0
- data/vendor/liburing/test/zcrx.c +22 -22
- metadata +222 -2
@@ -28,32 +28,40 @@ struct ctx {
|
|
28
28
|
unsigned long long *post;
|
29
29
|
};
|
30
30
|
|
31
|
+
static int page_size;
|
32
|
+
|
31
33
|
struct q_entries {
|
32
34
|
unsigned int sqes;
|
33
35
|
unsigned int cqes;
|
36
|
+
unsigned int ring_flags;
|
34
37
|
};
|
35
38
|
|
36
39
|
static int setup_ctx(struct ctx *ctx, struct q_entries *q)
|
37
40
|
{
|
38
|
-
struct io_uring_params p = { };
|
39
|
-
int ret;
|
41
|
+
struct io_uring_params p = { .flags = q->ring_flags, };
|
42
|
+
int ret, rret;
|
40
43
|
|
41
|
-
if (posix_memalign(&ctx->mem,
|
44
|
+
if (posix_memalign(&ctx->mem, page_size, 2*1024*1024))
|
42
45
|
return T_EXIT_FAIL;
|
43
46
|
|
44
47
|
memset(ctx->mem, 0, 2*1024*1024);
|
45
48
|
|
46
|
-
ctx->pre = ctx->mem +
|
49
|
+
ctx->pre = ctx->mem + page_size - sizeof(unsigned long long);
|
47
50
|
*ctx->pre = PRE_RED;
|
48
51
|
|
49
|
-
ctx->ring_mem = ctx->mem +
|
52
|
+
ctx->ring_mem = ctx->mem + page_size;
|
50
53
|
p.flags |= IORING_SETUP_CQSIZE | IORING_SETUP_NO_SQARRAY;
|
51
54
|
p.sq_entries = q->sqes;
|
52
55
|
p.cq_entries = q->cqes;
|
53
56
|
|
57
|
+
rret = io_uring_memory_size_params(q->sqes, &p);
|
58
|
+
if (rret > 2 * 1024 * 1024) {
|
59
|
+
fprintf(stderr, "Alloc size too small\n");
|
60
|
+
return T_EXIT_FAIL;
|
61
|
+
}
|
62
|
+
|
54
63
|
ret = io_uring_queue_init_mem(q->sqes, &ctx->ring, &p,
|
55
64
|
ctx->ring_mem, 2*1024*1024);
|
56
|
-
|
57
65
|
if (ret < 0) {
|
58
66
|
if (ret == -EINVAL)
|
59
67
|
return T_EXIT_SKIP;
|
@@ -61,6 +69,12 @@ static int setup_ctx(struct ctx *ctx, struct q_entries *q)
|
|
61
69
|
return T_EXIT_FAIL;
|
62
70
|
}
|
63
71
|
|
72
|
+
if (ret != rret) {
|
73
|
+
fprintf(stderr, "Used mem %d differs from required %ld\n",
|
74
|
+
ret, (long) rret);
|
75
|
+
return T_EXIT_FAIL;
|
76
|
+
}
|
77
|
+
|
64
78
|
ctx->post = ctx->ring_mem + ret;
|
65
79
|
*ctx->post = POST_RED;
|
66
80
|
return 0;
|
@@ -141,18 +155,42 @@ err:
|
|
141
155
|
int main(int argc, char *argv[])
|
142
156
|
{
|
143
157
|
struct q_entries q_entries[] = {
|
144
|
-
{ 256, 16384 },
|
145
|
-
{ 32, 4096 },
|
146
|
-
{ 128, 8192 },
|
147
|
-
{ 4096, 32768 },
|
148
|
-
{ 1, 8 },
|
149
|
-
{ 2, 1024 },
|
158
|
+
{ 256, 16384, 0 },
|
159
|
+
{ 32, 4096, 0 },
|
160
|
+
{ 128, 8192, 0 },
|
161
|
+
{ 4096, 32768, 0 },
|
162
|
+
{ 1, 8, 0 },
|
163
|
+
{ 2, 1024, 0 },
|
164
|
+
{ 256, 16384, IORING_SETUP_SQE128 },
|
165
|
+
{ 32, 4096, IORING_SETUP_SQE128},
|
166
|
+
{ 128, 8192, IORING_SETUP_SQE128},
|
167
|
+
{ 4096, 32768, IORING_SETUP_SQE128},
|
168
|
+
{ 1, 8, IORING_SETUP_SQE128},
|
169
|
+
{ 2, 1024, IORING_SETUP_SQE128},
|
170
|
+
{ 256, 16384, IORING_SETUP_CQE32 },
|
171
|
+
{ 32, 4096, IORING_SETUP_CQE32},
|
172
|
+
{ 128, 8192, IORING_SETUP_CQE32},
|
173
|
+
{ 4096, 32768, IORING_SETUP_CQE32},
|
174
|
+
{ 1, 8, IORING_SETUP_CQE32},
|
175
|
+
{ 2, 1024, IORING_SETUP_CQE32},
|
176
|
+
{ 256, 16384, IORING_SETUP_SQE128 | IORING_SETUP_CQE32 },
|
177
|
+
{ 32, 4096, IORING_SETUP_SQE128 | IORING_SETUP_CQE32},
|
178
|
+
{ 128, 8192, IORING_SETUP_SQE128 | IORING_SETUP_CQE32},
|
179
|
+
{ 4096, 32768, IORING_SETUP_SQE128 | IORING_SETUP_CQE32},
|
180
|
+
{ 1, 8, IORING_SETUP_SQE128 | IORING_SETUP_CQE32},
|
181
|
+
{ 2, 1024, IORING_SETUP_SQE128 | IORING_SETUP_CQE32},
|
150
182
|
};
|
151
183
|
int i, ret;
|
152
184
|
|
153
185
|
if (argc > 1)
|
154
186
|
return T_EXIT_SKIP;
|
155
187
|
|
188
|
+
page_size = sysconf(_SC_PAGESIZE);
|
189
|
+
if (page_size < 0) {
|
190
|
+
perror("sysconf(_SC_PAGESIZE)");
|
191
|
+
return 1;
|
192
|
+
}
|
193
|
+
|
156
194
|
for (i = 0; i < ARRAY_SIZE(q_entries); i++) {
|
157
195
|
ret = test(&q_entries[i]);
|
158
196
|
if (ret == T_EXIT_SKIP) {
|
@@ -70,7 +70,7 @@ static int fill_pattern(int tc)
|
|
70
70
|
}
|
71
71
|
|
72
72
|
static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
|
73
|
-
int sqthread, int fixed, int nonvec)
|
73
|
+
int sqthread, int fixed, int nonvec, int async, int linked)
|
74
74
|
{
|
75
75
|
struct io_uring_sqe *sqe;
|
76
76
|
struct io_uring_cqe *cqe;
|
@@ -121,6 +121,16 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
|
|
121
121
|
unsigned int iovcnt = 1;
|
122
122
|
size_t total_len;
|
123
123
|
|
124
|
+
if (linked) {
|
125
|
+
sqe = io_uring_get_sqe(ring);
|
126
|
+
io_uring_prep_nop(sqe);
|
127
|
+
if (async)
|
128
|
+
sqe->flags |= IOSQE_ASYNC;
|
129
|
+
sqe->flags |= IOSQE_IO_LINK;
|
130
|
+
sqe->user_data = 0x1000;
|
131
|
+
submit_count++;
|
132
|
+
}
|
133
|
+
|
124
134
|
sqe = io_uring_get_sqe(ring);
|
125
135
|
if (!sqe) {
|
126
136
|
fprintf(stderr, "sqe get failed\n");
|
@@ -135,6 +145,8 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
|
|
135
145
|
do_fixed = 0;
|
136
146
|
if (do_fixed)
|
137
147
|
sqe->buf_index = 0;
|
148
|
+
if (async)
|
149
|
+
sqe->flags |= IOSQE_ASYNC;
|
138
150
|
if (nonvec)
|
139
151
|
sqe->cmd_op = NVME_URING_CMD_IO;
|
140
152
|
else
|
@@ -194,6 +206,8 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
|
|
194
206
|
}
|
195
207
|
|
196
208
|
for (i = 0; i < submit_count; i++) {
|
209
|
+
int is_link;
|
210
|
+
|
197
211
|
ret = io_uring_wait_cqe(ring, &cqe);
|
198
212
|
if (ret) {
|
199
213
|
fprintf(stderr, "wait_cqe=%d\n", ret);
|
@@ -211,7 +225,10 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
|
|
211
225
|
fprintf(stderr, "cqe res %d, wanted 0\n", cqe->res);
|
212
226
|
goto err;
|
213
227
|
}
|
228
|
+
is_link = cqe->user_data == 0x1000;
|
214
229
|
io_uring_cqe_seen(ring, cqe);
|
230
|
+
if (is_link)
|
231
|
+
continue;
|
215
232
|
if (read) {
|
216
233
|
int index = cqe->user_data & 0xffffffff;
|
217
234
|
void *buf = vecs[index].iov_base;
|
@@ -248,7 +265,7 @@ err:
|
|
248
265
|
}
|
249
266
|
|
250
267
|
static int test_io(const char *file, int tc, int read, int sqthread,
|
251
|
-
int fixed, int nonvec, int hybrid)
|
268
|
+
int fixed, int nonvec, int hybrid, int async, int linked)
|
252
269
|
{
|
253
270
|
struct io_uring ring;
|
254
271
|
int ret, ring_flags = 0;
|
@@ -265,7 +282,7 @@ static int test_io(const char *file, int tc, int read, int sqthread,
|
|
265
282
|
if (fixed && (!vec_fixed_supported && !nonvec))
|
266
283
|
return 0;
|
267
284
|
|
268
|
-
ret = t_create_ring(
|
285
|
+
ret = t_create_ring(128, &ring, ring_flags);
|
269
286
|
if (ret == T_SETUP_SKIP)
|
270
287
|
return 0;
|
271
288
|
if (ret != T_SETUP_OK) {
|
@@ -277,7 +294,7 @@ static int test_io(const char *file, int tc, int read, int sqthread,
|
|
277
294
|
return 1;
|
278
295
|
}
|
279
296
|
|
280
|
-
ret = __test_io(file, &ring, tc, read, sqthread, fixed, nonvec);
|
297
|
+
ret = __test_io(file, &ring, tc, read, sqthread, fixed, nonvec, async, linked);
|
281
298
|
io_uring_queue_exit(&ring);
|
282
299
|
|
283
300
|
return ret;
|
@@ -464,14 +481,16 @@ int main(int argc, char *argv[])
|
|
464
481
|
t_posix_memalign(&meta_mem, 0x1000,
|
465
482
|
meta_size * BUFFERS * (BS >> lba_shift));
|
466
483
|
|
467
|
-
for (i = 0; i <
|
484
|
+
for (i = 0; i < 64; i++) {
|
468
485
|
int read = (i & 1) != 0;
|
469
486
|
int sqthread = (i & 2) != 0;
|
470
487
|
int fixed = (i & 4) != 0;
|
471
488
|
int nonvec = (i & 8) != 0;
|
472
489
|
int hybrid = (i & 16) != 0;
|
490
|
+
int async = (i & 32) != 0;
|
491
|
+
int linked = (i & 64) != 0;
|
473
492
|
|
474
|
-
ret = test_io(fname, i, read, sqthread, fixed, nonvec, hybrid);
|
493
|
+
ret = test_io(fname, i, read, sqthread, fixed, nonvec, hybrid, async, linked);
|
475
494
|
if (no_pt)
|
476
495
|
break;
|
477
496
|
if (ret) {
|
@@ -15,13 +15,59 @@
|
|
15
15
|
#include "helpers.h"
|
16
16
|
|
17
17
|
static int no_msg;
|
18
|
+
static int no_sync_msg;
|
18
19
|
|
19
|
-
static int
|
20
|
+
static int test_own_sync(struct io_uring *ring)
|
20
21
|
{
|
22
|
+
struct io_uring_sqe sqe = { };
|
21
23
|
struct io_uring_cqe *cqe;
|
24
|
+
int ret;
|
25
|
+
|
26
|
+
if (no_sync_msg)
|
27
|
+
return 0;
|
28
|
+
|
29
|
+
io_uring_prep_msg_ring(&sqe, ring->ring_fd, 0x10, 0x1234, 0);
|
30
|
+
sqe.user_data = 1;
|
31
|
+
|
32
|
+
ret = io_uring_register_sync_msg(&sqe);
|
33
|
+
if (ret == -EINVAL) {
|
34
|
+
no_sync_msg = 1;
|
35
|
+
return 0;
|
36
|
+
} else if (ret != 0) {
|
37
|
+
fprintf(stderr, "register_sync_msg: %d\n", ret);
|
38
|
+
return 1;
|
39
|
+
}
|
40
|
+
|
41
|
+
ret = io_uring_wait_cqe(ring, &cqe);
|
42
|
+
if (ret < 0) {
|
43
|
+
fprintf(stderr, "wait completion %d\n", ret);
|
44
|
+
return 1;
|
45
|
+
}
|
46
|
+
switch (cqe->user_data) {
|
47
|
+
case 0x1234:
|
48
|
+
if (cqe->res != 0x10) {
|
49
|
+
fprintf(stderr, "invalid len %x\n", cqe->res);
|
50
|
+
return -1;
|
51
|
+
}
|
52
|
+
break;
|
53
|
+
default:
|
54
|
+
fprintf(stderr, "Invalid user_data\n");
|
55
|
+
return -1;
|
56
|
+
}
|
57
|
+
|
58
|
+
io_uring_cqe_seen(ring, cqe);
|
59
|
+
return 0;
|
60
|
+
}
|
61
|
+
|
62
|
+
static int test_own(struct io_uring *ring, int do_sync)
|
63
|
+
{
|
22
64
|
struct io_uring_sqe *sqe;
|
65
|
+
struct io_uring_cqe *cqe;
|
23
66
|
int ret, i;
|
24
67
|
|
68
|
+
if (do_sync)
|
69
|
+
return test_own_sync(ring);
|
70
|
+
|
25
71
|
sqe = io_uring_get_sqe(ring);
|
26
72
|
if (!sqe) {
|
27
73
|
fprintf(stderr, "get sqe failed\n");
|
@@ -116,7 +162,47 @@ err:
|
|
116
162
|
return (void *) (unsigned long) 1;
|
117
163
|
}
|
118
164
|
|
119
|
-
static int
|
165
|
+
static int test_remote_sync(unsigned int ring_flags)
|
166
|
+
{
|
167
|
+
struct io_uring *target;
|
168
|
+
pthread_t thread;
|
169
|
+
void *tret;
|
170
|
+
struct io_uring_sqe sqe = { };
|
171
|
+
struct data d;
|
172
|
+
int ret;
|
173
|
+
|
174
|
+
if (no_sync_msg)
|
175
|
+
return 0;
|
176
|
+
|
177
|
+
d.flags = ring_flags;
|
178
|
+
pthread_barrier_init(&d.barrier, NULL, 2);
|
179
|
+
pthread_barrier_init(&d.startup, NULL, 2);
|
180
|
+
pthread_create(&thread, NULL, wait_cqe_fn, &d);
|
181
|
+
|
182
|
+
pthread_barrier_wait(&d.startup);
|
183
|
+
target = d.ring;
|
184
|
+
|
185
|
+
io_uring_prep_msg_ring(&sqe, target->ring_fd, 0x20, 0x5aa5, 0);
|
186
|
+
sqe.user_data = 1;
|
187
|
+
|
188
|
+
pthread_barrier_wait(&d.barrier);
|
189
|
+
|
190
|
+
ret = io_uring_register_sync_msg(&sqe);
|
191
|
+
if (ret == -EINVAL) {
|
192
|
+
no_sync_msg = 1;
|
193
|
+
return 0;
|
194
|
+
} else if (ret != 0) {
|
195
|
+
fprintf(stderr, "sync_msg: %d\n", ret);
|
196
|
+
goto err;
|
197
|
+
}
|
198
|
+
pthread_join(thread, &tret);
|
199
|
+
return 0;
|
200
|
+
err:
|
201
|
+
return 1;
|
202
|
+
}
|
203
|
+
|
204
|
+
static int test_remote(struct io_uring *ring, unsigned int ring_flags,
|
205
|
+
int do_sync)
|
120
206
|
{
|
121
207
|
struct io_uring *target;
|
122
208
|
pthread_t thread;
|
@@ -126,6 +212,9 @@ static int test_remote(struct io_uring *ring, unsigned int ring_flags)
|
|
126
212
|
struct data d;
|
127
213
|
int ret;
|
128
214
|
|
215
|
+
if (do_sync)
|
216
|
+
return test_remote_sync(ring_flags);
|
217
|
+
|
129
218
|
d.flags = ring_flags;
|
130
219
|
pthread_barrier_init(&d.barrier, NULL, 2);
|
131
220
|
pthread_barrier_init(&d.startup, NULL, 2);
|
@@ -367,16 +456,29 @@ static int test(int ring_flags)
|
|
367
456
|
return T_EXIT_FAIL;
|
368
457
|
}
|
369
458
|
|
370
|
-
ret = test_own(&ring);
|
459
|
+
ret = test_own(&ring, 0);
|
371
460
|
if (ret) {
|
372
|
-
fprintf(stderr, "test_own failed\n");
|
461
|
+
fprintf(stderr, "test_own sync failed\n");
|
373
462
|
return T_EXIT_FAIL;
|
374
463
|
}
|
375
464
|
if (no_msg)
|
376
465
|
return T_EXIT_SKIP;
|
377
|
-
|
466
|
+
|
467
|
+
ret = test_own(&ring, 1);
|
468
|
+
if (ret) {
|
469
|
+
fprintf(stderr, "test_own async failed\n");
|
470
|
+
return T_EXIT_FAIL;
|
471
|
+
}
|
472
|
+
|
473
|
+
ret = test_own(&pring, 0);
|
474
|
+
if (ret) {
|
475
|
+
fprintf(stderr, "test_own async iopoll failed\n");
|
476
|
+
return T_EXIT_FAIL;
|
477
|
+
}
|
478
|
+
|
479
|
+
ret = test_own(&pring, 1);
|
378
480
|
if (ret) {
|
379
|
-
fprintf(stderr, "test_own iopoll failed\n");
|
481
|
+
fprintf(stderr, "test_own sync iopoll failed\n");
|
380
482
|
return T_EXIT_FAIL;
|
381
483
|
}
|
382
484
|
|
@@ -394,12 +496,18 @@ static int test(int ring_flags)
|
|
394
496
|
}
|
395
497
|
}
|
396
498
|
|
397
|
-
ret = test_remote(&ring, ring_flags);
|
499
|
+
ret = test_remote(&ring, ring_flags, 0);
|
398
500
|
if (ret) {
|
399
501
|
fprintf(stderr, "test_remote failed\n");
|
400
502
|
return T_EXIT_FAIL;
|
401
503
|
}
|
402
504
|
|
505
|
+
ret = test_remote(&ring, ring_flags, 1);
|
506
|
+
if (ret) {
|
507
|
+
fprintf(stderr, "test_remote sync failed\n");
|
508
|
+
return T_EXIT_FAIL;
|
509
|
+
}
|
510
|
+
|
403
511
|
io_uring_queue_exit(&ring);
|
404
512
|
io_uring_queue_exit(&pring);
|
405
513
|
|
@@ -411,9 +519,15 @@ static int test(int ring_flags)
|
|
411
519
|
return T_EXIT_FAIL;
|
412
520
|
}
|
413
521
|
|
414
|
-
ret = test_own(&ring);
|
522
|
+
ret = test_own(&ring, 0);
|
523
|
+
if (ret) {
|
524
|
+
fprintf(stderr, "test_own async deferred failed\n");
|
525
|
+
return T_EXIT_FAIL;
|
526
|
+
}
|
527
|
+
|
528
|
+
ret = test_own(&ring, 1);
|
415
529
|
if (ret) {
|
416
|
-
fprintf(stderr, "test_own deferred failed\n");
|
530
|
+
fprintf(stderr, "test_own sync deferred failed\n");
|
417
531
|
return T_EXIT_FAIL;
|
418
532
|
}
|
419
533
|
|
@@ -142,6 +142,19 @@ static int setup_buf_ring(struct buf_ring_data *data, struct io_uring *ring,
|
|
142
142
|
return T_EXIT_PASS;
|
143
143
|
}
|
144
144
|
|
145
|
+
static void dump_buf(const char *msg, uint8_t *buf, int len)
|
146
|
+
{
|
147
|
+
int i;
|
148
|
+
|
149
|
+
fprintf(stderr, "Buffer %s\n", msg);
|
150
|
+
for (i = 0; i < len; i++) {
|
151
|
+
fprintf(stderr, "%3x ", buf[i]);
|
152
|
+
if (i && !(i & 15))
|
153
|
+
fprintf(stderr, "\n");
|
154
|
+
}
|
155
|
+
fprintf(stderr, "\n");
|
156
|
+
}
|
157
|
+
|
145
158
|
/**
|
146
159
|
* Verifies that received buffer data matches expected data
|
147
160
|
*
|
@@ -157,7 +170,9 @@ static int verify_received_buffer(struct buf_data *buf, uint8_t *expected_data_s
|
|
157
170
|
|
158
171
|
for (uint32_t i = 0; i < buf->len; i++) {
|
159
172
|
if (data[i] != expected_data_start[i]) {
|
160
|
-
fprintf(stderr, "Recv data ordering mismatch\n");
|
173
|
+
fprintf(stderr, "Recv data ordering mismatch, offset %d\n", i);
|
174
|
+
dump_buf("expected", expected_data_start, buf->len);
|
175
|
+
dump_buf("received", data, buf->len);
|
161
176
|
return 1;
|
162
177
|
}
|
163
178
|
}
|