Skip to contentSkip to conversation

liburing: multishot timeout support

PATCH Applied David Wei 2 participants 6 messages Apr 14, 2023 – Apr 19, 2023 io_uring

lore
Share & tools
lore

David Wei

author
#0 lore raw

v3 cover liburing: multishot timeout support

Changes on the liburing side to support multishot timeouts.

Changes since v2:

* Edited man page for io_uring_prep_timeout.3

David Wei (2):
liburing: add multishot timeout support
liburing: update man page for multishot timeouts

 man/io_uring_prep_timeout.3     |   7 +
 src/include/liburing/io_uring.h |   1 +
 test/timeout.c                  | 263 ++++++++++++++++++++++++++++++++
 3 files changed, 271 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v3 1/2 liburing: add multishot timeout support

Sync the new IORING_TIMEOUT_MULTISHOT flag with kernel.

Add unit tests for multishot timeouts.

---
 src/include/liburing/io_uring.h |   1 +
 test/timeout.c                  | 263 ++++++++++++++++++++++++++++++++
 2 files changed, 264 insertions(+)
src/include/liburing/io_uring.h +1 -0
index ec068d4..3d3a63b 100644
@@ -250,6 +250,7 @@ enum io_uring_op {
 #define IORING_TIMEOUT_REALTIME		(1U << 3)
 #define IORING_LINK_TIMEOUT_UPDATE	(1U << 4)
 #define IORING_TIMEOUT_ETIME_SUCCESS	(1U << 5)
+#define IORING_TIMEOUT_MULTISHOT	(1U << 6)
 #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 +263 -0

275 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v3 2/2 liburing: update man page for multishot timeouts

In reply to David Wei
---
 man/io_uring_prep_timeout.3 | 7 +++++++
 1 file changed, 7 insertions(+)
man/io_uring_prep_timeout.3 +7 -0
index bfb8791..f4036e6 100644
@@ -51,6 +51,13 @@ Normally a timeout that triggers would return in a
 CQE
 .I res
 value.
+.TP
+.B IORING_TIMEOUT_MULTISHOT
+The request will return multiple timeout completions. The completion flag
+IORING_CQE_F_MORE is set if more timeouts are expected. The value specified in
+.I count
+is the number of repeats. A value of 0 means the timeout is indefinite and can
+only be stopped by a removal request.
 .PP
 The timeout completion event will trigger if either the specified timeout
 has occurred, or the specified number of events to wait for have been posted
Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to David Wei
Quoted 6 lines · David Wei

Changes on the liburing side to support multishot timeouts.

Changes since v2:

* Edited man page for io_uring_prep_timeout.3

Quoted 8 lines

David Wei (2):
liburing: add multishot timeout support
liburing: update man page for multishot timeouts

 man/io_uring_prep_timeout.3     |   7 +
 src/include/liburing/io_uring.h |   1 +
 test/timeout.c                  | 263 ++++++++++++++++++++++++++++++++
 3 files changed, 271 insertions(+)

I applied this, but there's an issue in that the tests don't just skip if the kernel doesn't support multishot. Tests for liburing need to accept that the feature isn't available on older kernels. Generally this is done by the first test setting 'no_timeout_mshot = true' or something like that, and then subsequent ones just returning T_SETUP_SKIP if no_timeout_mshot == true and whatever calls the test not failing if T_SETUP_SKIP is returned.

Would be great if you could send a followup patch against the current liburing -git that does that. Thanks!

Signature · 1 line
Jens Axboe
author
#4 lore raw
Quoted 25 lines · Jens Axboe
Quoted 1 line
Quoted 6 lines · David Wei

Changes on the liburing side to support multishot timeouts.

Changes since v2:

* Edited man page for io_uring_prep_timeout.3

Quoted 8 lines

David Wei (2):
liburing: add multishot timeout support
liburing: update man page for multishot timeouts

 man/io_uring_prep_timeout.3     |   7 +
 src/include/liburing/io_uring.h |   1 +
 test/timeout.c                  | 263 ++++++++++++++++++++++++++++++++
 3 files changed, 271 insertions(+)

I applied this, but there's an issue in that the tests don't just skip if the kernel doesn't support multishot. Tests for liburing need to accept that the feature isn't available on older kernels. Generally this is done by the first test setting 'no_timeout_mshot = true' or something like that, and then subsequent ones just returning T_SETUP_SKIP if no_timeout_mshot == true and whatever calls the test not failing if T_SETUP_SKIP is returned.

Quoted 2 lines

Would be great if you could send a followup patch against the current liburing -git that does that. Thanks!

Ah I didn't realise, thanks. Will do this and submit a new version.

maintainer Applied
#5 lore raw
In reply to David Wei
Quoted 11 lines · David Wei

Changes on the liburing side to support multishot timeouts.

Changes since v2:

* Edited man page for io_uring_prep_timeout.3

David Wei (2):
liburing: add multishot timeout support
liburing: update man page for multishot timeouts

[...]

Applied, thanks!

[1/2] liburing: add multishot timeout support
(no commit info)
[2/2] liburing: update man page for multishot timeouts
(no commit info)

Best regards,

Signature · 1 line
Jens Axboe