public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Caleb Sander Mateos <csander@purestorage.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Keith Busch <kbusch@meta.com>,
	io-uring@vger.kernel.org, ming.lei@redhat.com,
	 Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv3 1/1] io_uring: add support for IORING_SETUP_SQE_MIXED
Date: Thu, 25 Sep 2025 11:21:21 -0700	[thread overview]
Message-ID: <CADUfDZpL2r2nhVDGZF07pDwNw-agxogo3hz2VDvJNvZK+h_Uug@mail.gmail.com> (raw)
In-Reply-To: <f5493b8a-634c-4fba-8fa4-a83c98f501d3@kernel.dk>

On Thu, Sep 25, 2025 at 8:03 AM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 9/24/25 9:12 AM, Keith Busch wrote:
> > contiguous in the SQ ring, a 128b SQE cannot wrap the ring. For this
> > case, a single NOP SQE should be posted with the SKIP_SUCCESS flag set.
> > The kernel should simply ignore those.
>
> I think this mirrors the CQE side too much - the kernel doesn't ignore
> then, they get processed just like any other NOP that has SKIP_SUCCESS
> set. They don't post a CQE, but that's not because they are ignored,
> that's just the nature of a successful NOP w/SKIP_SUCCESS set.
>
> > @@ -2179,6 +2179,14 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
> >       opcode = array_index_nospec(opcode, IORING_OP_LAST);
> >
> >       def = &io_issue_defs[opcode];
> > +     if (def->is_128) {
> > +             if (!(ctx->flags & IORING_SETUP_SQE_MIXED) || *left < 2 ||
> > +                 (ctx->cached_sq_head & (ctx->sq_entries - 1)) == 0)
> > +                     return io_init_fail_req(req, -EINVAL);
> > +             ctx->cached_sq_head++;
> > +             (*left)--;
> > +     }
>
> This could do with a comment!
>
> > @@ -582,9 +583,10 @@ static inline void io_req_queue_tw_complete(struct io_kiocb *req, s32 res)
> >   * IORING_SETUP_SQE128 contexts allocate twice the normal SQE size for each
> >   * slot.
> >   */
> > -static inline size_t uring_sqe_size(struct io_ring_ctx *ctx)
> > +static inline size_t uring_sqe_size(struct io_kiocb *req)
> >  {
> > -     if (ctx->flags & IORING_SETUP_SQE128)
> > +     if (req->ctx->flags & IORING_SETUP_SQE128 ||
> > +         req->opcode == IORING_OP_URING_CMD128)
> >               return 2 * sizeof(struct io_uring_sqe);
> >       return sizeof(struct io_uring_sqe);
>
> This one really confused me, but then I grep'ed, and it's uring_cmd
> specific. Should probably move this one to uring_cmd.c rather than have
> it elsewhere.
>
> > +int io_uring_cmd128_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
> > +{
> > +     if (!(req->ctx->flags & IORING_SETUP_SQE_MIXED))
> > +             return -EINVAL;
> > +     return io_uring_cmd_prep(req, sqe);
> > +}
>
> Why isn't this just allowed for SQE128 as well? There should be no
> reason to disallow explicitly 128b sqe commands in SQE128 mode, they
> should work for any mode that supports 128b SQEs which is either
> SQE_MIXED or SQE128?

Not to mention, the check in io_init_req() should already have
rejected a 128-byte operation on a non-IORING_SETUP_SQE_MIXED
io_ring_ctx.

Best,
Caleb

  reply	other threads:[~2025-09-25 18:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 15:12 [PATCHv3 0/3] Keith Busch
2025-09-24 15:12 ` [PATCHv3 1/3] Add support IORING_SETUP_SQE_MIXED Keith Busch
2025-09-24 20:20   ` Caleb Sander Mateos
2025-09-24 20:30     ` Keith Busch
2025-09-24 20:37       ` Caleb Sander Mateos
2025-09-24 15:12 ` [PATCHv3 1/1] io_uring: add support for IORING_SETUP_SQE_MIXED Keith Busch
2025-09-25 15:03   ` Jens Axboe
2025-09-25 18:21     ` Caleb Sander Mateos [this message]
2025-09-25 18:44       ` Jens Axboe
2025-09-24 15:12 ` [PATCHv3 2/3] Add nop testing " Keith Busch
2025-09-24 15:12 ` [PATCHv3 3/3] Add mixed sqe test for uring commands Keith Busch
2025-09-24 15:54 ` [PATCHv3 0/3] io_uring: mixed submission queue size support Keith Busch

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=CADUfDZpL2r2nhVDGZF07pDwNw-agxogo3hz2VDvJNvZK+h_Uug@mail.gmail.com \
    --to=csander@purestorage.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --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