* fixup for "io_uring: allocate io_kiocb upfront"
@ 2019-11-07 3:20 Jens Axboe
2019-11-07 9:24 ` Pavel Begunkov
0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2019-11-07 3:20 UTC (permalink / raw)
To: io-uring; +Cc: Pavel Begunkov (Silence)
Pavel,
I didn't read this one closely enough for the latest change, we
can't just return -EAGAIN if we don't submit anything, we have to
explicitly do it for just the failure case of not getting a request.
I'm going to fold in this incremental:
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 951fd09612ec..af8a673c618f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2978,8 +2978,11 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
unsigned int sqe_flags;
req = io_get_req(ctx, statep);
- if (unlikely(!req))
+ if (unlikely(!req)) {
+ if (!submitted)
+ submitted = -EAGAIN;
break;
+ }
if (!io_get_sqring(ctx, &req->submit)) {
__io_free_req(req);
break;
@@ -4316,8 +4319,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
cur_mm = ctx->sqo_mm;
submitted = io_submit_sqes(ctx, to_submit, f.file, fd,
&cur_mm, false);
- if (!submitted)
- submitted = -EAGAIN;
mutex_unlock(&ctx->uring_lock);
}
if (flags & IORING_ENTER_GETEVENTS) {
--
Jens Axboe
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: fixup for "io_uring: allocate io_kiocb upfront"
2019-11-07 3:20 fixup for "io_uring: allocate io_kiocb upfront" Jens Axboe
@ 2019-11-07 9:24 ` Pavel Begunkov
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2019-11-07 9:24 UTC (permalink / raw)
To: Jens Axboe, io-uring
[-- Attachment #1.1: Type: text/plain, Size: 1796 bytes --]
On 07/11/2019 06:20, Jens Axboe wrote:
> Pavel,
>
> I didn't read this one closely enough for the latest change, we
> can't just return -EAGAIN if we don't submit anything, we have to
> explicitly do it for just the failure case of not getting a request.
> I'm going to fold in this incremental:
>
My bad, it should be a common case to have @to_submit >= nr_sqes_in_ring
(i.e. I don't care, just submit all). Thanks for fixing it.
Also, if it submitted @n (>0), and can't allocate for @n+1, I'd rather
prefer to get submitted count.
BTW, I found this "one return value for both submit() and wait_cqes()"
a bit confusing. In addition, there is reporting through cqe, and
sometimes they could be interchanged like in this case. It's getting
even more trickier with links.
Maybe, you have some write-up on what to expect from this perspective?
Don't remember it to be in the pdf.
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 951fd09612ec..af8a673c618f 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2978,8 +2978,11 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
> unsigned int sqe_flags;
>
> req = io_get_req(ctx, statep);
> - if (unlikely(!req))
> + if (unlikely(!req)) {
> + if (!submitted)
> + submitted = -EAGAIN;
> break;
> + }
> if (!io_get_sqring(ctx, &req->submit)) {
> __io_free_req(req);
> break;
> @@ -4316,8 +4319,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
> cur_mm = ctx->sqo_mm;
> submitted = io_submit_sqes(ctx, to_submit, f.file, fd,
> &cur_mm, false);
> - if (!submitted)
> - submitted = -EAGAIN;
> mutex_unlock(&ctx->uring_lock);
> }
> if (flags & IORING_ENTER_GETEVENTS) {
>
--
Pavel Begunkov
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-07 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-07 3:20 fixup for "io_uring: allocate io_kiocb upfront" Jens Axboe
2019-11-07 9:24 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox