Skip to contentSkip to conversation

zerocopy send headers and tests

PATCH Superseded Pavel Begunkov 4 participants 14 messages Jul 25, 2022 – Jul 26, 2022 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover zerocopy send headers and tests

Add zerocopy send headers, helpers and tests

Pavel Begunkov (4):
io_uring.h: sync with kernel for zc send and notifiers
liburing: add zc send and notif helpers
tests: add tests for zerocopy send and notifications
examples: add a zerocopy send example

 examples/Makefile               |   3 +-
 examples/send-zerocopy.c        | 366 +++++++++++++
 src/include/liburing.h          |  41 ++
 src/include/liburing/io_uring.h |  37 +-
 src/liburing.map                |   2 +
 src/register.c                  |  20 +
 test/Makefile                   |   1 +
 test/send-zcopy.c               | 879 ++++++++++++++++++++++++++++++++
 8 files changed, 1346 insertions(+), 3 deletions(-)
 create mode 100644 examples/send-zerocopy.c
 create mode 100644 test/send-zcopy.c
Signature · 1 line
2.37.0
#1 lore raw

PATCH 1/4 io_uring.h: sync with kernel for zc send and notifiers

---
 src/include/liburing/io_uring.h | 37 +++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)
src/include/liburing/io_uring.h +35 -2
index 99e6963..3953807 100644
@@ -64,6 +64,10 @@ struct io_uring_sqe {
 	union {
 		__s32	splice_fd_in;
 		__u32	file_index;
+		struct {
+			__u16	notification_idx;
+			__u16	addr_len;
+		};
 	};
 	__u64	addr3;
 	__u64	__pad2[1];
@@ -160,7 +164,8 @@ enum io_uring_op {
 	IORING_OP_FALLOCATE,
 	IORING_OP_OPENAT,
 	IORING_OP_CLOSE,
-	IORING_OP_FILES_UPDATE,
+	IORING_OP_RSRC_UPDATE,
+	IORING_OP_FILES_UPDATE = IORING_OP_RSRC_UPDATE,
 	IORING_OP_STATX,
 	IORING_OP_READ,
 	IORING_OP_WRITE,
@@ -187,6 +192,7 @@ enum io_uring_op {
 	IORING_OP_GETXATTR,
 	IORING_OP_SOCKET,
 	IORING_OP_URING_CMD,
+	IORING_OP_SENDZC_NOTIF,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
@@ -208,6 +214,7 @@ enum io_uring_op {
 #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)
+
 /*
  * sqe->splice_flags
  * extends splice(2) flags
@@ -254,13 +261,23 @@ enum io_uring_op {
  *				CQEs on behalf of the same SQE.
  */
 #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
-#define IORING_RECV_MULTISHOT	(1U << 1)
+#define IORING_RECV_MULTISHOT		(1U << 1)
+#define IORING_RECVSEND_FIXED_BUF	(1U << 2)
+#define IORING_RECVSEND_NOTIF_FLUSH	(1U << 3)
 
 /*
  * accept flags stored in sqe->ioprio
  */
 #define IORING_ACCEPT_MULTISHOT	(1U << 0)
 
+/*
+ * IORING_OP_RSRC_UPDATE flags
+ */
+enum {
+	IORING_RSRC_UPDATE_FILES,
+	IORING_RSRC_UPDATE_NOTIF,
+};
+
 /*
  * IO completion data structure (Completion Queue Entry)
  */
@@ -426,6 +443,9 @@ enum {
 	/* register a range of fixed file slots for automatic slot allocation */
 	IORING_REGISTER_FILE_ALLOC_RANGE	= 25,
 
+	IORING_REGISTER_NOTIFIERS		= 26,
+	IORING_UNREGISTER_NOTIFIERS		= 27,
+
 	/* this goes last */
 	IORING_REGISTER_LAST
 };
@@ -472,6 +492,19 @@ struct io_uring_rsrc_update2 {
 	__u32 resv2;
 };
 
+struct io_uring_notification_slot {
+	__u64 tag;
+	__u64 resv[3];
+};
+
+struct io_uring_notification_register {
+	__u32 nr_slots;
+	__u32 resv;
+	__u64 resv2;
+	__u64 data;
+	__u64 resv3;
+};
+
 /* Skip updating fd indexes set to this value in the fd table */
 #define IORING_REGISTER_FILES_SKIP	(-2)
 
Signature · 1 line
2.37.0
#2 lore raw

PATCH 2/4 liburing: add zc send and notif helpers

In reply to Pavel Begunkov

Add helpers for notification registration and preparing zerocopy send requests.

---
 src/include/liburing.h | 41 +++++++++++++++++++++++++++++++++++++++++
 src/liburing.map       |  2 ++
 src/register.c         | 20 ++++++++++++++++++++
 3 files changed, 63 insertions(+)
src/include/liburing.h +41 -0
index fc7613d..f3c5887 100644
@@ -189,6 +189,10 @@ int io_uring_register_sync_cancel(struct io_uring *ring,
 int io_uring_register_file_alloc_range(struct io_uring *ring,
 					unsigned off, unsigned len);
 
+int io_uring_register_notifications(struct io_uring *ring, unsigned nr,
+				    struct io_uring_notification_slot *slots);
+int io_uring_unregister_notifications(struct io_uring *ring);
+
 /*
  * Helper for the peek/wait single cqe functions. Exported because of that,
  * but probably shouldn't be used directly in an application.
@@ -677,6 +681,43 @@ static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd,
 	sqe->msg_flags = (__u32) flags;
 }
 
+static inline void io_uring_prep_sendzc(struct io_uring_sqe *sqe, int sockfd,
+				        const void *buf, size_t len, int flags,
+				        unsigned slot_idx, unsigned zc_flags)
+{
+	io_uring_prep_rw(IORING_OP_SENDZC_NOTIF, sqe, sockfd, buf, (__u32) len, 0);
+	sqe->msg_flags = (__u32) flags;
+	sqe->notification_idx = slot_idx;
+	sqe->ioprio = zc_flags;
+}
+
+static inline void io_uring_prep_sendzc_fixed(struct io_uring_sqe *sqe, int sockfd,
+					      const void *buf, size_t len,
+					      int flags, unsigned slot_idx,
+					      unsigned zc_flags, unsigned buf_idx)
+{
+	io_uring_prep_sendzc(sqe, sockfd, buf, len, flags, slot_idx, zc_flags);
+	sqe->ioprio |= IORING_RECVSEND_FIXED_BUF;
+	sqe->buf_index = buf_idx;
+}
+
+static inline void io_uring_prep_sendzc_set_addr(struct io_uring_sqe *sqe,
+						 const struct sockaddr *dest_addr,
+						 __u16 addr_len)
+{
+	sqe->addr2 = (unsigned long)(void *)dest_addr;
+	sqe->addr_len = addr_len;
+}
+
+static inline void io_uring_prep_notif_update(struct io_uring_sqe *sqe,
+					      __u64 new_tag, /* 0 to ignore */
+					      unsigned offset, unsigned nr)
+{
+	io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
+			 (__u64)offset);
+	sqe->ioprio = IORING_RSRC_UPDATE_NOTIF;
+}
+
 static inline void io_uring_prep_recv(struct io_uring_sqe *sqe, int sockfd,
 				      void *buf, size_t len, int flags)
 {
src/liburing.map +2 -0
index 318d3d7..7d8f143 100644
@@ -60,4 +60,6 @@ LIBURING_2.3 {
 	global:
 		io_uring_register_sync_cancel;
 		io_uring_register_file_alloc_range;
+		io_uring_register_notifications;
+		io_uring_unregister_notifications;
 } LIBURING_2.2;
src/register.c +20 -0
index 2b37e5f..7482112 100644
@@ -364,3 +364,23 @@ int io_uring_register_file_alloc_range(struct io_uring *ring,
 				       IORING_REGISTER_FILE_ALLOC_RANGE, &range,
 				       0);
 }
+
+int io_uring_register_notifications(struct io_uring *ring, unsigned nr,
+				    struct io_uring_notification_slot *slots)
+{
+	struct io_uring_notification_register r = {
+		.nr_slots = nr,
+		.data = (unsigned long)slots,
+	};
+
+	return __sys_io_uring_register(ring->ring_fd,
+				       IORING_REGISTER_NOTIFIERS,
+				       &r, sizeof(r));
+}
+
+int io_uring_unregister_notifications(struct io_uring *ring)
+{
+	return __sys_io_uring_register(ring->ring_fd,
+				       IORING_UNREGISTER_NOTIFIERS,
+				       NULL, 0);
+}
Signature · 1 line
2.37.0
#3 lore raw

Re: [PATCH liburing 2/4] liburing: add zc send and notif helpers

Hi Pavel,

src/include/liburing.h static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd, · line 720

Quoted 9 lines · Pavel Begunkov
src/include/liburing.h +9 -0
+static inline void io_uring_prep_notif_update(struct io_uring_sqe *sqe,
+					      __u64 new_tag, /* 0 to ignore */
+					      unsigned offset, unsigned nr)
+{
+	io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
+			 (__u64)offset);
+	sqe->ioprio = IORING_RSRC_UPDATE_NOTIF;
+}
+

This part breaks 32-bit architecture.

include/liburing.h: In function ‘io_uring_prep_notif_update’:
In file included from syscall.h:14,

                   from setup.c:5:
  include/liburing.h: In function ‘io_uring_prep_notif_update’:
  include/liburing.h:716:59: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    716 |         io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
        |                                                           ^
  include/liburing.h:716:59: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    716 |         io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
        |
Signature · 1 line
Ammar Faizi
#4 lore raw

Re: [PATCH liburing 2/4] liburing: add zc send and notif helpers

Quoted 15 lines · Ammar Faizi

Hi Pavel,

src/include/liburing.h static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd, · line 720

Quoted 9 lines · Pavel Begunkov
src/include/liburing.h +9 -0
+static inline void io_uring_prep_notif_update(struct io_uring_sqe *sqe,
+                          __u64 new_tag, /* 0 to ignore */
+                          unsigned offset, unsigned nr)
+{
+    io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
+             (__u64)offset);
+    sqe->ioprio = IORING_RSRC_UPDATE_NOTIF;
+}
+

This part breaks 32-bit architecture.

Quoted 10 lines

  include/liburing.h: In function ‘io_uring_prep_notif_update’:
  In file included from syscall.h:14,
                   from setup.c:5:
  include/liburing.h: In function ‘io_uring_prep_notif_update’:
  include/liburing.h:716:59: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 716 |         io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
        |                                                           ^ include/liburing.h:716:59: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 716 |         io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, (void *)new_tag, nr,
        |

Got it, thanks

Signature · 1 line
Pavel Begunkov
#5 lore raw

PATCH 3/4 tests: add tests for zerocopy send and notifications

In reply to Pavel Begunkov
---
 test/Makefile     |   1 +
 test/send-zcopy.c | 879 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 880 insertions(+)
 create mode 100644 test/send-zcopy.c
test/Makefile +1 -0
index 8945368..7b6018c 100644
@@ -175,6 +175,7 @@ test_srcs := \
 	xattr.c \
 	skip-cqe.c \
 	single-issuer.c \
+	send-zcopy.c \
 	# EOL
 
 all_targets :=
test/send-zcopy.c new file +879 -0

879 lines not on this page · raw message

Signature · 1 line
2.37.0
#6 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

On 7/25/22 5:03 PM, Pavel Begunkov wrote:> diff --git a/test/Makefile b/test/Makefile

test/Makefile test_srcs := \ · line 179

Quoted 9 lines

index 8945368..7b6018c 100644

test/Makefile +1 -0
@@ -175,6 +175,7 @@ test_srcs := \
  	xattr.c \
  	skip-cqe.c \
  	single-issuer.c \
+	send-zcopy.c \
  	# EOL

I have been trying to keep this list sorted alphabetically. Can we?

test/Makefile test_srcs := \

Quoted 7 lines
test/Makefile +7 -0
+int main(int argc, char *argv[])
+{
+	struct io_uring ring;
+	int i, ret, sp[2];
+
+	if (argc > 1)
+		return 0;

New test should use the provided exit code protocol. This should have been "return T_EXIT_SKIP;"

test/Makefile

Quoted 5 lines
test/Makefile +5 -0
+	ret = io_uring_queue_init(32, &ring, 0);
+	if (ret) {
+		fprintf(stderr, "queue init failed: %d\n", ret);
+		return 1;
+	}

This should have been "return T_EXIT_FAIL;".

Quoted 8 lines
test/Makefile +8 -0
+	ret = register_notifications(&ring);
+	if (ret == -EINVAL) {
+		printf("sendzc is not supported, skip\n");
+		return 0;
+	} else if (ret) {
+		fprintf(stderr, "register notif failed %i\n", ret);
+		return 1;
+	}

[...]

test/Makefile

Quoted 7 lines
test/Makefile +7 -0
+
+out:
+	io_uring_queue_exit(&ring);
+	close(sp[0]);
+	close(sp[1]);
+	return 0;
+}

and so on...

Signature · 1 line
Ammar Faizi
#7 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

Quoted 12 lines · Ammar Faizi

On 7/25/22 5:03 PM, Pavel Begunkov wrote:> diff --git a/test/Makefile b/test/Makefile

test/Makefile test_srcs := \ · line 179

Quoted 9 lines

index 8945368..7b6018c 100644

test/Makefile +1 -0
@@ -175,6 +175,7 @@ test_srcs := \
       xattr.c \
       skip-cqe.c \
       single-issuer.c \
+    send-zcopy.c \
       # EOL

I have been trying to keep this list sorted alphabetically. Can we?

Don't see any reason for that, especially since it's not sorted.

Quoted 10 lines

test/Makefile test_srcs := \

Quoted 7 lines
test/Makefile +7 -0
+int main(int argc, char *argv[])
+{
+    struct io_uring ring;
+    int i, ret, sp[2];
+
+    if (argc > 1)
+        return 0;

New test should use the provided exit code protocol. This should have been "return T_EXIT_SKIP;"

Oh, I already hate those rules, sounds like they were specifically honed to make patching harder. By the way, while we're at it, what is T_EXIT_ERROR? Why it's not used anywhere and how it's different from T_EXIT_FAIL?

Quoted 27 lines
Quoted 5 lines

+    ret = io_uring_queue_init(32, &ring, 0);
+    if (ret) {
+        fprintf(stderr, "queue init failed: %d\n", ret); +        return 1;
+    }

This should have been "return T_EXIT_FAIL;".

Quoted 8 lines

+    ret = register_notifications(&ring);
+    if (ret == -EINVAL) {
+        printf("sendzc is not supported, skip\n"); +        return 0;
+    } else if (ret) {
+        fprintf(stderr, "register notif failed %i\n", ret); +        return 1;
+    }

[...]

test/Makefile

Quoted 7 lines
test/Makefile +7 -0
+
+out:
+    io_uring_queue_exit(&ring);
+    close(sp[0]);
+    close(sp[1]);
+    return 0;
+}

and so on...

Signature · 1 line
Pavel Begunkov
#8 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

Quoted 1 line · Pavel Begunkov

Don't see any reason for that

Not that important, just for easy finding. Especially when the number of tests increase. And yes, it always increases from time to time.

Quoted 1 line

especially since it's not sorted.

It was, but since that skip-cqe.c exists, it's no longer :p OK, OK, that's trivial, never mind. Let's move on.

Quoted 5 lines
Quoted 2 lines

New test should use the provided exit code protocol. This should have been "return T_EXIT_SKIP;"

Oh, I already hate those rules, sounds like they were specifically honed to make patching harder.

Lol, how damn hard is it to use it.

Quoted 2 lines

By the way, while we're at it, what is T_EXIT_ERROR? Why it's not used anywhere and how it's different from T_EXIT_FAIL?

[ Adding Eli to the participants. ]

Ummm... yeah. I am curious about it too now. I just took a look at commit:

ed430fbeb33367 ("tests: migrate some tests to use enum-based exit codes").

Eli said:

From: Eli Schwartz <[email protected]>
Date: Mon, 27 Jun 2022 14:39:05 -0400
Subject: [PATCH] tests: migrate some tests to use enum-based exit codes

For maintainability and clarity, eschew the use of integer literals in reporting test statuses. Instead, use a helper enum which contains various values from the GNU exitcode protocol. Returning 0 or 1 is obvious, and in the previous commit the ability to read "skip" (77) was implemented. The final exit status is 99, which indicates some kind of error in running the test itself.

A partial migration of existing pass/fail values in test sources is included.

That T_EXIT_ERROR is 99 here. Not sure when to use it in liburing test. Eli?

[ Just for reference in case you (Eli) want to see the full message:

https://lore.kernel.org/io-uring/[email protected]/ ]

Signature · 1 line
Ammar Faizi
#9 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

Quoted 11 lines · Ammar Faizi
Quoted 1 line · Pavel Begunkov

Don't see any reason for that

Not that important, just for easy finding. Especially when the number of tests increase. And yes, it always increases from time to time.

Quoted 1 line

especially since it's not sorted.

It was, but since that skip-cqe.c exists, it's no longer :p OK, OK, that's trivial, never mind. Let's move on.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

New test should use the provided exit code protocol. This should have been "return T_EXIT_SKIP;"

Oh, I already hate those rules, sounds like they were specifically honed to make patching harder.

Lol, how damn hard is it to use it.

Not hard to use, I agree, but it's rather yet another thing that I need to keep in mind and then it unavoidably gets forgotten and makes to spend extra 10 minutes to fix/retest/resend/etc., which is annoying.

Testing is not the most exciting part, frameworks are usually trying to simplify writing tests even if there is a learning curve. Implicit rules make it worse. I wouldn't have been complaining if the compiler failed the build or at least runtests.sh warned about it.

Quoted 34 lines
Quoted 2 lines

By the way, while we're at it, what is T_EXIT_ERROR? Why it's not used anywhere and how it's different from T_EXIT_FAIL?

[ Adding Eli to the participants. ]

Ummm... yeah. I am curious about it too now. I just took a look at commit:

   ed430fbeb33367 ("tests: migrate some tests to use enum-based exit codes").

Eli said:

    From: Eli Schwartz <[email protected]>
    Date: Mon, 27 Jun 2022 14:39:05 -0400
    Subject: [PATCH] tests: migrate some tests to use enum-based exit codes

    For maintainability and clarity, eschew the use of integer literals in reporting test statuses. Instead, use a helper enum which contains various values from the GNU exitcode protocol. Returning 0 or 1 is obvious, and in the previous commit the ability to read "skip" (77) was implemented. The final exit status is 99, which indicates some kind of error in running the test itself.

    A partial migration of existing pass/fail values in test sources is included.

That T_EXIT_ERROR is 99 here. Not sure when to use it in liburing test. Eli?

[ Just for reference in case you (Eli) want to see the full message:

  https://lore.kernel.org/io-uring/[email protected]/  ]

Signature · 1 line
Pavel Begunkov
#10 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

In reply to Ammar Faizi
Quoted 25 lines · Ammar Faizi
Quoted 3 lines · Pavel Begunkov

By the way, while we're at it, what is T_EXIT_ERROR? Why it's not used anywhere
and how it's different from T_EXIT_FAIL?

[ Adding Eli to the participants. ]

Ummm... yeah. I am curious about it too now. I just took a look at commit:

   ed430fbeb33367 ("tests: migrate some tests to use enum-based exit codes").

Eli said:

    From: Eli Schwartz <[email protected]>
    Date: Mon, 27 Jun 2022 14:39:05 -0400
    Subject: [PATCH] tests: migrate some tests to use enum-based exit codes

    For maintainability and clarity, eschew the use of integer literals in reporting test statuses. Instead, use a helper enum which contains various values from the GNU exitcode protocol. Returning 0 or 1 is obvious, and in the previous commit the ability to read "skip" (77) was implemented. The final exit status is 99, which indicates some kind of error in running the test itself.

Quoted 8 lines

    A partial migration of existing pass/fail values in test sources is included.

That T_EXIT_ERROR is 99 here. Not sure when to use it in liburing test. Eli?

A test failure means that the test ran "successfully", and reported that something is wrong with the software being tested. It is collected as a test result which needs to be investigated to fix the software, but only usually. It's also possible for some test harnesses to have a list of tests where you know you have a bug, you know it's not fixed, and you don't want to be constantly bothered by it, so you mark it as "should_fail: true" (Meson) or XFAIL_TESTS= (GNU autotools) so that the test report harness doesn't list it either as a "pass" or a "fail". Instead it's listed as "expected/known fail" and the test harness itself doesn't count it as an overall failure.

(If that test starts to pass, it's reported as an "unexpected pass" and the test harness itself counts it as an overall failure. The idea is that you then want to do your bookkeeping and record that whatever commit caused the unexpected pass, has fixed a longstanding bug.)

...

T_EXIT_ERROR is different. It doesn't mean the test ran, and reported something wrong with the software (e.g. liburing). Instead, an ERROR return value indicates that the test itself broke and cannot even be relied on to accurately test for a bug/regression. For example, if that test was designated as an expected failure, it still knows that in this case, error != fail, and it won't ignore the result as an expected failure.

Also in general, if you see test errors you know to look at bugs in the testsuite instead of trying to debug the software. :)

I added T_EXIT_ERROR because it may be useful, without knowing in advance whether I would have cause to use it anywhere. It's a valid possible state.

To quote
https://www.gnu.org/software/automake/manual/html_node/Generalities-about-Testing.html

"""
Many testing environments and frameworks distinguish between test failures and hard errors. As we’ve seen, a test failure happens when some invariant or expected behaviour of the software under test is not met. A hard error happens when e.g., the set-up of a test case scenario fails, or when some other unexpected or highly undesirable condition is encountered (for example, the program under test experiences a segmentation fault).
"""

Signature · 1 line
Eli Schwartz
maintainer
#11 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

Quoted 7 lines · Eli Schwartz

T_EXIT_ERROR is different. It doesn't mean the test ran, and reported something wrong with the software (e.g. liburing). Instead, an ERROR return value indicates that the test itself broke and cannot even be relied on to accurately test for a bug/regression. For example, if that test was designated as an expected failure, it still knows that in this case, error != fail, and it won't ignore the result as an expected failure.

Quoted 6 lines

Also in general, if you see test errors you know to look at bugs in the testsuite instead of trying to debug the software. :)

I added T_EXIT_ERROR because it may be useful, without knowing in advance whether I would have cause to use it anywhere. It's a valid possible state.

I think we should kill that, it just causes confusion and I generally hate adding infrastructure that isn't even being used. Besides, I don't see it being useful at all. Yes, tests could eg return T_EXIT_ERROR if io_uring_get_sqe() return NULL and it should not have. In reality, that's just a test failure and you need to look into why that happened anyway.

As such, I don't think it's a useful distinction at all. Nobody is ever going to be writing tests and be making that distinction.

Signature · 1 line
Jens Axboe
#12 lore raw

Re: [PATCH liburing 3/4] tests: add tests for zerocopy send and notifications

From: Ammar Faizi <[email protected]>
Subject: [PATCH] helpers.h: Kill T_EXIT_ERROR because it's not used

This value is not used anywhere in liburing tests and we are not going to make a distinction between FAIL and ERROR. Kill it to avoid confusion in choosing them. Just always use T_EXIT_FAIL whenever we fail.

---

Quoted 2 lines · Jens Axboe

I think we should kill that, it just causes confusion and I generally hate adding infrastructure that isn't even being used.

The killing patch below...

 test/helpers.h | 1 -
 1 file changed, 1 deletion(-)
test/helpers.h +0 -1
index fbfd7d1..6d5726c 100644
@@ -20,7 +20,6 @@ enum t_test_result {
 	T_EXIT_PASS   = 0,
 	T_EXIT_FAIL   = 1,
 	T_EXIT_SKIP   = 77,
-	T_EXIT_ERROR  = 99,
 };
 
 /*

base-commit: 30a20795d7e4f300c606c6a2aa0a4c9492882d1d

Signature · 1 line
Ammar Faizi
#13 lore raw

PATCH 4/4 examples: add a zerocopy send example

In reply to Pavel Begunkov
---
 examples/Makefile        |   3 +-
 examples/send-zerocopy.c | 366 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 368 insertions(+), 1 deletion(-)
 create mode 100644 examples/send-zerocopy.c
examples/Makefile +2 -1
index 8e7067f..1997a31 100644
@@ -14,7 +14,8 @@ example_srcs := \
 	io_uring-cp.c \
 	io_uring-test.c \
 	link-cp.c \
-	poll-bench.c
+	poll-bench.c \
+	send-zerocopy.c
 
 all_targets :=
 
examples/send-zerocopy.c new file +366 -0

366 lines not on this page · raw message

Signature · 1 line
2.37.0