All of lore.kernel.org
 help / color / mirror / Atom feed
* io_uring_enter() returns EAGAIN after child exit in 5.12
@ 2021-02-24  3:25 Andres Freund
  2021-02-24  3:35 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Andres Freund @ 2021-02-24  3:25 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring

Hi,

commit 41be53e94fb04cc69fdf2f524c2a05d8069e047b (HEAD, refs/bisect/bad)
Author: Jens Axboe <axboe@kernel.dk>
Date:   2021-02-13 09:11:04 -0700

    io_uring: kill cached requests from exiting task closing the ring

    Be nice and prune these upfront, in case the ring is being shared and
    one of the tasks is going away. This is a bit more important now that
    we account the allocations.

    Signed-off-by: Jens Axboe <axboe@kernel.dk>


causes EAGAIN to be returned by io_uring_enter() after a child
exits. The existing liburing test across-fork.c repros the issue after
applying the patch below.

Retrying the submission twice seems to make it succeed most of the
time...

Greetings,

Andres Freund

diff --git a/test/across-fork.c b/test/across-fork.c
index 14ee93a..2b19f39 100644
--- a/test/across-fork.c
+++ b/test/across-fork.c
@@ -220,6 +220,13 @@ int main(int argc, char *argv[])
                if (wait_cqe(&shmem->ring, "p cqe 2"))
                        goto errcleanup;
 
+               /* check that IO still works after the child exited */
+               if (submit_write(&shmem->ring, shared_fd, "parent: after child exit\n", 0))
+                       goto errcleanup;
+
+               if (wait_cqe(&shmem->ring, "p cqe 3"))
+                       goto errcleanup;
+
                break;
        }
        case 0: {
@@ -260,7 +267,8 @@ int main(int argc, char *argv[])
        if (verify_file(tmpdir, "shared",
                         "before fork: write shared fd\n"
                         "parent: write shared fd\n"
-                        "child: write shared fd\n") ||
+                        "child: write shared fd\n"
+                        "parent: after child exit\n") ||
            verify_file(tmpdir, "parent1", "parent: write parent fd 1\n") ||
            verify_file(tmpdir, "parent2", "parent: write parent fd 2\n") ||
            verify_file(tmpdir, "child", "child: write child fd\n"))

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

* Re: io_uring_enter() returns EAGAIN after child exit in 5.12
  2021-02-24  3:25 io_uring_enter() returns EAGAIN after child exit in 5.12 Andres Freund
@ 2021-02-24  3:35 ` Jens Axboe
  2021-02-24  4:31   ` Andres Freund
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2021-02-24  3:35 UTC (permalink / raw)
  To: Andres Freund; +Cc: io-uring

On 2/23/21 8:25 PM, Andres Freund wrote:
> Hi,
> 
> commit 41be53e94fb04cc69fdf2f524c2a05d8069e047b (HEAD, refs/bisect/bad)
> Author: Jens Axboe <axboe@kernel.dk>
> Date:   2021-02-13 09:11:04 -0700
> 
>     io_uring: kill cached requests from exiting task closing the ring
> 
>     Be nice and prune these upfront, in case the ring is being shared and
>     one of the tasks is going away. This is a bit more important now that
>     we account the allocations.
> 
>     Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> 
> causes EAGAIN to be returned by io_uring_enter() after a child
> exits. The existing liburing test across-fork.c repros the issue after
> applying the patch below.
> 
> Retrying the submission twice seems to make it succeed most of the
> time...

Oh that's funky, I'll take a look.

-- 
Jens Axboe


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

* Re: io_uring_enter() returns EAGAIN after child exit in 5.12
  2021-02-24  3:35 ` Jens Axboe
@ 2021-02-24  4:31   ` Andres Freund
  2021-02-24  4:33     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Andres Freund @ 2021-02-24  4:31 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring

Hi,

On 2021-02-23 20:35:09 -0700, Jens Axboe wrote:
> On 2/23/21 8:25 PM, Andres Freund wrote:
> > Hi,
> > 
> > commit 41be53e94fb04cc69fdf2f524c2a05d8069e047b (HEAD, refs/bisect/bad)
> > Author: Jens Axboe <axboe@kernel.dk>
> > Date:   2021-02-13 09:11:04 -0700
> > 
> >     io_uring: kill cached requests from exiting task closing the ring
> > 
> >     Be nice and prune these upfront, in case the ring is being shared and
> >     one of the tasks is going away. This is a bit more important now that
> >     we account the allocations.
> > 
> >     Signed-off-by: Jens Axboe <axboe@kernel.dk>
> > 
> > 
> > causes EAGAIN to be returned by io_uring_enter() after a child
> > exits. The existing liburing test across-fork.c repros the issue after
> > applying the patch below.
> > 
> > Retrying the submission twice seems to make it succeed most of the
> > time...
> 
> Oh that's funky, I'll take a look.
 
It was fixed in

commit 8e5c66c485a8af3f39a8b0358e9e09f002016d92
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   2021-02-22 11:45:55 +0000

    io_uring: clear request count when freeing caches


Jens, seems like it'd make sense to apply the test case upthread into
the liburing repo. Do you want me to open a PR?

Greetings,

Andres Freund

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

* Re: io_uring_enter() returns EAGAIN after child exit in 5.12
  2021-02-24  4:31   ` Andres Freund
@ 2021-02-24  4:33     ` Jens Axboe
  2021-02-24  4:54       ` Andres Freund
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2021-02-24  4:33 UTC (permalink / raw)
  To: Andres Freund; +Cc: io-uring

On 2/23/21 9:31 PM, Andres Freund wrote:
> Hi,
> 
> On 2021-02-23 20:35:09 -0700, Jens Axboe wrote:
>> On 2/23/21 8:25 PM, Andres Freund wrote:
>>> Hi,
>>>
>>> commit 41be53e94fb04cc69fdf2f524c2a05d8069e047b (HEAD, refs/bisect/bad)
>>> Author: Jens Axboe <axboe@kernel.dk>
>>> Date:   2021-02-13 09:11:04 -0700
>>>
>>>     io_uring: kill cached requests from exiting task closing the ring
>>>
>>>     Be nice and prune these upfront, in case the ring is being shared and
>>>     one of the tasks is going away. This is a bit more important now that
>>>     we account the allocations.
>>>
>>>     Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>>
>>>
>>> causes EAGAIN to be returned by io_uring_enter() after a child
>>> exits. The existing liburing test across-fork.c repros the issue after
>>> applying the patch below.
>>>
>>> Retrying the submission twice seems to make it succeed most of the
>>> time...
>>
>> Oh that's funky, I'll take a look.
>  
> It was fixed in
> 
> commit 8e5c66c485a8af3f39a8b0358e9e09f002016d92
> Author: Pavel Begunkov <asml.silence@gmail.com>
> Date:   2021-02-22 11:45:55 +0000
> 
>     io_uring: clear request count when freeing caches

Yep, thanks for confirming. Didn't immediate connect them, but I guess
any sort of oddity is possible before that fix with the caches.

> Jens, seems like it'd make sense to apply the test case upthread into
> the liburing repo. Do you want me to open a PR?

I think so, it's a good addition. Either a PR or just an emailed patch,
whatever you prefer. Well, the previous email had whitespace damage,
so maybe a PR is safer :-)

-- 
Jens Axboe


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

* Re: io_uring_enter() returns EAGAIN after child exit in 5.12
  2021-02-24  4:33     ` Jens Axboe
@ 2021-02-24  4:54       ` Andres Freund
  2021-02-24 16:24         ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Andres Freund @ 2021-02-24  4:54 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring

Hi,

On 2021-02-23 21:33:38 -0700, Jens Axboe wrote:
> On 2/23/21 9:31 PM, Andres Freund wrote:
> > Jens, seems like it'd make sense to apply the test case upthread into
> > the liburing repo. Do you want me to open a PR?
> 
> I think so, it's a good addition. Either a PR or just an emailed patch,
> whatever you prefer. Well, the previous email had whitespace damage,
> so maybe a PR is safer :-)

Done https://github.com/axboe/liburing/pull/306. The damage originated
from me foolishly just copy-pasting it from the terminal :) - I wrote it
a test VM and was too lazy to copy the diff out...

Greetings,

Andres Freund

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

* Re: io_uring_enter() returns EAGAIN after child exit in 5.12
  2021-02-24  4:54       ` Andres Freund
@ 2021-02-24 16:24         ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2021-02-24 16:24 UTC (permalink / raw)
  To: Andres Freund; +Cc: io-uring

On 2/23/21 9:54 PM, Andres Freund wrote:
> Hi,
> 
> On 2021-02-23 21:33:38 -0700, Jens Axboe wrote:
>> On 2/23/21 9:31 PM, Andres Freund wrote:
>>> Jens, seems like it'd make sense to apply the test case upthread into
>>> the liburing repo. Do you want me to open a PR?
>>
>> I think so, it's a good addition. Either a PR or just an emailed patch,
>> whatever you prefer. Well, the previous email had whitespace damage,
>> so maybe a PR is safer :-)
> 
> Done https://github.com/axboe/liburing/pull/306. The damage originated
> from me foolishly just copy-pasting it from the terminal :) - I wrote it
> a test VM and was too lazy to copy the diff out...

I totally sympathize with that :-)

I've merged your pull request, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-02-24 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24  3:25 io_uring_enter() returns EAGAIN after child exit in 5.12 Andres Freund
2021-02-24  3:35 ` Jens Axboe
2021-02-24  4:31   ` Andres Freund
2021-02-24  4:33     ` Jens Axboe
2021-02-24  4:54       ` Andres Freund
2021-02-24 16:24         ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.