diff --git a/test/read-before-exit.c b/test/read-before-exit.c index be36bd41335db8f743cb3ed4b5099a106e2d2f17..f7af5502bb7ea6242b16ec04563a287261bebe65 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++) { diff --git a/test/sqpoll-idle-us.c b/test/sqpoll-idle-us.c index 957ea7ce0f735d92a87e694f49f5f95b21340fcb..2da3b54e47dceca70b83ab79b6aa2d0a6c6668b4 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) {