diff --git a/liburing-2.4.tar.bz2 b/liburing-2.4.tar.bz2 deleted file mode 100644 index f768f94..0000000 --- a/liburing-2.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ca260e7a5820c2d0e737ec1e9b999f10776dbe84a169a02a0eff10c8eeaf3394 -size 213774 diff --git a/liburing-2.5.tar.bz2 b/liburing-2.5.tar.bz2 new file mode 100644 index 0000000..fd07780 --- /dev/null +++ b/liburing-2.5.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:319ff9096a5655362a9741c5145b45494db810e38679a1de82e2f440c17181a6 +size 217397 diff --git a/liburing.changes b/liburing.changes index aa5d3b3..333abb5 100644 --- a/liburing.changes +++ b/liburing.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Wed Apr 3 08:40:14 UTC 2024 - Jiri Slaby + +- Update to 2.5: + * Add support for io_uring_prep_cmd_sock() + * Add support for application allocated ring memory, for placing rings + in huge mem. Available through io_uring_queue_init_mem(). + * Add support for registered ring fds + * Various documentation updates + * Various fixes +- Remove (they are upstream) + * test-io_uring_register-fix-errno-confusion-and-new-e.patch + * tests-don-t-expect-multishot-recv-overflow-backloggi.patch +- Add + * test-recv-multishot-wait-for-the-right-amount-of-CQE.patch (to fix test + errors on the 6.8.2 kernel) + * test-no-mmap-inval-0-return-is-fine-too.patch (fix the test) + ------------------------------------------------------------------- Mon Dec 4 16:39:29 UTC 2023 - Guillaume GARDET diff --git a/liburing.spec b/liburing.spec index 5c43aaa..12627cf 100644 --- a/liburing.spec +++ b/liburing.spec @@ -1,7 +1,7 @@ # # spec file for package liburing # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,15 @@ %define lname liburing2 Name: liburing -Version: 2.4 +Version: 2.5 Release: 0 Summary: Linux-native io_uring I/O access library License: (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT Group: Development/Libraries/C and C++ URL: https://git.kernel.dk/cgit/liburing Source: https://git.kernel.dk/cgit/liburing/snapshot/%{name}-%{version}.tar.bz2 -Patch0: test-io_uring_register-fix-errno-confusion-and-new-e.patch -Patch1: tests-don-t-expect-multishot-recv-overflow-backloggi.patch +Patch0: test-recv-multishot-wait-for-the-right-amount-of-CQE.patch +Patch1: test-no-mmap-inval-0-return-is-fine-too.patch BuildRequires: gcc-c++ BuildRequires: pkgconfig BuildRequires: procps diff --git a/test-io_uring_register-fix-errno-confusion-and-new-e.patch b/test-io_uring_register-fix-errno-confusion-and-new-e.patch deleted file mode 100644 index 3f1842f..0000000 --- a/test-io_uring_register-fix-errno-confusion-and-new-e.patch +++ /dev/null @@ -1,171 +0,0 @@ -From: Jens Axboe -Date: Wed, 28 Jun 2023 19:43:02 -0600 -Subject: test/io_uring_register: fix errno confusion and new error -Git-commit: 2d3368b73b478a737b2247ef5630be56c3b176b5 -Patch-mainline: 2.5 -References: kernel 6.5 - -This test suffers from some serious errno vs liburing function return. -All liburing functions return a negative errno value on failure, there's -no use of errno at all. This means that rather than check for the return -being -1 and then relying on errno being set to EINVAL, liburing -functions return -EINVAL directly instead. - -Outside of that, due to recent kernel changes, we may now get -EFAULT -when trying to register a file backed buffers. Before we always returned --EOPNOTSUPP. Correct that as well. - -Signed-off-by: Jens Axboe -Signed-off-by: Jiri Slaby (SUSE) ---- - test/io_uring_register.c | 51 +++++++++++++++++++--------------------- - 1 file changed, 24 insertions(+), 27 deletions(-) - -diff --git a/test/io_uring_register.c b/test/io_uring_register.c -index ddd4fe374702..0f44af85eed3 100644 ---- a/test/io_uring_register.c -+++ b/test/io_uring_register.c -@@ -32,7 +32,7 @@ static rlim_t mlock_limit; - static int devnull; - - static int expect_fail(int fd, unsigned int opcode, void *arg, -- unsigned int nr_args, int error) -+ unsigned int nr_args, int error, int error2) - { - int ret; - -@@ -55,8 +55,8 @@ static int expect_fail(int fd, unsigned int opcode, void *arg, - return 1; - } - -- if (ret != error) { -- fprintf(stderr, "expected %d, got %d\n", error, ret); -+ if (ret != error && (error2 && ret != error2)) { -+ fprintf(stderr, "expected %d/%d, got %d\n", error, error2, ret); - return 1; - } - return 0; -@@ -195,8 +195,7 @@ static int test_max_fds(int uring_fd) - status = 0; - ret = io_uring_register(uring_fd, IORING_UNREGISTER_FILES, 0, 0); - if (ret < 0) { -- ret = errno; -- errno = ret; -+ errno = -ret; - perror("io_uring_register UNREGISTER_FILES"); - exit(1); - } -@@ -230,22 +229,20 @@ static int test_memlock_exceeded(int fd) - - while (iov.iov_len) { - ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1); -- if (ret < 0) { -- if (errno == ENOMEM) { -- iov.iov_len /= 2; -- continue; -- } -- if (errno == EFAULT) { -- free(buf); -- return 0; -- } -- fprintf(stderr, "expected success or EFAULT, got %d\n", errno); -+ if (ret == -ENOMEM) { -+ iov.iov_len /= 2; -+ continue; -+ } else if (ret == -EFAULT) { -+ free(buf); -+ return 0; -+ } else if (ret) { -+ fprintf(stderr, "expected success or EFAULT, got %d\n", ret); - free(buf); - return 1; - } - ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS, NULL, 0); - if (ret != 0) { -- fprintf(stderr, "error: unregister failed with %d\n", errno); -+ fprintf(stderr, "error: unregister failed with %d\n", ret); - free(buf); - return 1; - } -@@ -277,15 +274,15 @@ static int test_iovec_nr(int fd) - iovs[i].iov_len = pagesize; - } - -- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, iovs, nr, -EINVAL); -+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, iovs, nr, -EINVAL, 0); - - /* reduce to UIO_MAXIOV */ - nr = UIO_MAXIOV; - ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, iovs, nr); -- if (ret && (errno == ENOMEM || errno == EPERM) && geteuid()) { -+ if ((ret == -ENOMEM || ret == -EPERM) && geteuid()) { - fprintf(stderr, "can't register large iovec for regular users, skip\n"); - } else if (ret != 0) { -- fprintf(stderr, "expected success, got %d\n", errno); -+ fprintf(stderr, "expected success, got %d\n", ret); - status = 1; - } else { - io_uring_register(fd, IORING_UNREGISTER_BUFFERS, 0, 0); -@@ -308,12 +305,12 @@ static int test_iovec_size(int fd) - /* NULL pointer for base */ - iov.iov_base = 0; - iov.iov_len = 4096; -- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT); -+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0); - - /* valid base, 0 length */ - iov.iov_base = &buf; - iov.iov_len = 0; -- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT); -+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0); - - /* valid base, length exceeds size */ - /* this requires an unampped page directly after buf */ -@@ -324,7 +321,7 @@ static int test_iovec_size(int fd) - assert(ret == 0); - iov.iov_base = buf; - iov.iov_len = 2 * pagesize; -- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT); -+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, 0); - munmap(buf, pagesize); - - /* huge page */ -@@ -372,7 +369,7 @@ static int test_iovec_size(int fd) - status = 1; - iov.iov_base = buf; - iov.iov_len = 2*1024*1024; -- status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EOPNOTSUPP); -+ status |= expect_fail(fd, IORING_REGISTER_BUFFERS, &iov, 1, -EFAULT, -EOPNOTSUPP); - munmap(buf, 2*1024*1024); - - /* bump up against the soft limit and make sure we get EFAULT -@@ -442,7 +439,7 @@ static int test_poll_ringfd(void) - * fail, because the kernel does not allow registering of the - * ring_fd. - */ -- status |= expect_fail(fd, IORING_REGISTER_FILES, &fd, 1, -EBADF); -+ status |= expect_fail(fd, IORING_REGISTER_FILES, &fd, 1, -EBADF, 0); - - /* tear down queue */ - io_uring_queue_exit(&ring); -@@ -475,14 +472,14 @@ int main(int argc, char **argv) - } - - /* invalid fd */ -- status |= expect_fail(-1, 0, NULL, 0, -EBADF); -+ status |= expect_fail(-1, 0, NULL, 0, -EBADF, 0); - /* valid fd that is not an io_uring fd */ -- status |= expect_fail(devnull, 0, NULL, 0, -EOPNOTSUPP); -+ status |= expect_fail(devnull, 0, NULL, 0, -EOPNOTSUPP, 0); - - /* invalid opcode */ - memset(&p, 0, sizeof(p)); - fd = new_io_uring(1, &p); -- ret = expect_fail(fd, ~0U, NULL, 0, -EINVAL); -+ ret = expect_fail(fd, ~0U, NULL, 0, -EINVAL, 0); - if (ret) { - /* if this succeeds, tear down the io_uring instance - * and start clean for the next test. */ --- -2.42.0 - diff --git a/test-no-mmap-inval-0-return-is-fine-too.patch b/test-no-mmap-inval-0-return-is-fine-too.patch new file mode 100644 index 0000000..cff6037 --- /dev/null +++ b/test-no-mmap-inval-0-return-is-fine-too.patch @@ -0,0 +1,30 @@ +From: Jens Axboe +Date: Tue, 7 Nov 2023 08:05:52 -0700 +Subject: test/no-mmap-inval: 0 return is fine too +Git-repo: git://git.kernel.dk/liburing.git +Git-commit: 9dc95a03e4a764e42b9e62990bb00feb9307ba63 +Patch-mainline: 2.6 +References: test_fix + +Signed-off-by: Jens Axboe +Signed-off-by: Jiri Slaby +--- + test/no-mmap-inval.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/no-mmap-inval.c b/test/no-mmap-inval.c +index e851078d..9571fee0 100644 +--- a/test/no-mmap-inval.c ++++ b/test/no-mmap-inval.c +@@ -31,7 +31,7 @@ int main(int argc, char *argv[]) + if (ret == -EINVAL) { + /* kernel doesn't support SETUP_NO_MMAP */ + return T_EXIT_SKIP; +- } else if (ret != -EFAULT) { ++ } else if (ret && ret != -EFAULT) { + fprintf(stderr, "Got %d, wanted -EFAULT\n", ret); + return T_EXIT_FAIL; + } +-- +2.44.0 + diff --git a/test-recv-multishot-wait-for-the-right-amount-of-CQE.patch b/test-recv-multishot-wait-for-the-right-amount-of-CQE.patch new file mode 100644 index 0000000..148ac3e --- /dev/null +++ b/test-recv-multishot-wait-for-the-right-amount-of-CQE.patch @@ -0,0 +1,50 @@ +From: Jens Axboe +Date: Tue, 6 Feb 2024 13:17:14 -0700 +Subject: test/recv-multishot: wait for the right amount of CQEs +Git-repo: git://git.kernel.dk/liburing.git +Git-commit: a1d5e4b863a60af93d0cab9d4bbf578733337a90 +Patch-mainline: 2.6 +References: kernel 6.9 + +This test assumes that all task_work is a) has already arrived, and +b) will always be fully run even though the app asked for less, which +can lead to premature checking of CQEs and hitting end-of-CQEs before +it should. + +Fix it up to wait for what it needs. + +Signed-off-by: Jens Axboe +Signed-off-by: Jiri Slaby +--- + test/recv-multishot.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/test/recv-multishot.c b/test/recv-multishot.c +index f66f1319..39983e8d 100644 +--- a/test/recv-multishot.c ++++ b/test/recv-multishot.c +@@ -57,7 +57,7 @@ static int test(struct args *args) + int const N = 8; + int const N_BUFFS = N * 64; + int const N_CQE_OVERFLOW = 4; +- int const min_cqes = 2; ++ int const min_cqes = args->early_error ? 2 : 8; + int const NAME_LEN = sizeof(struct sockaddr_storage); + int const CONTROL_LEN = CMSG_ALIGN(sizeof(struct sockaddr_storage)) + + sizeof(struct cmsghdr); +@@ -237,7 +237,11 @@ static int test(struct args *args) + usleep(1000); + + if ((args->stream && !early_error) || recv_cqes < min_cqes) { +- ret = io_uring_wait_cqes(&ring, &cqe, 1, &timeout, NULL); ++ unsigned int to_wait = 1; ++ ++ if (recv_cqes < min_cqes) ++ to_wait = min_cqes - recv_cqes; ++ ret = io_uring_wait_cqes(&ring, &cqe, to_wait, &timeout, NULL); + if (ret && ret != -ETIME) { + fprintf(stderr, "wait final failed: %d\n", ret); + ret = -1; +-- +2.44.0 + diff --git a/tests-don-t-expect-multishot-recv-overflow-backloggi.patch b/tests-don-t-expect-multishot-recv-overflow-backloggi.patch deleted file mode 100644 index 4073b4b..0000000 --- a/tests-don-t-expect-multishot-recv-overflow-backloggi.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Pavel Begunkov -Date: Fri, 11 Aug 2023 13:58:30 +0100 -Subject: tests: don't expect multishot recv overflow backlogging -Patch-mainline: 2.5 -Git-commit: b73e940c9dd4ffa8ac121db046c0788376691b99 -References: kernel 6.5 - -Multishots may and are likely to complete when there is no space in CQ, -don't rely on overflows. - -Signed-off-by: Pavel Begunkov -Link: https://lore.kernel.org/r/d078c0f797322bd01d8c91743d652b734e83e9ba.1691758633.git.asml.silence@gmail.com -Signed-off-by: Jens Axboe -Signed-off-by: Jiri Slaby (SUSE) ---- - test/recv-multishot.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/recv-multishot.c b/test/recv-multishot.c -index e4a07ce976cc..f66f13198dde 100644 ---- a/test/recv-multishot.c -+++ b/test/recv-multishot.c -@@ -271,7 +271,7 @@ static int test(struct args *args) - */ - bool const early_last = args->early_error == ERROR_EARLY_OVERFLOW && - !args->wait_each && -- i == N_CQE_OVERFLOW && -+ i >= N_CQE_OVERFLOW && - !(cqe->flags & IORING_CQE_F_MORE); - - bool const should_be_last = --- -2.42.0 -