timeout tests
cover timeout tests
1/2 tests IORING_TIMEOUT_ETIME_SUCCESS,
2/2 works around a pretty rare test timeout false failures
Pavel Begunkov (2):
io_uring: test IORING_TIMEOUT_ETIME_SUCCESS
io_uring: fix SQPOLL timeout-new test
src/include/liburing/io_uring.h | 1 + test/timeout-new.c | 22 +++++++---- test/timeout.c | 67 +++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 8 deletions(-)
Signature · 1 line
2.33.0
PATCH 1/2 io_uring: test IORING_TIMEOUT_ETIME_SUCCESS
Make sure we don't fail links on ETIME when IORING_TIMEOUT_ETIME_SUCCESS is set.
--- src/include/liburing/io_uring.h | 1 + test/timeout.c | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+)
src/include/liburing/io_uring.h +1 -0
@@ -162,6 +162,7 @@ enum {#define IORING_TIMEOUT_BOOTTIME (1U << 2)#define IORING_TIMEOUT_REALTIME (1U << 3)#define IORING_LINK_TIMEOUT_UPDATE (1U << 4) +#define IORING_TIMEOUT_ETIME_SUCCESS (1U << 5)#define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)#define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)/*
test/timeout.c +67 -0
79 lines not on this page · raw message
Signature · 1 line
2.33.0
PATCH 2/2 io_uring: fix SQPOLL timeout-new test
In reply to Pavel BegunkovHappens pretty rarely, but there were cases when CQE waitinig in test_return_before_timeout() time outs before the SQPOLL thread kicks in and executes submitted requests, give SQPOLL a little bit more time.
--- test/timeout-new.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
test/timeout-new.c +14 -8
@@ -53,14 +53,12 @@ static int test_return_before_timeout(struct io_uring *ring)struct io_uring_cqe *cqe;struct io_uring_sqe *sqe;int ret; +bool retried = false;struct __kernel_timespec ts; - sqe =io_uring_get_sqe (ring); -if (!sqe) { -fprintf (stderr,"%s: get sqe failed\n" , __FUNCTION__); -return 1 ; - } +msec_to_ts (&ts,TIMEOUT_MSEC ); + sqe =io_uring_get_sqe (ring);io_uring_prep_nop (sqe); ret =io_uring_submit (ring);
@@ -69,13 +67,21 @@ static int test_return_before_timeout(struct io_uring *ring)return 1 ; } -msec_to_ts (&ts,TIMEOUT_MSEC ); +again: ret =io_uring_wait_cqe_timeout (ring, &cqe, &ts); -if (ret <0 ) { +if (ret == -ETIME && (ring->flags &IORING_SETUP_SQPOLL ) && !retried) { +/* +* there is a small chance SQPOLL hasn't been waked up yet, +* give it one more try. +*/ +printf ("warning: funky SQPOLL timing\n" ); +sleep (1 ); + retried = true; + goto again; + }else if (ret <0 ) {fprintf (stderr,"%s: timeout error: %d\n" , __FUNCTION__, ret);return 1 ; } -io_uring_cqe_seen (ring, cqe);return 0 ; }
Signature · 1 line
2.33.0
Quoted 2 lines · Pavel Begunkov
1/2 tests
IORING_TIMEOUT_ETIME_SUCCESS,
2/2 works around a pretty rare test timeout false failures
Applied, thanks.
Signature · 1 line
Jens Axboe