public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing v2 0/3] 6.0 updates
@ 2022-09-27 10:21 Dylan Yudaken
  2022-09-27 10:22 ` [PATCH liburing v2 1/3] handle single issuer task registration at ring creation Dylan Yudaken
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dylan Yudaken @ 2022-09-27 10:21 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken

liburing updates for 6.0:

Patch 1 updates to account for the single issuer ring being assigned at
ring creation time.
Patch 2 updates man pages from 5.20 -> 6.0
Patch 3 reduces test flakiness

v2:
 - handle IORING_SETUP_R_DISABLED semantics
 - fix unique path in open-direct-pick test 

Dylan Yudaken (3):
  handle single issuer task registration at ring creation
  update documentation to reflect no 5.20 kernel
  give open-direct-pick.c a unique path

 man/io_uring_prep_recv.3    |  2 +-
 man/io_uring_prep_recvmsg.3 |  2 +-
 man/io_uring_setup.2        | 18 +++++++++---------
 test/defer-taskrun.c        |  8 ++++++--
 test/open-direct-pick.c     |  2 +-
 test/single-issuer.c        | 34 ++++++++++++++++++++++++++--------
 6 files changed, 44 insertions(+), 22 deletions(-)


base-commit: 1cba5d6c9e41e2f55ac4c3f93f5e05f9b5082a3e
-- 
2.30.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH liburing v2 1/3] handle single issuer task registration at ring creation
  2022-09-27 10:21 [PATCH liburing v2 0/3] 6.0 updates Dylan Yudaken
@ 2022-09-27 10:22 ` Dylan Yudaken
  2022-09-27 10:22 ` [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel Dylan Yudaken
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Dylan Yudaken @ 2022-09-27 10:22 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken

IORING_SETUP_SINGLE_ISSUER now registers the task at ring creation, so
update the tests and documentation to reflect this.

Signed-off-by: Dylan Yudaken <[email protected]>
---
 man/io_uring_setup.2 | 18 +++++++++---------
 test/defer-taskrun.c |  8 ++++++--
 test/single-issuer.c | 34 ++++++++++++++++++++++++++--------
 3 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/man/io_uring_setup.2 b/man/io_uring_setup.2
index fb1f90dc2ebc..502a803d2308 100644
--- a/man/io_uring_setup.2
+++ b/man/io_uring_setup.2
@@ -241,22 +241,22 @@ only the
 passthrough command for NVMe passthrough needs this. Available since 5.19.
 .TP
 .B IORING_SETUP_SINGLE_ISSUER
-A hint to the kernel that only a single task can submit requests, which is used
-for internal optimisations. The kernel enforces the rule, which only affects
-.I
-io_uring_enter(2)
-calls submitting requests and will fail them with
+A hint to the kernel that only a single task (or thread) will submit requests, which is
+used for internal optimisations. The submission task is either the task that created the
+ring, or if
+.B IORING_SETUP_R_DISABLED
+is specified then it is the task that enables the ring through
+.BR io_uring_register (2) .
+The kernel enforces this rule, failing requests with
 .B -EEXIST
 if the restriction is violated.
-The submitter task may differ from the task that created the ring.
 Note that when
 .B IORING_SETUP_SQPOLL
 is set it is considered that the polling task is doing all submissions
 on behalf of the userspace and so it always complies with the rule disregarding
 how many userspace tasks do
-.I
-io_uring_enter(2).
-Available since 5.20.
+.BR io_uring_enter(2).
+Available since 6.0.
 .TP
 .B IORING_SETUP_DEFER_TASKRUN
 By default, io_uring will process all outstanding work at the end of any system
diff --git a/test/defer-taskrun.c b/test/defer-taskrun.c
index c6e0ea0d6c99..9283f2866c6b 100644
--- a/test/defer-taskrun.c
+++ b/test/defer-taskrun.c
@@ -123,6 +123,7 @@ void *thread(void *t)
 {
 	struct thread_data *td = t;
 
+	io_uring_enable_rings(&td->ring);
 	io_uring_prep_read(io_uring_get_sqe(&td->ring), td->efd, td->buff, sizeof(td->buff), 0);
 	io_uring_submit(&td->ring);
 
@@ -138,11 +139,12 @@ static int test_thread_shutdown(void)
 	uint64_t val = 1;
 
 	ret = io_uring_queue_init(8, &td.ring, IORING_SETUP_SINGLE_ISSUER |
-					       IORING_SETUP_DEFER_TASKRUN);
+					       IORING_SETUP_DEFER_TASKRUN |
+					       IORING_SETUP_R_DISABLED);
 	if (ret)
 		return ret;
 
-	CHECK(io_uring_get_events(&td.ring) == -EEXIST);
+	CHECK(io_uring_get_events(&td.ring) == -EBADFD);
 
 	td.efd = eventfd(0, 0);
 	CHECK(td.efd >= 0);
@@ -150,6 +152,8 @@ static int test_thread_shutdown(void)
 	CHECK(pthread_create(&t1, NULL, thread, &td) == 0);
 	CHECK(pthread_join(t1, NULL) == 0);
 
+	CHECK(io_uring_get_events(&td.ring) == -EEXIST);
+
 	CHECK(write(td.efd, &val, sizeof(val)) == sizeof(val));
 	CHECK(io_uring_wait_cqe(&td.ring, &cqe) == -EEXIST);
 
diff --git a/test/single-issuer.c b/test/single-issuer.c
index 29830f1af998..1d13f47202f8 100644
--- a/test/single-issuer.c
+++ b/test/single-issuer.c
@@ -96,30 +96,48 @@ int main(int argc, char *argv[])
 	if (!fork_t()) {
 		ret = try_submit(&ring);
 		if (ret != -EEXIST)
-			fprintf(stderr, "not owner child could submit %i\n", ret);
+			fprintf(stderr, "1: not owner child could submit %i\n", ret);
 		return ret != -EEXIST;
 	}
 	wait_child_t();
 	io_uring_queue_exit(&ring);
 
 	/* test that the first submitter but not creator can submit */
-	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER);
+	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
+					    IORING_SETUP_R_DISABLED);
 	if (ret)
 		error(1, ret, "ring init (2) %i", ret);
 
 	if (!fork_t()) {
+		io_uring_enable_rings(&ring);
 		ret = try_submit(&ring);
 		if (ret)
-			fprintf(stderr, "not owner child could submit %i\n", ret);
+			fprintf(stderr, "2: not owner child could submit %i\n", ret);
 		return !!ret;
 	}
 	wait_child_t();
 	io_uring_queue_exit(&ring);
 
+	/* test that only the first enabler can submit */
+	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
+					    IORING_SETUP_R_DISABLED);
+	if (ret)
+		error(1, ret, "ring init (3) %i", ret);
+
+	io_uring_enable_rings(&ring);
+	if (!fork_t()) {
+		ret = try_submit(&ring);
+		if (ret != -EEXIST)
+			fprintf(stderr, "3: not owner child could submit %i\n", ret);
+		return ret != -EEXIST;
+	}
+	wait_child_t();
+	io_uring_queue_exit(&ring);
+
 	/* test that anyone can submit to a SQPOLL|SINGLE_ISSUER ring */
 	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_SQPOLL);
 	if (ret)
-		error(1, ret, "ring init (3) %i", ret);
+		error(1, ret, "ring init (4) %i", ret);
 
 	ret = try_submit(&ring);
 	if (ret) {
@@ -139,13 +157,13 @@ int main(int argc, char *argv[])
 	/* test that IORING_ENTER_REGISTERED_RING doesn't break anything */
 	ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER);
 	if (ret)
-		error(1, ret, "ring init (4) %i", ret);
+		error(1, ret, "ring init (5) %i", ret);
 
 	if (!fork_t()) {
 		ret = try_submit(&ring);
-		if (ret)
-			fprintf(stderr, "not owner child could submit %i\n", ret);
-		return !!ret;
+		if (ret != -EEXIST)
+			fprintf(stderr, "4: not owner child could submit %i\n", ret);
+		return ret != -EEXIST;
 	}
 	wait_child_t();
 	io_uring_queue_exit(&ring);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel
  2022-09-27 10:21 [PATCH liburing v2 0/3] 6.0 updates Dylan Yudaken
  2022-09-27 10:22 ` [PATCH liburing v2 1/3] handle single issuer task registration at ring creation Dylan Yudaken
@ 2022-09-27 10:22 ` Dylan Yudaken
  2022-09-27 11:02   ` Ammar Faizi
  2022-09-27 10:22 ` [PATCH liburing v2 3/3] give open-direct-pick.c a unique path Dylan Yudaken
  2022-09-27 14:15 ` [PATCH liburing v2 0/3] 6.0 updates Jens Axboe
  3 siblings, 1 reply; 7+ messages in thread
From: Dylan Yudaken @ 2022-09-27 10:22 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken

The documentation referenced the wrong kernel version.

Signed-off-by: Dylan Yudaken <[email protected]>
---
 man/io_uring_prep_recv.3    | 2 +-
 man/io_uring_prep_recvmsg.3 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/man/io_uring_prep_recv.3 b/man/io_uring_prep_recv.3
index 60a77fc241b5..b3862369affa 100644
--- a/man/io_uring_prep_recv.3
+++ b/man/io_uring_prep_recv.3
@@ -55,7 +55,7 @@ If a posted CQE does not have the
 .B IORING_CQE_F_MORE
 flag set then the multishot receive will be done and the application should issue a
 new request.
-Multishot variants are available since kernel 5.20.
+Multishot variants are available since kernel 6.0.
 
 
 After calling this function, additional io_uring internal modifier flags
diff --git a/man/io_uring_prep_recvmsg.3 b/man/io_uring_prep_recvmsg.3
index 07096ee4826c..65f324dfef9b 100644
--- a/man/io_uring_prep_recvmsg.3
+++ b/man/io_uring_prep_recvmsg.3
@@ -65,7 +65,7 @@ submitted with the request. See
 .B io_uring_recvmsg_out (3)
 for more information on accessing the data.
 
-Multishot variants are available since kernel 5.20.
+Multishot variants are available since kernel 6.0.
 
 After calling this function, additional io_uring internal modifier flags
 may be set in the SQE
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH liburing v2 3/3] give open-direct-pick.c a unique path
  2022-09-27 10:21 [PATCH liburing v2 0/3] 6.0 updates Dylan Yudaken
  2022-09-27 10:22 ` [PATCH liburing v2 1/3] handle single issuer task registration at ring creation Dylan Yudaken
  2022-09-27 10:22 ` [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel Dylan Yudaken
@ 2022-09-27 10:22 ` Dylan Yudaken
  2022-09-27 11:00   ` Ammar Faizi
  2022-09-27 14:15 ` [PATCH liburing v2 0/3] 6.0 updates Jens Axboe
  3 siblings, 1 reply; 7+ messages in thread
From: Dylan Yudaken @ 2022-09-27 10:22 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken

This was making make runtest-parallel flaky

Signed-off-by: Dylan Yudaken <[email protected]>
---
 test/open-direct-pick.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/open-direct-pick.c b/test/open-direct-pick.c
index b1597e73231e..a1edf8464dc8 100644
--- a/test/open-direct-pick.c
+++ b/test/open-direct-pick.c
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
 		return 0;
 	}
 
-	path = "/tmp/.open.close";
+	path = "/tmp/.open.direct.pick";
 	t_create_file(path, 4096);
 
 	ret = test_openat(&ring, path);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH liburing v2 3/3] give open-direct-pick.c a unique path
  2022-09-27 10:22 ` [PATCH liburing v2 3/3] give open-direct-pick.c a unique path Dylan Yudaken
@ 2022-09-27 11:00   ` Ammar Faizi
  0 siblings, 0 replies; 7+ messages in thread
From: Ammar Faizi @ 2022-09-27 11:00 UTC (permalink / raw)
  To: Dylan Yudaken
  Cc: Facebook Kernel Team, io-uring Mailing List, Jens Axboe,
	Pavel Begunkov

On 9/27/22 5:22 PM, Dylan Yudaken wrote:
> This was making make runtest-parallel flaky
> 
> Signed-off-by: Dylan Yudaken<[email protected]>
> ---
>   test/open-direct-pick.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Yeah, it clashes with test/open-close.c's.

Reviewed-by: Ammar Faizi <[email protected]>

-- 
Ammar Faizi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel
  2022-09-27 10:22 ` [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel Dylan Yudaken
@ 2022-09-27 11:02   ` Ammar Faizi
  0 siblings, 0 replies; 7+ messages in thread
From: Ammar Faizi @ 2022-09-27 11:02 UTC (permalink / raw)
  To: Dylan Yudaken
  Cc: Facebook Kernel Team, Jens Axboe, Pavel Begunkov,
	io-uring Mailing List

On 9/27/22 5:22 PM, Dylan Yudaken wrote:
> The documentation referenced the wrong kernel version.
> 
> Signed-off-by: Dylan Yudaken <[email protected]>

Reviewed-by: Ammar Faizi <[email protected]>

-- 
Ammar Faizi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH liburing v2 0/3] 6.0 updates
  2022-09-27 10:21 [PATCH liburing v2 0/3] 6.0 updates Dylan Yudaken
                   ` (2 preceding siblings ...)
  2022-09-27 10:22 ` [PATCH liburing v2 3/3] give open-direct-pick.c a unique path Dylan Yudaken
@ 2022-09-27 14:15 ` Jens Axboe
  3 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2022-09-27 14:15 UTC (permalink / raw)
  To: Dylan Yudaken, Pavel Begunkov; +Cc: io-uring, kernel-team

On Tue, 27 Sep 2022 03:21:59 -0700, Dylan Yudaken wrote:
> liburing updates for 6.0:
> 
> Patch 1 updates to account for the single issuer ring being assigned at
> ring creation time.
> Patch 2 updates man pages from 5.20 -> 6.0
> Patch 3 reduces test flakiness
> 
> [...]

Applied, thanks!

[1/3] handle single issuer task registration at ring creation
      commit: f37012787e5cde63fb30ae92c9ac25153298dc5b
[2/3] update documentation to reflect no 5.20 kernel
      commit: b08210967b53c339a1cb983e176e8b53b5c8e0db
[3/3] give open-direct-pick.c a unique path
      commit: eb90f4229c0526bace370175eeec1329bf72311b

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-27 14:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 10:21 [PATCH liburing v2 0/3] 6.0 updates Dylan Yudaken
2022-09-27 10:22 ` [PATCH liburing v2 1/3] handle single issuer task registration at ring creation Dylan Yudaken
2022-09-27 10:22 ` [PATCH liburing v2 2/3] update documentation to reflect no 5.20 kernel Dylan Yudaken
2022-09-27 11:02   ` Ammar Faizi
2022-09-27 10:22 ` [PATCH liburing v2 3/3] give open-direct-pick.c a unique path Dylan Yudaken
2022-09-27 11:00   ` Ammar Faizi
2022-09-27 14:15 ` [PATCH liburing v2 0/3] 6.0 updates Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox