From: Jens Axboe <[email protected]>
To: Oleg Nesterov <[email protected]>
Cc: [email protected], [email protected],
Peter Zijlstra <[email protected]>
Subject: Re: [PATCH 4/4] io_uring: flush task work before waiting for ring exit
Date: Wed, 8 Apr 2020 11:48:02 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 4/8/20 11:40 AM, Oleg Nesterov wrote:
> Jens, I am sorry. I tried to understand your explanations but I can't :/
> Just in case, I know nothing about io_uring.
>
> However, I strongly believe that
>
> - the "task_work_exited" check in 4/4 can't help, the kernel
> will crash anyway if a task-work callback runs with
> current->task_works == &task_work_exited.
>
> - this check is not needed with the patch I sent.
> UNLESS io_ring_ctx_wait_and_kill() can be called by the exiting
> task AFTER it passes exit_task_work(), but I don't see how this
> is possible.
>
> Lets forget this problem, lets assume that task_work_run() is always safe.
>
> I still can not understand why io_ring_ctx_wait_and_kill() needs to call
> task_work_run().
>
> On 04/07, Jens Axboe wrote:
>>
>> io_uring exit removes the pending poll requests, but what if (for non
>> exit invocation), we get poll requests completing before they are torn
>> down. Now we have task_work queued up that won't get run,
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> this must not be possible. If task_work is queued it will run, or we
> have another bug.
>
>> because we
>> are are in the task_work handler for the __fput().
>
> this doesn't matter...
>
>> For this case, we
>> need to run the task work.
>
> This is what I fail to understand :/
Actually debugging this just now to attempt to get to the bottom of it.
I'm running with Peter's "put fput work at the end at task_work_run
time" patch (with a head == NULL check that was missing). I get a hang
on the wait_for_completion() on io_uring exit, and if I dump the
task_work, this is what I get:
dump_work: dump cb
cb=ffff88bff25589b8, func=ffffffff812f7310 <- io_poll_task_func()
cb=ffff88bfdd164600, func=ffffffff812925e0 <- some __fput()
cb=ffff88bfece13cb8, func=ffffffff812f7310 <- io_poll_task_func()
cb=ffff88bff78393b8, func=ffffffff812b2c40
and we hang because io_poll_task_func() got queued twice on this task
_after_ we yanked the current list of work.
I'm adding some more debug items to figure out why this is, just wanted
to let you know that I'm currently looking into this and will provide
more data when I have it.
--
Jens Axboe
next prev parent reply other threads:[~2020-04-08 18:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-07 16:02 [PATCHSET v2] io_uring and task_work interactions Jens Axboe
2020-04-07 16:02 ` [PATCH 1/4] task_work: add task_work_pending() helper Jens Axboe
2020-04-07 17:52 ` Jann Horn
2020-04-07 16:02 ` [PATCH 2/4] task_work: kill current->task_works checking in callers Jens Axboe
2020-04-07 16:02 ` [PATCH 3/4] task_work: make exit_work externally visible Jens Axboe
2020-04-07 16:02 ` [PATCH 4/4] io_uring: flush task work before waiting for ring exit Jens Axboe
2020-04-07 16:24 ` Oleg Nesterov
2020-04-07 16:38 ` Oleg Nesterov
2020-04-07 20:30 ` Jens Axboe
2020-04-07 20:39 ` Jens Axboe
2020-04-08 18:40 ` Oleg Nesterov
2020-04-08 18:48 ` Jens Axboe [this message]
2020-04-08 19:06 ` Jens Axboe
2020-04-08 20:17 ` Oleg Nesterov
2020-04-08 20:25 ` Jens Axboe
2020-04-08 21:19 ` Jens Axboe
2020-04-09 18:50 ` Oleg Nesterov
2020-04-10 0:29 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2020-04-06 19:48 [PATCHSET 0/4] io_uring and task_work interactions Jens Axboe
2020-04-06 19:48 ` [PATCH 4/4] io_uring: flush task work before waiting for ring exit Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox