public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-next 0/2] net fixes
@ 2022-09-29 21:23 Pavel Begunkov
  2022-09-29 21:23 ` [PATCH for-next 1/2] io_uring/net: don't update msg_name if not provided Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pavel Begunkov @ 2022-09-29 21:23 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

two extra io_uring/net fixes

Pavel Begunkov (2):
  io_uring/net: don't update msg_name if not provided
  io_uring/net: fix notif cqe reordering

 io_uring/net.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

-- 
2.37.2


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

* [PATCH for-next 1/2] io_uring/net: don't update msg_name if not provided
  2022-09-29 21:23 [PATCH for-next 0/2] net fixes Pavel Begunkov
@ 2022-09-29 21:23 ` Pavel Begunkov
  2022-09-29 21:23 ` [PATCH for-next 2/2] io_uring/net: fix notif cqe reordering Pavel Begunkov
  2022-09-29 23:47 ` [PATCH for-next 0/2] net fixes Jens Axboe
  2 siblings, 0 replies; 7+ messages in thread
From: Pavel Begunkov @ 2022-09-29 21:23 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't
provide it, we should retain NULL in this case.

Cc: [email protected]
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 9ada9da02d04..604eac5f7a34 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -164,7 +164,8 @@ static int io_setup_async_msg(struct io_kiocb *req,
 	}
 	req->flags |= REQ_F_NEED_CLEANUP;
 	memcpy(async_msg, kmsg, sizeof(*kmsg));
-	async_msg->msg.msg_name = &async_msg->addr;
+	if (async_msg->msg.msg_name)
+		async_msg->msg.msg_name = &async_msg->addr;
 	/* if were using fast_iov, set it to the new one */
 	if (!kmsg->free_iov) {
 		size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov;
-- 
2.37.2


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

* [PATCH for-next 2/2] io_uring/net: fix notif cqe reordering
  2022-09-29 21:23 [PATCH for-next 0/2] net fixes Pavel Begunkov
  2022-09-29 21:23 ` [PATCH for-next 1/2] io_uring/net: don't update msg_name if not provided Pavel Begunkov
@ 2022-09-29 21:23 ` Pavel Begunkov
  2022-09-29 23:47 ` [PATCH for-next 0/2] net fixes Jens Axboe
  2 siblings, 0 replies; 7+ messages in thread
From: Pavel Begunkov @ 2022-09-29 21:23 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

send zc is not restricted to !IO_URING_F_UNLOCKED anymore and so
we can't use task-tw ordering trick to order notification cqes
with requests completions. In this case leave it alone and let
io_send_zc_cleanup() flush it.

Cc: [email protected]
Fixes: 53bdc88aac9a2 ("io_uring/notif: order notif vs send CQEs")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/net.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 604eac5f7a34..caa6a803cb72 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1127,8 +1127,14 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
 	else if (zc->done_io)
 		ret = zc->done_io;
 
-	io_notif_flush(zc->notif);
-	req->flags &= ~REQ_F_NEED_CLEANUP;
+	/*
+	 * If we're in io-wq we can't rely on tw ordering guarantees, defer
+	 * flushing notif to io_send_zc_cleanup()
+	 */
+	if (!(issue_flags & IO_URING_F_UNLOCKED)) {
+		io_notif_flush(zc->notif);
+		req->flags &= ~REQ_F_NEED_CLEANUP;
+	}
 	io_req_set_res(req, ret, IORING_CQE_F_MORE);
 	return IOU_OK;
 }
@@ -1182,8 +1188,10 @@ int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
 		req_set_fail(req);
 	}
 	/* fast path, check for non-NULL to avoid function call */
-	if (kmsg->free_iov)
+	if (kmsg->free_iov) {
 		kfree(kmsg->free_iov);
+		kmsg->free_iov = NULL;
+	}
 
 	io_netmsg_recycle(req, issue_flags);
 	if (ret >= 0)
@@ -1191,8 +1199,14 @@ int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
 	else if (sr->done_io)
 		ret = sr->done_io;
 
-	io_notif_flush(sr->notif);
-	req->flags &= ~REQ_F_NEED_CLEANUP;
+	/*
+	 * If we're in io-wq we can't rely on tw ordering guarantees, defer
+	 * flushing notif to io_send_zc_cleanup()
+	 */
+	if (!(issue_flags & IO_URING_F_UNLOCKED)) {
+		io_notif_flush(sr->notif);
+		req->flags &= ~REQ_F_NEED_CLEANUP;
+	}
 	io_req_set_res(req, ret, IORING_CQE_F_MORE);
 	return IOU_OK;
 }
-- 
2.37.2


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

* Re: [PATCH for-next 0/2] net fixes
  2022-09-29 21:23 [PATCH for-next 0/2] net fixes Pavel Begunkov
  2022-09-29 21:23 ` [PATCH for-next 1/2] io_uring/net: don't update msg_name if not provided Pavel Begunkov
  2022-09-29 21:23 ` [PATCH for-next 2/2] io_uring/net: fix notif cqe reordering Pavel Begunkov
@ 2022-09-29 23:47 ` Jens Axboe
  2022-10-06 20:30   ` Pavel Begunkov
  2 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2022-09-29 23:47 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov

On Thu, 29 Sep 2022 22:23:17 +0100, Pavel Begunkov wrote:
> two extra io_uring/net fixes
> 
> Pavel Begunkov (2):
>   io_uring/net: don't update msg_name if not provided
>   io_uring/net: fix notif cqe reordering
> 
> io_uring/net.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> [...]

Applied, thanks!

[1/2] io_uring/net: don't update msg_name if not provided
      commit: 6f10ae8a155446248055c7ddd480ef40139af788
[2/2] io_uring/net: fix notif cqe reordering
      commit: 108893ddcc4d3aa0a4a02aeb02d478e997001227

Best regards,
-- 
Jens Axboe



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

* Re: [PATCH for-next 0/2] net fixes
  2022-09-29 23:47 ` [PATCH for-next 0/2] net fixes Jens Axboe
@ 2022-10-06 20:30   ` Pavel Begunkov
  2022-10-06 20:46     ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Begunkov @ 2022-10-06 20:30 UTC (permalink / raw)
  To: Jens Axboe, io-uring

On 9/30/22 00:47, Jens Axboe wrote:
> On Thu, 29 Sep 2022 22:23:17 +0100, Pavel Begunkov wrote:
>> two extra io_uring/net fixes
>>
>> Pavel Begunkov (2):
>>    io_uring/net: don't update msg_name if not provided
>>    io_uring/net: fix notif cqe reordering
>>
>> io_uring/net.c | 27 +++++++++++++++++++++------
>>   1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> [...]
> 
> Applied, thanks!

Hmm, where did these go? Don't see neither in for-6.1
nor 6.1-late


> [1/2] io_uring/net: don't update msg_name if not provided
>        commit: 6f10ae8a155446248055c7ddd480ef40139af788
> [2/2] io_uring/net: fix notif cqe reordering
>        commit: 108893ddcc4d3aa0a4a02aeb02d478e997001227
> 
> Best regards,

-- 
Pavel Begunkov

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

* Re: [PATCH for-next 0/2] net fixes
  2022-10-06 20:30   ` Pavel Begunkov
@ 2022-10-06 20:46     ` Jens Axboe
  2022-10-06 20:54       ` Pavel Begunkov
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2022-10-06 20:46 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 10/6/22 2:30 PM, Pavel Begunkov wrote:
> On 9/30/22 00:47, Jens Axboe wrote:
>> On Thu, 29 Sep 2022 22:23:17 +0100, Pavel Begunkov wrote:
>>> two extra io_uring/net fixes
>>>
>>> Pavel Begunkov (2):
>>>    io_uring/net: don't update msg_name if not provided
>>>    io_uring/net: fix notif cqe reordering
>>>
>>> io_uring/net.c | 27 +++++++++++++++++++++------
>>>   1 file changed, 21 insertions(+), 6 deletions(-)
>>>
>>> [...]
>>
>> Applied, thanks!
> 
> Hmm, where did these go? Don't see neither in for-6.1
> nor 6.1-late

They are in for-6.1/io_uring with the shas listed here too:

>> [1/2] io_uring/net: don't update msg_name if not provided
>>        commit: 6f10ae8a155446248055c7ddd480ef40139af788
>> [2/2] io_uring/net: fix notif cqe reordering
>>        commit: 108893ddcc4d3aa0a4a02aeb02d478e997001227

Top of tree, in fact:

https://git.kernel.dk/cgit/linux-block/log/?h=for-6.1/io_uring

-- 
Jens Axboe



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

* Re: [PATCH for-next 0/2] net fixes
  2022-10-06 20:46     ` Jens Axboe
@ 2022-10-06 20:54       ` Pavel Begunkov
  0 siblings, 0 replies; 7+ messages in thread
From: Pavel Begunkov @ 2022-10-06 20:54 UTC (permalink / raw)
  To: Jens Axboe, io-uring

On 10/6/22 21:46, Jens Axboe wrote:
> On 10/6/22 2:30 PM, Pavel Begunkov wrote:
>> On 9/30/22 00:47, Jens Axboe wrote:
>>> On Thu, 29 Sep 2022 22:23:17 +0100, Pavel Begunkov wrote:
>>>> two extra io_uring/net fixes
>>>>
>>>> Pavel Begunkov (2):
>>>>     io_uring/net: don't update msg_name if not provided
>>>>     io_uring/net: fix notif cqe reordering
>>>>
>>>> io_uring/net.c | 27 +++++++++++++++++++++------
>>>>    1 file changed, 21 insertions(+), 6 deletions(-)
>>>>
>>>> [...]
>>>
>>> Applied, thanks!
>>
>> Hmm, where did these go? Don't see neither in for-6.1
>> nor 6.1-late
> 
> They are in for-6.1/io_uring with the shas listed here too:
> 
>>> [1/2] io_uring/net: don't update msg_name if not provided
>>>         commit: 6f10ae8a155446248055c7ddd480ef40139af788
>>> [2/2] io_uring/net: fix notif cqe reordering
>>>         commit: 108893ddcc4d3aa0a4a02aeb02d478e997001227
> 
> Top of tree, in fact:
> 
> https://git.kernel.dk/cgit/linux-block/log/?h=for-6.1/io_uring

See now, thanks, seems messed up pulling branches

-- 
Pavel Begunkov

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

end of thread, other threads:[~2022-10-06 20:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-29 21:23 [PATCH for-next 0/2] net fixes Pavel Begunkov
2022-09-29 21:23 ` [PATCH for-next 1/2] io_uring/net: don't update msg_name if not provided Pavel Begunkov
2022-09-29 21:23 ` [PATCH for-next 2/2] io_uring/net: fix notif cqe reordering Pavel Begunkov
2022-09-29 23:47 ` [PATCH for-next 0/2] net fixes Jens Axboe
2022-10-06 20:30   ` Pavel Begunkov
2022-10-06 20:46     ` Jens Axboe
2022-10-06 20:54       ` Pavel Begunkov

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