public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: fix blocking inline submission
Date: Mon, 14 Jun 2021 10:30:51 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 6/9/21 4:47 PM, Pavel Begunkov wrote:
> On 6/9/21 4:43 PM, Jens Axboe wrote:
>> On 6/9/21 9:41 AM, Pavel Begunkov wrote:
>>> On 6/9/21 4:36 PM, Jens Axboe wrote:
>>>> On 6/9/21 9:34 AM, Pavel Begunkov wrote:
>>>>> On 6/9/21 4:07 PM, Jens Axboe wrote:
>>>>>> On 6/9/21 5:07 AM, Pavel Begunkov wrote:
>>>>>>> There is a complaint against sys_io_uring_enter() blocking if it submits
>>>>>>> stdin reads. The problem is in __io_file_supports_async(), which
>>>>>>> sees that it's a cdev and allows it to be processed inline.
>>>>>>>
>>>>>>> Punt char devices using generic rules of io_file_supports_async(),
>>>>>>> including checking for presence of *_iter() versions of rw callbacks.
>>>>>>> Apparently, it will affect most of cdevs with some exceptions like
>>>>>>> null and zero devices.
>>>>>>
>>>>>> I don't like this, we really should fix the file types, they are
>>>>>> broken if they don't honor IOCB_NOWAIT and have ->read_iter() (or
>>>>>> the write equiv).
>>>>>>
>>>>>> For cases where there is no iter variant of the read/write handlers,
>>>>>> then yes we should not return true from __io_file_supports_async().
>>>>>
>>>>> I'm confused. The patch doesn't punt them unconditionally, but make
>>>>> it go through the generic path of __io_file_supports_async()
>>>>> including checks for read_iter/write_iter. So if a chrdev has
>>>>> *_iter() it should continue to work as before.
>>>>
>>>> Ah ok, yes then that is indeed fine.
>>>>
>>>>> It fixes the symptom that means the change punts it async, and so
>>>>> I assume tty doesn't have _iter()s for some reason. Will take a
>>>>> look at the tty driver soon to stop blind guessing.
>>>>
>>>> I think they do, but they don't honor IOCB_NOWAIT for example. I'd
>>>> be curious if the patch actually fixes the reported case, even though
>>>> it is most likely the right thing to do. If not, then the fops handler
>>>> need fixing for that driver.
>>>
>>> Yep, weird, but fixes it for me. A simple repro was attached
>>> to the issue.
>>>
>>> https://github.com/axboe/liburing/issues/354
>>
>> Ah ok, all good then for now. I have applied the patch, and added
>> the reported-by as well.
> 
> Great, thanks. Will check what's with the tty part

Apparently, they have *_iter but reasonably don't set FMODE_NOWAIT.
Similar goes for /dev/null and others, either they don't have
*_iter or don't set FMODE_NOWAIT and ignore IOCB_NOWAIT.

Bottom line, we need to tinker cdevs that we're interested to
be efficient.

-- 
Pavel Begunkov

  reply	other threads:[~2021-06-14  9:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 11:07 [PATCH] io_uring: fix blocking inline submission Pavel Begunkov
2021-06-09 12:42 ` Hao Xu
2021-06-14 10:24   ` Pavel Begunkov
2021-06-09 15:07 ` Jens Axboe
2021-06-09 15:34   ` Pavel Begunkov
2021-06-09 15:36     ` Jens Axboe
2021-06-09 15:41       ` Pavel Begunkov
2021-06-09 15:43         ` Jens Axboe
2021-06-09 15:47           ` Pavel Begunkov
2021-06-14  9:30             ` Pavel Begunkov [this message]
2021-06-09 15:38 ` Pavel Begunkov

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] \
    /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