From: Bernd Schubert <[email protected]>
To: Joanne Koong <[email protected]>
Cc: Bernd Schubert <[email protected]>,
Miklos Szeredi <[email protected]>, Jens Axboe <[email protected]>,
Pavel Begunkov <[email protected]>,
[email protected], [email protected],
Josef Bacik <[email protected]>,
Amir Goldstein <[email protected]>,
Ming Lei <[email protected]>, David Wei <[email protected]>
Subject: Re: [PATCH v9 10/17] fuse: Add io-uring sqe commit and fetch support
Date: Wed, 22 Jan 2025 01:55:42 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/22/25 01:49, Bernd Schubert wrote:
>
>
> On 1/22/25 01:45, Joanne Koong wrote:
>> On Tue, Jan 21, 2025 at 4:18 PM Bernd Schubert <[email protected]> wrote:
>>>
>> ...
>>>>>
>>>>>>
>>>>>>> +
>>>>>>> + err = fuse_ring_ent_set_commit(ring_ent);
>>>>>>> + if (err != 0) {
>>>>>>> + pr_info_ratelimited("qid=%d commit_id %llu state %d",
>>>>>>> + queue->qid, commit_id, ring_ent->state);
>>>>>>> + spin_unlock(&queue->lock);
>>>>>>> + return err;
>>>>>>> + }
>>>>>>> +
>>>>>>> + ring_ent->cmd = cmd;
>>>>>>> + spin_unlock(&queue->lock);
>>>>>>> +
>>>>>>> + /* without the queue lock, as other locks are taken */
>>>>>>> + fuse_uring_commit(ring_ent, issue_flags);
>>>>>>> +
>>>>>>> + /*
>>>>>>> + * Fetching the next request is absolutely required as queued
>>>>>>> + * fuse requests would otherwise not get processed - committing
>>>>>>> + * and fetching is done in one step vs legacy fuse, which has separated
>>>>>>> + * read (fetch request) and write (commit result).
>>>>>>> + */
>>>>>>> + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags);
>>>>>>
>>>>>> If there's no request ready to read next, then no request will be
>>>>>> fetched and this will return. However, as I understand it, once the
>>>>>> uring is registered, userspace should only be interacting with the
>>>>>> uring via FUSE_IO_URING_CMD_COMMIT_AND_FETCH. However for the case
>>>>>> where no request was ready to read, it seems like userspace would have
>>>>>> nothing to commit when it wants to fetch the next request?
>>>>>
>>>>> We have
>>>>>
>>>>> FUSE_IO_URING_CMD_REGISTER
>>>>> FUSE_IO_URING_CMD_COMMIT_AND_FETCH
>>>>>
>>>>>
>>>>> After _CMD_REGISTER the corresponding ring-entry is ready to get fuse
>>>>> requests and waiting. After it gets a request assigned and handles it
>>>>> by fuse server the _COMMIT_AND_FETCH scheme applies. Did you possibly
>>>>> miss that _CMD_REGISTER will already have it waiting?
>>>>>
>>>>
>>>> Sorry for the late reply. After _CMD_REGISTER and _COMMIT_AND_FETCH,
>>>> it seems possible that there is no fuse request waiting until a later
>>>> time? This is the scenario I'm envisioning:
>>>> a) uring registers successfully and fetches request through _CMD_REGISTER
>>>> b) server replies to request and fetches new request through _COMMIT_AND_FETCH
>>>> c) server replies to request, tries to fetch new request but no
>>>> request is ready, through _COMMIT_AND_FETCH
>>>>
>>>> maybe I'm missing something in my reading of the code, but how will
>>>> the server then fetch the next request once the request is ready? It
>>>> will have to commit something in order to fetch it since there's only
>>>> _COMMIT_AND_FETCH which requires a commit, no?
>>>>
>>>
>>> The right name would be '_COMMIT_AND_FETCH_OR_WAIT'. Please see
>>> fuse_uring_next_fuse_req().
>>>
>>> retry:
>>> spin_lock(&queue->lock);
>>> fuse_uring_ent_avail(ent, queue); --> entry available
>>> has_next = fuse_uring_ent_assign_req(ent);
>>> spin_unlock(&queue->lock);
>>>
>>> if (has_next) {
>>> err = fuse_uring_send_next_to_ring(ent, issue_flags);
>>> if (err)
>>> goto retry;
>>> }
>>>
>>>
>>> If there is no available request, the io-uring cmd stored in ent->cmd is
>>> just queued/available.
>>
>> Could you point me to where the wait happens? I think that's the part
>> I'm missing. In my reading of the code, if there's no available
>> request (eg queue->fuse_req_queue is empty), then I see that has_next
>> will return false and fuse_uring_next_fuse_req() /
>> fuse_uring_commit_fetch() returns without having fetched anything.
>> Where does the "if there is no available request, the io-uring cmd is
>> just queued/available" happen?
>>
>
> You need to read it the other way around, without "has_next" the
> avail/queued entry is not removed from the list - it is available
> whenever a new request comes in. Looks like we either need refactoring
> or at least a comment.
It also not the current task operation that waits - that happens in
io-uring with 'io_uring_submit_and_wait' and wait-nr > 0. In fuse is is
really just _not_ running io_uring_cmd_done() that make ent->cmd to be
available.
Does it help?
Thanks,
Bernd
next prev parent reply other threads:[~2025-01-22 0:55 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 0:25 [PATCH v9 00/17] fuse: fuse-over-io-uring Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 01/17] fuse: rename to fuse_dev_end_requests and make non-static Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 02/17] fuse: Move fuse_get_dev to header file Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 03/17] fuse: Move request bits Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 04/17] fuse: Add fuse-io-uring design documentation Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 05/17] fuse: make args->in_args[0] to be always the header Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 06/17] fuse: {io-uring} Handle SQEs - register commands Bernd Schubert
2025-01-07 9:56 ` Luis Henriques
2025-01-07 12:07 ` Bernd Schubert
2025-01-17 11:06 ` Pavel Begunkov
2025-01-19 22:47 ` Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 07/17] fuse: Make fuse_copy non static Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 08/17] fuse: Add fuse-io-uring handling into fuse_copy Bernd Schubert
2025-01-10 22:18 ` Joanne Koong
2025-01-07 0:25 ` [PATCH v9 09/17] fuse: {io-uring} Make hash-list req unique finding functions non-static Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 10/17] fuse: Add io-uring sqe commit and fetch support Bernd Schubert
2025-01-07 14:42 ` Luis Henriques
2025-01-07 15:59 ` Bernd Schubert
2025-01-07 16:21 ` Luis Henriques
2025-01-13 22:44 ` Joanne Koong
2025-01-20 0:33 ` Bernd Schubert
2025-01-22 0:04 ` Joanne Koong
2025-01-22 0:18 ` Bernd Schubert
2025-01-22 0:45 ` Joanne Koong
2025-01-22 0:49 ` Bernd Schubert
2025-01-22 0:55 ` Bernd Schubert [this message]
2025-01-22 1:37 ` Joanne Koong
2025-01-17 11:18 ` Pavel Begunkov
2025-01-17 11:20 ` Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 11/17] fuse: {io-uring} Handle teardown of ring entries Bernd Schubert
2025-01-07 15:31 ` Luis Henriques
2025-01-17 11:23 ` Pavel Begunkov
2025-01-07 0:25 ` [PATCH v9 12/17] fuse: {io-uring} Make fuse_dev_queue_{interrupt,forget} non-static Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 13/17] fuse: Allow to queue fg requests through io-uring Bernd Schubert
2025-01-07 15:54 ` Luis Henriques
2025-01-07 18:59 ` Bernd Schubert
2025-01-07 21:25 ` Luis Henriques
2025-01-17 11:47 ` Pavel Begunkov
2025-01-17 21:52 ` Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 14/17] fuse: Allow to queue bg " Bernd Schubert
2025-01-17 11:49 ` Pavel Begunkov
2025-01-07 0:25 ` [PATCH v9 15/17] fuse: {io-uring} Prevent mount point hang on fuse-server termination Bernd Schubert
2025-01-07 16:14 ` Luis Henriques
2025-01-07 19:03 ` Bernd Schubert
2025-01-17 11:52 ` Pavel Begunkov
2025-01-07 0:25 ` [PATCH v9 16/17] fuse: block request allocation until io-uring init is complete Bernd Schubert
2025-01-07 0:25 ` [PATCH v9 17/17] fuse: enable fuse-over-io-uring Bernd Schubert
2025-01-17 11:52 ` Pavel Begunkov
2025-01-17 9:07 ` [PATCH v9 00/17] fuse: fuse-over-io-uring Miklos Szeredi
2025-01-17 9:12 ` Bernd Schubert
2025-01-17 12:01 ` 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] \
[email protected] \
[email protected] \
[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