From 48a5ef16eb720fadea42d549a684b5f3f74736b0 Mon Sep 17 00:00:00 2001 From: Ferry Meng Date: Tue, 10 Oct 2023 10:35:40 +0800 Subject: [PATCH] liburing: update liburing tests. update and tests in liburing. Signed-off-by: Ferry Meng --- ...-exit-handle-IOPOLL-failure-on-older.patch | 64 +++++++++++++++++++ ...-test-sqpoll-idle-us-add-SQ_AFF-flag.patch | 40 ++++++++++++ liburing.spec | 7 +- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch create mode 100644 1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch 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 new file mode 100644 index 0000000..11ec35a --- /dev/null +++ b/1009-test-read-before-exit-handle-IOPOLL-failure-on-older.patch @@ -0,0 +1,64 @@ +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 new file mode 100644 index 0000000..9e3a7e9 --- /dev/null +++ b/1010-test-sqpoll-idle-us-add-SQ_AFF-flag.patch @@ -0,0 +1,40 @@ +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.spec b/liburing.spec index fcba43a..652f949 100644 --- a/liburing.spec +++ b/liburing.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 2.0.1 Name: liburing Version: 2.3 Release: %{anolis_release}%{?dist} @@ -18,6 +18,8 @@ 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 @@ -64,6 +66,9 @@ for the Linux-native io_uring. %{_mandir}/man7/* %changelog +* Tue Oct 10 2023 Ferry Meng - 2.3-2.0.1 +- update read-before-exit and sqpoll-idle-us tests + * Tue Jun 20 2023 Joseph Qi - 2.3-2 - update io_uring_passthrough testcase -- Gitee