From: Jann Horn <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring <[email protected]>
Subject: Re: [PATCH] io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
Date: Thu, 23 Jan 2025 15:53:27 +0100 [thread overview]
Message-ID: <CAG48ez0fYsKJe7+RxT80is2E17K1ODx++skZ=tKDKeeX_7O2kw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
On Thu, Jan 23, 2025 at 1:32 AM Jens Axboe <[email protected]> wrote:
> io_uring_cmd_sock() does a read of cmd->sqe->cmd_op, which may look
> like it's the userspace shared SQE, but it's a copy at this point.
> Use cmd->cmd_op rather than dip into the allocated SQE copy - it's
> both simpler and faster and leaves less room for confusion.
>
> Link: https://lore.kernel.org/r/[email protected]
> Signed-off-by: Jens Axboe <[email protected]>
>
> ---
>
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index fc94c465a985..3993c9339ac7 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -350,7 +350,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)
> if (!prot || !prot->ioctl)
> return -EOPNOTSUPP;
>
> - switch (cmd->sqe->cmd_op) {
> + switch (cmd->cmd_op) {
Ah, yeah, this does look better than the READ_ONCE() I suggested.
prev parent reply other threads:[~2025-01-23 14:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 0:32 [PATCH] io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock() Jens Axboe
2025-01-23 14:53 ` Jann Horn [this message]
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='CAG48ez0fYsKJe7+RxT80is2E17K1ODx++skZ=tKDKeeX_7O2kw@mail.gmail.com' \
[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