From: Caleb Sander Mateos <csander@purestorage.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH 4/4] io_uring/uring_cmd: implement ->sqe_copy() to avoid unnecessary copies
Date: Fri, 6 Jun 2025 17:50:47 -0700 [thread overview]
Message-ID: <CADUfDZpoH=moy_cFvr81g16fw8dFtyLrWo1DZHc_gdbm=nwSeQ@mail.gmail.com> (raw)
In-Reply-To: <20250606215633.322075-5-axboe@kernel.dk>
On Fri, Jun 6, 2025 at 2:56 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> uring_cmd currently copies the full SQE at prep time, just in case it
> needs it to be stable. However, for inline completions or requests that
> get queued up on the device side, there's no need to ever copy the SQE.
> This is particularly important, as various use cases of uring_cmd will
> be using 128b sized SQEs.
>
> Opt in to using ->sqe_copy() to let the core of io_uring decide when to
> copy SQEs, rather than to it upfront unconditionally.
>
> This provides two checks to see if ioucmd->sqe is still valid:
>
> 1) IO_URING_F_INLINE must be set, indicating the ->sqe_copy() call is
> happening inline from the syscal submitting the IO. As long as we're
> in that context, the SQE cannot have been reused.
>
> 2) If the SQE being passed in is NULL, then we're off the task_work
> submission path. This check could be combined with IO_URING_F_INLINE,
> but it'd require an additional branch-and-check in SQE queueing.
>
> If either of these aren't true and the SQE hasn't been copied already,
> then fail the request with -EFAULT and trigger a WARN_ON_ONCE() to
> indicate that there's a bug to figure out. With that, it should not be
> possible to ever reuse an SQE outside of the direct syscall path.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
With the parts about IO_URING_F_INLINE and NULL SQE removed from the
commit message,
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
next prev parent reply other threads:[~2025-06-07 0:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 21:54 [PATCHSET v3 0/4] uring_cmd copy avoidance Jens Axboe
2025-06-06 21:54 ` [PATCH 1/4] io_uring: add IO_URING_F_INLINE issue flag Jens Axboe
2025-06-07 0:49 ` Caleb Sander Mateos
2025-06-06 21:54 ` [PATCH 2/4] io_uring: add struct io_cold_def->sqe_copy() method Jens Axboe
2025-06-07 0:50 ` Caleb Sander Mateos
2025-06-07 11:16 ` Jens Axboe
2025-06-06 21:54 ` [PATCH 3/4] io_uring/uring_cmd: get rid of io_uring_cmd_prep_setup() Jens Axboe
2025-06-08 19:57 ` Anuj gupta
2025-06-06 21:54 ` [PATCH 4/4] io_uring/uring_cmd: implement ->sqe_copy() to avoid unnecessary copies Jens Axboe
2025-06-07 0:50 ` Caleb Sander Mateos [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-06-09 17:36 [PATCHSET v4 0/4] uring_cmd copy avoidance Jens Axboe
2025-06-09 17:36 ` [PATCH 4/4] io_uring/uring_cmd: implement ->sqe_copy() to avoid unnecessary copies Jens Axboe
2025-06-09 21:54 ` Caleb Sander Mateos
2025-06-10 13:35 ` Jens Axboe
2025-06-05 19:40 [PATCHSET RFC v2 0/4] uring_cmd copy avoidance Jens Axboe
2025-06-05 19:40 ` [PATCH 4/4] io_uring/uring_cmd: implement ->sqe_copy() to avoid unnecessary copies Jens Axboe
2025-06-06 17:39 ` Caleb Sander Mateos
2025-06-06 21:05 ` Jens Axboe
2025-06-06 22:08 ` Jens Axboe
2025-06-06 22:09 ` Caleb Sander Mateos
2025-06-06 23:53 ` 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='CADUfDZpoH=moy_cFvr81g16fw8dFtyLrWo1DZHc_gdbm=nwSeQ@mail.gmail.com' \
--to=csander@purestorage.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
/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