Skip to contentSkip to conversation

single-issuer and poll benchmark

PATCH Superseded Pavel Begunkov 2 participants 8 messages Jun 14, 2022 – Jun 15, 2022 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover single-issuer and poll benchmark

Add some tests to check the kernel enforcing single-issuer right, and add a simple poll benchmark, might be useful if we do poll changes.

Pavel Begunkov (3):
io_uring: update headers with IORING_SETUP_SINGLE_ISSUER
examples: add a simple single-shot poll benchmark
tests: test IORING_SETUP_SINGLE_ISSUER

 examples/Makefile               |   3 +-
 examples/poll-bench.c           | 108 ++++++++++++++++++++
 src/include/liburing/io_uring.h |   5 +-
 test/Makefile                   |   1 +
 test/single-issuer.c            | 173 ++++++++++++++++++++++++++++++++
 5 files changed, 288 insertions(+), 2 deletions(-)
 create mode 100644 examples/poll-bench.c
 create mode 100644 test/single-issuer.c
Signature · 1 line
2.36.1
#1 lore raw

PATCH 1/3 io_uring: update headers with IORING_SETUP_SINGLE_ISSUER

---
 src/include/liburing/io_uring.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/include/liburing/io_uring.h +4 -1
index 15d9fbd..ee6ccc9 100644
@@ -137,9 +137,12 @@ enum {
  * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
  */
 #define IORING_SETUP_TASKRUN_FLAG	(1U << 9)
-
 #define IORING_SETUP_SQE128		(1U << 10) /* SQEs are 128 byte */
 #define IORING_SETUP_CQE32		(1U << 11) /* CQEs are 32 byte */
+/*
+ * Only one task is allowed to submit requests
+ */
+#define IORING_SETUP_SINGLE_ISSUER	(1U << 12)
 
 enum io_uring_op {
 	IORING_OP_NOP,
Signature · 1 line
2.36.1
#4 lore raw

PATCH 2/3 examples: add a simple single-shot poll benchmark

In reply to Pavel Begunkov
---
 examples/Makefile     |   3 +-
 examples/poll-bench.c | 108 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 examples/poll-bench.c
examples/Makefile +2 -1
index 95a45f9..8e7067f 100644
@@ -13,7 +13,8 @@ endif
 example_srcs := \
 	io_uring-cp.c \
 	io_uring-test.c \
-	link-cp.c
+	link-cp.c \
+	poll-bench.c
 
 all_targets :=
 
examples/poll-bench.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.36.1
#7 lore raw

PATCH 3/3 tests: test IORING_SETUP_SINGLE_ISSUER

In reply to Pavel Begunkov
---
 test/Makefile        |   1 +
 test/single-issuer.c | 173 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 174 insertions(+)
 create mode 100644 test/single-issuer.c
test/Makefile +1 -0
index ab031e0..0750996 100644
@@ -169,6 +169,7 @@ test_srcs := \
 	wakeup-hang.c \
 	xattr.c \
 	skip-cqe.c \
+	single-issuer.c \
 	# EOL
 
 
test/single-issuer.c new file +173 -0

173 lines not on this page · raw message

Signature · 1 line
2.36.1
#5 lore raw

Re: [PATCH liburing 2/3] examples: add a simple single-shot poll benchmark

In reply to Pavel Begunkov

examples/poll-bench.c line 41

Quoted 13 lines · Pavel Begunkov
examples/poll-bench.c new file +13 -0
+int main(void)
+{
+	unsigned long tstop;
+	unsigned long nr_reqs = 0;
+	struct io_uring_cqe *cqe;
+	struct io_uring_sqe *sqe;
+	struct io_uring ring;
+	int pipe1[2];
+	int ret, i, qd = 128;
+
+	if (argc > 1)
+		return 0;
+

Hi Pavel,

I am testing this and it doesn't compile, the main(void) needs fixing.

```
  poll-bench.c: In function ‘main’:
  poll-bench.c:39:13: error: ‘argc’ undeclared (first use in this function)
     39 |         if (argc > 1)
        |             ^~~~
  poll-bench.c:39:13: note: each undeclared identifier is reported only once for each function it appears in
  make[1]: *** [Makefile:34: poll-bench] Error 1
  make[1]: *** Waiting for unfinished jobs....
  make[1]: Leaving directory '/home/ammarfaizi2/app/liburing/examples'
  make: *** [Makefile:12: all] Error 2
```
Signature · 1 line
Ammar Faizi
#6 lore raw

Re: [PATCH liburing 2/3] examples: add a simple single-shot poll benchmark

Quoted 17 lines · Ammar Faizi

examples/poll-bench.c line 41

Quoted 13 lines · Pavel Begunkov
examples/poll-bench.c new file +13 -0
+int main(void)
+{
+    unsigned long tstop;
+    unsigned long nr_reqs = 0;
+    struct io_uring_cqe *cqe;
+    struct io_uring_sqe *sqe;
+    struct io_uring ring;
+    int pipe1[2];
+    int ret, i, qd = 128;
+
+    if (argc > 1)
+        return 0;
+

Hi Pavel,

Quoted 1 line

I am testing this and it doesn't compile, the main(void) needs fixing.

Indeed, some of final changes escaped git add. Thanks Ammar

Quoted 13 lines
```
   poll-bench.c: In function ‘main’:
   poll-bench.c:39:13: error: ‘argc’ undeclared (first use in this function)
      39 |         if (argc > 1)
         |             ^~~~
   poll-bench.c:39:13: note: each undeclared identifier is reported only once for each function it appears in
   make[1]: *** [Makefile:34: poll-bench] Error 1
   make[1]: *** Waiting for unfinished jobs....
   make[1]: Leaving directory '/home/ammarfaizi2/app/liburing/examples'
   make: *** [Makefile:12: all] Error 2
```
Signature · 1 line
Pavel Begunkov
#2 lore raw

Re: [PATCH liburing 1/3] io_uring: update headers with IORING_SETUP_SINGLE_ISSUER

In reply to Pavel Begunkov
Quoted 1 line · Pavel Begunkov

Something did go wrong here... just ignore it,
the v2 sent yesterday is up to date.

Quoted 22 lines
---
  src/include/liburing/io_uring.h | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
src/include/liburing/io_uring.h +4 -1
index 15d9fbd..ee6ccc9 100644
@@ -137,9 +137,12 @@ enum {
   * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
   */
  #define IORING_SETUP_TASKRUN_FLAG	(1U << 9)
-
  #define IORING_SETUP_SQE128		(1U << 10) /* SQEs are 128 byte */
  #define IORING_SETUP_CQE32		(1U << 11) /* CQEs are 32 byte */
+/*
+ * Only one task is allowed to submit requests
+ */
+#define IORING_SETUP_SINGLE_ISSUER	(1U << 12)
 
  enum io_uring_op {
  	IORING_OP_NOP,
Signature · 1 line
Pavel Begunkov
#3 lore raw

Re: [PATCH liburing 1/3] io_uring: update headers with IORING_SETUP_SINGLE_ISSUER

Quoted 5 lines · Pavel Begunkov
Quoted 1 line · Pavel Begunkov

Something did go wrong here... just ignore it,
the v2 sent yesterday is up to date.

That goes to the whole series
(missing the cover-letter in the mailbox)

Quoted 23 lines
Quoted 22 lines

---
  src/include/liburing/io_uring.h | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
src/include/liburing/io_uring.h +4 -1
index 15d9fbd..ee6ccc9 100644
@@ -137,9 +137,12 @@ enum {
    * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
    */
   #define IORING_SETUP_TASKRUN_FLAG    (1U << 9)
-
   #define IORING_SETUP_SQE128        (1U << 10) /* SQEs are 128 byte */
   #define IORING_SETUP_CQE32        (1U << 11) /* CQEs are 32 byte */
+/*
+ * Only one task is allowed to submit requests
+ */
+#define IORING_SETUP_SINGLE_ISSUER    (1U << 12)
   enum io_uring_op {
       IORING_OP_NOP,
Signature · 1 line
Pavel Begunkov