diff --git a/1001-Add-percpu-io-sq-thread-support.patch b/1001-Add-percpu-io-sq-thread-support.patch index 149c071ea8304fea4875aac7b9e64f3df3cdf74d..3a2791b4620bce7040c506773c72b0ec927fca6c 100644 --- a/1001-Add-percpu-io-sq-thread-support.patch +++ b/1001-Add-percpu-io-sq-thread-support.patch @@ -13,8 +13,8 @@ Signed-off-by: Xiaoguang Wang Acked-by: Joseph Qi --- man/io_uring_setup.2 | 9 +++++++++ - src/include/liburing/io_uring.h | 2 ++ - 2 files changed, 11 insertions(+) + src/include/liburing/io_uring.h | 3 ++ + 2 files changed, 12 insertions(+) diff --git a/man/io_uring_setup.2 b/man/io_uring_setup.2 index cd69994..30a2306 100644 @@ -40,10 +40,11 @@ diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index a3e0920..d4a0d83 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h -@@ -166,6 +166,8 @@ enum { +@@ -166,6 +166,9 @@ enum { * Only one task is allowed to submit requests */ #define IORING_SETUP_SINGLE_ISSUER (1U << 12) ++#define IORING_SETUP_IDLE_US (1U << 30) /* unit of thread_idle is microsecond */ +/* use percpu SQ poll thread */ +#define IORING_SETUP_SQPOLL_PERCPU (1U << 31) diff --git a/1002-support-us-granularity-of-io_sq_thread_idle.patch b/1002-support-us-granularity-of-io_sq_thread_idle.patch index 6f6f85c6d0750ae4bae681a85ed9ca989f800eca..e52dc4646dd60c60170741857ddf1308c9a8ea4f 100644 --- a/1002-support-us-granularity-of-io_sq_thread_idle.patch +++ b/1002-support-us-granularity-of-io_sq_thread_idle.patch @@ -9,8 +9,7 @@ io_sq_thread_idle. Signed-off-by: Hao Xu --- man/io_uring_setup.2 | 8 +++++++- - src/include/liburing/io_uring.h | 1 + - 2 files changed, 8 insertions(+), 1 deletion(-) + 1 files changed, 7 insertions(+), 1 deletion(-) diff --git a/man/io_uring_setup.2 b/man/io_uring_setup.2 index 30a2306..082507c 100644 @@ -35,21 +34,9 @@ index 30a2306..082507c 100644 +If this flag is set, the unit of +.I sq_thread_idle +is microsecond, rather than millisecond. - .PP - If no flags are specified, the io_uring instance is setup for - interrupt driven I/O. I/O may be submitted using -diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h -index d4a0d83..8291de7 100644 ---- a/src/include/liburing/io_uring.h -+++ b/src/include/liburing/io_uring.h -@@ -166,6 +166,7 @@ enum { - * Only one task is allowed to submit requests - */ - #define IORING_SETUP_SINGLE_ISSUER (1U << 12) -+#define IORING_SETUP_IDLE_US (1U << 30) /* unit of thread_idle is microsecond */ - /* use percpu SQ poll thread */ - #define IORING_SETUP_SQPOLL_PERCPU (1U << 31) - + .TP + .B IORING_SETUP_NO_MMAP + By default, io_uring allocates kernel memory that callers must subsequently -- 2.31.1 diff --git a/1003-add-IORING_ENTER_SQ_SUBMIT_ON_IDLE-flag.patch b/1003-add-IORING_ENTER_SQ_SUBMIT_ON_IDLE-flag.patch index 3056111da9bb66468a6b6b49cbd95d4ad4758973..c7814c5938e5b580bb7ff76c3073bab531d056fb 100644 --- a/1003-add-IORING_ENTER_SQ_SUBMIT_ON_IDLE-flag.patch +++ b/1003-add-IORING_ENTER_SQ_SUBMIT_ON_IDLE-flag.patch @@ -51,13 +51,15 @@ diff --git a/src/liburing.map b/src/liburing.map index 06c64f8..e8124a2 100644 --- a/src/liburing.map +++ b/src/liburing.map -@@ -66,4 +66,6 @@ LIBURING_2.3 { +@@ -66,6 +66,8 @@ LIBURING_2.3 { io_uring_register; io_uring_get_events; io_uring_submit_and_get_events; + io_uring_submit_on_idle; + io_uring_submit_on_idle_and_wait; } LIBURING_2.2; + + LIBURING_2.4 { diff --git a/src/queue.c b/src/queue.c index c06bcc3..563c7c3 100644 --- a/src/queue.c diff --git a/1005-test-io_uring_passthrough-skip-if-kernel-doesn-t-sup.patch b/1005-test-io_uring_passthrough-skip-if-kernel-doesn-t-sup.patch deleted file mode 100644 index f77be96269a83255ebec24acefba35e916d4b72d..0000000000000000000000000000000000000000 --- a/1005-test-io_uring_passthrough-skip-if-kernel-doesn-t-sup.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 626d52adaffc193597ff0294be50611540a6233c Mon Sep 17 00:00:00 2001 -From: Jens Axboe -Date: Wed, 30 Nov 2022 20:37:12 -0700 -Subject: [PATCH 1/4] test/io_uring_passthrough: skip if kernel doesn't support - passthrough - -If we get -EOPNOTSUPP, just skip the test at our earliest convenience. - -Signed-off-by: Jens Axboe -Signed-off-by: Joseph Qi ---- - test/io_uring_passthrough.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c -index ee9ab87..2f24364 100644 ---- a/test/io_uring_passthrough.c -+++ b/test/io_uring_passthrough.c -@@ -18,6 +18,7 @@ - #define BUFFERS (FILE_SIZE / BS) - - static struct iovec *vecs; -+static int no_pt; - - /* - * Each offset in the file has the ((test_case / 2) * FILE_SIZE) -@@ -205,6 +206,10 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read, - goto err; - } - if (cqe->res != 0) { -+ if (!no_pt) { -+ no_pt = 1; -+ goto skip; -+ } - fprintf(stderr, "cqe res %d, wanted 0\n", cqe->res); - goto err; - } -@@ -234,6 +239,7 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read, - } - } - -+skip: - close(fd); - return 0; - err: -@@ -431,6 +437,8 @@ int main(int argc, char *argv[]) - read, sqthread, fixed, nonvec); - goto err; - } -+ if (no_pt) -+ return T_EXIT_SKIP; - } - - ret = test_io_uring_submit_enters(fname); --- -2.24.4 - diff --git a/1006-test-io_uring_passthrough-fix-iopoll-test.patch b/1006-test-io_uring_passthrough-fix-iopoll-test.patch deleted file mode 100644 index 18944ced67b437f1ebbbaad062f21da5b53b7825..0000000000000000000000000000000000000000 --- a/1006-test-io_uring_passthrough-fix-iopoll-test.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 49425e0b44cf7b46f022ddabee73a0630cb1f9bc Mon Sep 17 00:00:00 2001 -From: Kanchan Joshi -Date: Tue, 6 Dec 2022 17:48:30 +0530 -Subject: [PATCH 2/4] test/io_uring_passthrough: fix iopoll test - -iopoll test is broken as it does not initialize the command/sqe properly -before submission. -Add the necessary initialization to set this right. - -Signed-off-by: Kanchan Joshi -Link: https://lore.kernel.org/r/20221206121831.5528-2-joshi.k@samsung.com -Signed-off-by: Jens Axboe -Signed-off-by: Joseph Qi ---- - test/io_uring_passthrough.c | 24 +++++++++++++++++++++--- - 1 file changed, 21 insertions(+), 3 deletions(-) - -diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c -index 2f24364..933c137 100644 ---- a/test/io_uring_passthrough.c -+++ b/test/io_uring_passthrough.c -@@ -352,6 +352,8 @@ static int test_io_uring_submit_enters(const char *file) - int fd, i, ret, ring_flags, open_flags; - unsigned head; - struct io_uring_cqe *cqe; -+ struct nvme_uring_cmd *cmd; -+ struct io_uring_sqe *sqe; - - ring_flags = IORING_SETUP_IOPOLL; - ring_flags |= IORING_SETUP_SQE128; -@@ -371,12 +373,28 @@ static int test_io_uring_submit_enters(const char *file) - } - - for (i = 0; i < BUFFERS; i++) { -- struct io_uring_sqe *sqe; - off_t offset = BS * (rand() % BUFFERS); -+ __u64 slba; -+ __u32 nlb; - - sqe = io_uring_get_sqe(&ring); -- io_uring_prep_writev(sqe, fd, &vecs[i], 1, offset); -- sqe->user_data = 1; -+ io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset); -+ sqe->user_data = i; -+ sqe->opcode = IORING_OP_URING_CMD; -+ sqe->cmd_op = NVME_URING_CMD_IO; -+ cmd = (struct nvme_uring_cmd *)sqe->cmd; -+ memset(cmd, 0, sizeof(struct nvme_uring_cmd)); -+ -+ slba = offset >> lba_shift; -+ nlb = (BS >> lba_shift) - 1; -+ -+ cmd->opcode = nvme_cmd_read; -+ cmd->cdw10 = slba & 0xffffffff; -+ cmd->cdw11 = slba >> 32; -+ cmd->cdw12 = nlb; -+ cmd->addr = (__u64)(uintptr_t)&vecs[i]; -+ cmd->data_len = 1; -+ cmd->nsid = nsid; - } - - /* submit manually to avoid adding IORING_ENTER_GETEVENTS */ --- -2.24.4 - diff --git a/1007-test-io_uring_passthrough-cleanup-invalid-submission.patch b/1007-test-io_uring_passthrough-cleanup-invalid-submission.patch deleted file mode 100644 index 676472b90868e34c8f6f4d00fa04d27c9e0dd73e..0000000000000000000000000000000000000000 --- a/1007-test-io_uring_passthrough-cleanup-invalid-submission.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1985fba0acdac7addc3d8abb5db350a2a7648f16 Mon Sep 17 00:00:00 2001 -From: Kanchan Joshi -Date: Tue, 6 Dec 2022 17:48:31 +0530 -Subject: [PATCH 3/4] test/io_uring_passthrough: cleanup invalid submission - test - -Just do away with setting IOPOLL as this is not necessary for the test. - -Signed-off-by: Kanchan Joshi -Link: https://lore.kernel.org/r/20221206121831.5528-3-joshi.k@samsung.com -Signed-off-by: Jens Axboe -Signed-off-by: Joseph Qi ---- - test/io_uring_passthrough.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c -index 933c137..292e98d 100644 ---- a/test/io_uring_passthrough.c -+++ b/test/io_uring_passthrough.c -@@ -288,8 +288,7 @@ static int test_invalid_passthru_submit(const char *file) - struct io_uring_sqe *sqe; - struct nvme_uring_cmd *cmd; - -- ring_flags = IORING_SETUP_IOPOLL | IORING_SETUP_SQE128; -- ring_flags |= IORING_SETUP_CQE32; -+ ring_flags = IORING_SETUP_CQE32 | IORING_SETUP_SQE128; - - ret = t_create_ring(1, &ring, ring_flags); - if (ret != T_SETUP_OK) { --- -2.24.4 - diff --git a/1008-test-io_uring_passthrough-skip-test-if-bit-sqe-cqe-s.patch b/1008-test-io_uring_passthrough-skip-test-if-bit-sqe-cqe-s.patch deleted file mode 100644 index 0a9f5cc3038edb22cf4c483a27e8d4568d659c9b..0000000000000000000000000000000000000000 --- a/1008-test-io_uring_passthrough-skip-test-if-bit-sqe-cqe-s.patch +++ /dev/null @@ -1,51 +0,0 @@ -From a0226c19959dda7e1008d0ff77f57264d7f7fdef Mon Sep 17 00:00:00 2001 -From: Jens Axboe -Date: Fri, 23 Dec 2022 08:55:41 -0700 -Subject: [PATCH 4/4] test/io_uring_passthrough: skip test if bit sqe/cqe - support not there - -Signed-off-by: Jens Axboe -Signed-off-by: Joseph Qi ---- - test/io_uring_passthrough.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c -index 292e98d..8fbafdb 100644 ---- a/test/io_uring_passthrough.c -+++ b/test/io_uring_passthrough.c -@@ -264,6 +264,10 @@ static int test_io(const char *file, int tc, int read, int sqthread, - if (ret == T_SETUP_SKIP) - return 0; - if (ret != T_SETUP_OK) { -+ if (ret == -EINVAL) { -+ no_pt = 1; -+ return T_SETUP_SKIP; -+ } - fprintf(stderr, "ring create failed: %d\n", ret); - return 1; - } -@@ -449,15 +453,18 @@ int main(int argc, char *argv[]) - int nonvec = (i & 8) != 0; - - ret = test_io(fname, i, read, sqthread, fixed, nonvec); -+ if (no_pt) -+ break; - if (ret) { - fprintf(stderr, "test_io failed %d/%d/%d/%d\n", - read, sqthread, fixed, nonvec); - goto err; - } -- if (no_pt) -- return T_EXIT_SKIP; - } - -+ if (no_pt) -+ return T_EXIT_SKIP; -+ - ret = test_io_uring_submit_enters(fname); - if (ret) { - fprintf(stderr, "test_io_uring_submit_enters failed\n"); --- -2.24.4 - diff --git a/1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch b/1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch deleted file mode 100644 index 11ec35a613eee8e045d903ea62e966850f151e62..0000000000000000000000000000000000000000 --- a/1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 085766d3e3f6be2c8a54de01633bb8d977b3e2a7 Mon Sep 17 00:00:00 2001 -From: Jens Axboe -Date: Sat, 21 Jan 2023 10:04:37 -0700 -Subject: [PATCH 1009/1010] test/read-before-exit: handle IOPOLL failure on - older kernels - -Signed-off-by: Jens Axboe -Signed-off-by: Ferry Meng ---- - test/read-before-exit.c | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -diff --git a/test/read-before-exit.c b/test/read-before-exit.c -index be36bd4..f7af550 100644 ---- a/test/read-before-exit.c -+++ b/test/read-before-exit.c -@@ -14,6 +14,8 @@ - #include "liburing.h" - #include "helpers.h" - -+static int no_iopoll; -+ - struct data { - struct io_uring *ring; - int timer_fd1; -@@ -35,8 +37,21 @@ void *submit(void *data) - io_uring_prep_read(sqe, d->timer_fd2, &d->buf2, sizeof(d->buf2), 0); - - ret = io_uring_submit(d->ring); -- if (ret != 2) -+ if (ret != 2) { -+ struct io_uring_cqe *cqe; -+ -+ /* -+ * Kernels without submit-all-on-error behavior will -+ * fail submitting all, check if that's the case and -+ * don't error -+ */ -+ ret = io_uring_peek_cqe(d->ring, &cqe); -+ if (!ret && cqe->res == -EOPNOTSUPP) { -+ no_iopoll = 1; -+ return NULL; -+ } - return (void *) (uintptr_t) 1; -+ } - - /* Exit suddenly. */ - return NULL; -@@ -95,9 +110,11 @@ int main(int argc, char *argv[]) - for (i = 0; i < 1000; i++) { - ret = test(IORING_SETUP_IOPOLL); - if (ret) { -- fprintf(stderr, "Test IOPOLL failed\n"); -+ fprintf(stderr, "Test IOPOLL failed loop %d\n", ret); - return ret; - } -+ if (no_iopoll) -+ break; - } - - for (i = 0; i < 100; i++) { --- -2.19.1.6.gb485710b - diff --git a/1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch b/1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch deleted file mode 100644 index 9e3a7e93b1a49e20617cad011187654fe4372e18..0000000000000000000000000000000000000000 --- a/1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 672653880347d22bc783da6f16228f248ef09df0 Mon Sep 17 00:00:00 2001 -From: Ferry Meng -Date: Sun, 8 Oct 2023 17:02:40 +0800 -Subject: [PATCH 1010/1010] test/sqpoll-idle-us: add SQ_AFF flag - -When we use SQTHREAD_PERCPU, we should specify the CPU it runs on. The -flag is missing in sqpoll-idle-us test, now we add it. - -Signed-off-by: Ferry Meng ---- - test/sqpoll-idle-us.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/test/sqpoll-idle-us.c b/test/sqpoll-idle-us.c -index 957ea7c..2da3b54 100644 ---- a/test/sqpoll-idle-us.c -+++ b/test/sqpoll-idle-us.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include "liburing.h" - - #define DEFAULT_IDLE_US 50 -@@ -59,8 +60,10 @@ static int test_sqpoll_idle_us(int nr) - int ret, count = nr; - - srand((unsigned)time(NULL)); -- p.flags = (IORING_SETUP_SQPOLL | IORING_SETUP_SQPOLL_PERCPU | IORING_SETUP_IDLE_US); -+ p.flags = (IORING_SETUP_SQPOLL | IORING_SETUP_SQPOLL_PERCPU | -+ IORING_SETUP_SQ_AFF | IORING_SETUP_IDLE_US); - p.sq_thread_idle = DEFAULT_IDLE_US; -+ p.sq_thread_cpu = get_nprocs_conf() - 1; - - ret = io_uring_queue_init_params(nr + 10, &ring, &p); - if (ret) { --- -2.19.1.6.gb485710b - diff --git a/liburing-2.3.tar.gz b/liburing-2.3.tar.gz deleted file mode 100644 index 3f1cef2eff47f8550205be9c9d7e33979290576a..0000000000000000000000000000000000000000 Binary files a/liburing-2.3.tar.gz and /dev/null differ diff --git a/liburing-2.5.tar.gz b/liburing-2.5.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..3242bee027f58d2d1312fd7693b51c5a57a448a0 Binary files /dev/null and b/liburing-2.5.tar.gz differ diff --git a/liburing.spec b/liburing.spec index 652f9492d2ecf70558c6db694bbb6498266b1a9b..abb74c730fbce571ed3f3a94231792e8de41c1b9 100644 --- a/liburing.spec +++ b/liburing.spec @@ -1,6 +1,6 @@ -%define anolis_release 2.0.1 +%define anolis_release 1 Name: liburing -Version: 2.3 +Version: 2.5 Release: %{anolis_release}%{?dist} Summary: Linux-native io_uring I/O access library License: (GPLv2 with exceptions and LGPLv2+) or MIT @@ -14,12 +14,6 @@ Patch1001: 1001-Add-percpu-io-sq-thread-support.patch Patch1002: 1002-support-us-granularity-of-io_sq_thread_idle.patch Patch1003: 1003-add-IORING_ENTER_SQ_SUBMIT_ON_IDLE-flag.patch Patch1004: 1004-Add-a-test-for-sqpoll-sq_thread_idle_us-mode.patch -Patch1005: 1005-test-io_uring_passthrough-skip-if-kernel-doesn-t-sup.patch -Patch1006: 1006-test-io_uring_passthrough-fix-iopoll-test.patch -Patch1007: 1007-test-io_uring_passthrough-cleanup-invalid-submission.patch -Patch1008: 1008-test-io_uring_passthrough-skip-test-if-bit-sqe-cqe-s.patch -Patch1009: 1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch -Patch1010: 1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch # End: Anolis customized patches %description @@ -53,6 +47,8 @@ for the Linux-native io_uring. %dir %{abidir} %attr(0755,root,root) %{_libdir}/liburing.so.* %attr(0755,root,root) %{abidir}/liburing.dump +%attr(0755,root,root) %{_libdir}/liburing-ffi* +%attr(0755,root,root) %{abidir}/liburing-ffi*.dump %license COPYING %files devel @@ -60,12 +56,17 @@ for the Linux-native io_uring. %{_includedir}/liburing.h %{_libdir}/liburing.so %exclude %{_libdir}/liburing.a +%exclude %{_libdir}/liburing-ffi* %{_libdir}/pkgconfig/* %{_mandir}/man2/* %{_mandir}/man3/* %{_mandir}/man7/* %changelog +* Wed Feb 19 2025 mgb01105731 - 2.5-1 +- Update to 2.5 from 2.3 +- Remove patch as the new version of tarball already includes changes. + * Tue Oct 10 2023 Ferry Meng - 2.3-2.0.1 - update read-before-exit and sqpoll-idle-us tests