From: Jens Axboe <axboe@kernel.dk>
To: Caleb Sander Mateos <csander@purestorage.com>,
Ming Lei <ming.lei@redhat.com>
Cc: io-uring@vger.kernel.org, Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH V5 2/2] io_uring: uring_cmd: add multishot support
Date: Thu, 21 Aug 2025 10:37:27 -0600 [thread overview]
Message-ID: <5c51412b-9031-462e-b651-eaf72bf773c4@kernel.dk> (raw)
In-Reply-To: <CADUfDZruvf+RTVRdH16X0xfUO-FmgLZAx6zvwHN3s0LoCcUAQA@mail.gmail.com>
On 8/21/25 10:23 AM, Caleb Sander Mateos wrote:
>> @@ -333,3 +351,54 @@ bool io_uring_cmd_post_mshot_cqe32(struct io_uring_cmd *cmd,
>> return false;
>> return io_req_post_cqe32(req, cqe);
>> }
>> +
>> +/*
>> + * Work with io_uring_mshot_cmd_post_cqe() together for committing the
>> + * provided buffer upfront
>> + */
>> +struct io_br_sel io_uring_cmd_buffer_select(struct io_uring_cmd *ioucmd,
>> + unsigned buf_group, size_t *len,
>> + unsigned int issue_flags)
>> +{
>> + struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
>> +
>> + if (!(ioucmd->flags & IORING_URING_CMD_MULTISHOT))
>> + return (struct io_br_sel) { .val = -EINVAL };
>
> Would this condition make more sense as a WARN_ON()? When would this
> be called for a non-IORING_URING_CMD_MULTISHOT io_uring_cmd?
>
>> +
>> + if (WARN_ON_ONCE(!io_do_buffer_select(req)))
>> + return (struct io_br_sel) { .val = -EINVAL };
>> +
>> + return io_buffer_select(req, len, buf_group, issue_flags);
>> +}
>> +EXPORT_SYMBOL_GPL(io_uring_cmd_buffer_select);
>> +
>> +/*
>> + * Return true if this multishot uring_cmd needs to be completed, otherwise
>> + * the event CQE is posted successfully.
>> + *
>> + * This function must use `struct io_br_sel` returned from
>> + * io_uring_cmd_buffer_select() for committing the buffer in the same
>> + * uring_cmd submission context.
>> + */
>> +bool io_uring_mshot_cmd_post_cqe(struct io_uring_cmd *ioucmd,
>> + struct io_br_sel *sel, unsigned int issue_flags)
>> +{
>> + struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
>> + unsigned int cflags = 0;
>> +
>> + if (!(ioucmd->flags & IORING_URING_CMD_MULTISHOT))
>> + return true;
>
> Same here, a WARN_ON() seems like it would make more sense.
Honestly, I think the existing WARN_ON_ONCE() needs to go rather. I
guess the point is that it's an internal misuse, eg it should not
happen. But I think just passing the error should be enough, you'd know
something is wrong anyway. The reasoning for getting rid of them is that
if these end up being somehow triggerable, then a WARN_ON() is a
potential DOS issue.
IOW, anything WARN_*() should probably just go on that side...
--
Jens Axboe
next prev parent reply other threads:[~2025-08-21 16:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 4:02 [PATCH V5 0/2] io_uring: uring_cmd: add multishot support with provided buffer Ming Lei
2025-08-21 4:02 ` [PATCH V5 1/2] io-uring: move `struct io_br_sel` into io_uring_types.h Ming Lei
2025-08-21 4:02 ` [PATCH V5 2/2] io_uring: uring_cmd: add multishot support Ming Lei
2025-08-21 16:23 ` Caleb Sander Mateos
2025-08-21 16:37 ` Jens Axboe [this message]
2025-08-21 16:29 ` Caleb Sander Mateos
2025-08-21 16:38 ` Jens Axboe
2025-08-22 0:52 ` Ming Lei
2025-08-22 0:58 ` Jens Axboe
2025-08-21 11:41 ` [PATCH V5 0/2] io_uring: uring_cmd: add multishot support with provided buffer Jens Axboe
2025-08-21 11:44 ` 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 \
--in-reply-to=5c51412b-9031-462e-b651-eaf72bf773c4@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=csander@purestorage.com \
--cc=io-uring@vger.kernel.org \
--cc=ming.lei@redhat.com \
/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