public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: net: fix bug of completing multishot accept twice
@ 2022-06-17 14:12 Hao Xu
  2022-06-17 14:23 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Hao Xu @ 2022-06-17 14:12 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, Pavel Begunkov

From: Hao Xu <[email protected]>

Now that we use centralized completion in io_issue_sqe, we should skip
that for multishot accept requests since we complete them in the
specific op function.

Fixes: 34106529422e ("io_uring: never defer-complete multi-apoll")
Signed-off-by: Hao Xu <[email protected]>
---

I retrieved the history:

in 4e86a2c98013 ("io_uring: implement multishot mode for accept")
we add the multishot accept, it repeatly completes cqe in io_accept()
until get -EAGAIN [1], then it returns 0 to io_issue_sqe().
io_issue_sqe() does nothing to it then.

in 09eaa49e078c ("io_uring: handle completions in the core")
we add __io_req_complete() for IOU_OK in io_issue_sqe(). This causes at
[1], we do call __io_req_complete().But since IO_URING_F_COMPLETE_DEFER
is set, it does nothing.

in 34106529422e ("io_uring: never defer-complete multi-apoll")
we remove IO_URING_F_COMPLETE_DEFER, but unluckily the multishot accept
test is broken, we didn't find the error.

So it just has infuence to for-5.20, I'll update the liburing test
today.

 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/net.c b/io_uring/net.c
index 207803758222..5097df5b2c46 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -630,7 +630,7 @@ int io_accept(struct io_kiocb *req, unsigned int issue_flags)
 			 */
 			if ((req->flags & IO_APOLL_MULTI_POLLED) ==
 			    IO_APOLL_MULTI_POLLED)
-				ret = 0;
+				ret = IOU_ISSUE_SKIP_COMPLETE;
 			return ret;
 		}
 		if (ret == -ERESTARTSYS)

base-commit: 0efaf0d19e9e1271f2275393e62f709907cd40e2
-- 
2.25.1


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

* Re: [PATCH] io_uring: net: fix bug of completing multishot accept twice
  2022-06-17 14:12 [PATCH] io_uring: net: fix bug of completing multishot accept twice Hao Xu
@ 2022-06-17 14:23 ` Jens Axboe
  2022-06-17 14:34   ` Hao Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2022-06-17 14:23 UTC (permalink / raw)
  To: Hao Xu, io-uring; +Cc: Pavel Begunkov

On 6/17/22 8:12 AM, Hao Xu wrote:
> From: Hao Xu <[email protected]>
> 
> Now that we use centralized completion in io_issue_sqe, we should skip
> that for multishot accept requests since we complete them in the
> specific op function.
> 
> Fixes: 34106529422e ("io_uring: never defer-complete multi-apoll")
> Signed-off-by: Hao Xu <[email protected]>
> ---
> 
> I retrieved the history:
> 
> in 4e86a2c98013 ("io_uring: implement multishot mode for accept")
> we add the multishot accept, it repeatly completes cqe in io_accept()
> until get -EAGAIN [1], then it returns 0 to io_issue_sqe().
> io_issue_sqe() does nothing to it then.
> 
> in 09eaa49e078c ("io_uring: handle completions in the core")
> we add __io_req_complete() for IOU_OK in io_issue_sqe(). This causes at
> [1], we do call __io_req_complete().But since IO_URING_F_COMPLETE_DEFER
> is set, it does nothing.
> 
> in 34106529422e ("io_uring: never defer-complete multi-apoll")
> we remove IO_URING_F_COMPLETE_DEFER, but unluckily the multishot accept
> test is broken, we didn't find the error.
> 
> So it just has infuence to for-5.20, I'll update the liburing test
> today.

Do you mind if I fold this into:

09eaa49e078c ("io_uring: handle completions in the core")

as I'm continually rebasing the 5.20 branch until 5.19 is fully sorted?

-- 
Jens Axboe


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

* Re: [PATCH] io_uring: net: fix bug of completing multishot accept twice
  2022-06-17 14:23 ` Jens Axboe
@ 2022-06-17 14:34   ` Hao Xu
  2022-06-17 14:34     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Hao Xu @ 2022-06-17 14:34 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Pavel Begunkov

On 6/17/22 22:23, Jens Axboe wrote:
> On 6/17/22 8:12 AM, Hao Xu wrote:
>> From: Hao Xu <[email protected]>
>>
>> Now that we use centralized completion in io_issue_sqe, we should skip
>> that for multishot accept requests since we complete them in the
>> specific op function.
>>
>> Fixes: 34106529422e ("io_uring: never defer-complete multi-apoll")
>> Signed-off-by: Hao Xu <[email protected]>
>> ---
>>
>> I retrieved the history:
>>
>> in 4e86a2c98013 ("io_uring: implement multishot mode for accept")
>> we add the multishot accept, it repeatly completes cqe in io_accept()
>> until get -EAGAIN [1], then it returns 0 to io_issue_sqe().
>> io_issue_sqe() does nothing to it then.
>>
>> in 09eaa49e078c ("io_uring: handle completions in the core")
>> we add __io_req_complete() for IOU_OK in io_issue_sqe(). This causes at
>> [1], we do call __io_req_complete().But since IO_URING_F_COMPLETE_DEFER
>> is set, it does nothing.
>>
>> in 34106529422e ("io_uring: never defer-complete multi-apoll")
>> we remove IO_URING_F_COMPLETE_DEFER, but unluckily the multishot accept
>> test is broken, we didn't find the error.
>>
>> So it just has infuence to for-5.20, I'll update the liburing test
>> today.
> 
> Do you mind if I fold this into:
> 
> 09eaa49e078c ("io_uring: handle completions in the core")
> 
> as I'm continually rebasing the 5.20 branch until 5.19 is fully sorted?
> 

Please do, that is better.


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

* Re: [PATCH] io_uring: net: fix bug of completing multishot accept twice
  2022-06-17 14:34   ` Hao Xu
@ 2022-06-17 14:34     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-06-17 14:34 UTC (permalink / raw)
  To: Hao Xu, io-uring; +Cc: Pavel Begunkov

On 6/17/22 8:34 AM, Hao Xu wrote:
> On 6/17/22 22:23, Jens Axboe wrote:
>> On 6/17/22 8:12 AM, Hao Xu wrote:
>>> From: Hao Xu <[email protected]>
>>>
>>> Now that we use centralized completion in io_issue_sqe, we should skip
>>> that for multishot accept requests since we complete them in the
>>> specific op function.
>>>
>>> Fixes: 34106529422e ("io_uring: never defer-complete multi-apoll")
>>> Signed-off-by: Hao Xu <[email protected]>
>>> ---
>>>
>>> I retrieved the history:
>>>
>>> in 4e86a2c98013 ("io_uring: implement multishot mode for accept")
>>> we add the multishot accept, it repeatly completes cqe in io_accept()
>>> until get -EAGAIN [1], then it returns 0 to io_issue_sqe().
>>> io_issue_sqe() does nothing to it then.
>>>
>>> in 09eaa49e078c ("io_uring: handle completions in the core")
>>> we add __io_req_complete() for IOU_OK in io_issue_sqe(). This causes at
>>> [1], we do call __io_req_complete().But since IO_URING_F_COMPLETE_DEFER
>>> is set, it does nothing.
>>>
>>> in 34106529422e ("io_uring: never defer-complete multi-apoll")
>>> we remove IO_URING_F_COMPLETE_DEFER, but unluckily the multishot accept
>>> test is broken, we didn't find the error.
>>>
>>> So it just has infuence to for-5.20, I'll update the liburing test
>>> today.
>>
>> Do you mind if I fold this into:
>>
>> 09eaa49e078c ("io_uring: handle completions in the core")
>>
>> as I'm continually rebasing the 5.20 branch until 5.19 is fully sorted?
>>
> 
> Please do, that is better.

Done, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2022-06-17 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17 14:12 [PATCH] io_uring: net: fix bug of completing multishot accept twice Hao Xu
2022-06-17 14:23 ` Jens Axboe
2022-06-17 14:34   ` Hao Xu
2022-06-17 14:34     ` Jens Axboe

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