public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Keith Busch <kbusch@meta.com>, io-uring@vger.kernel.org, axboe@kernel.dk
Subject: Re: [PATCHv5 1/1] io_uring: add support for IORING_SETUP_SQE_MIXED
Date: Tue, 14 Oct 2025 20:03:42 -0600	[thread overview]
Message-ID: <aO8A_nGt9D0bVnPt@kbusch-mbp> (raw)
In-Reply-To: <CADUfDZqe7+M9dqxVxUmMo31S1EGVmOhwqfKGLJfR45Yb_BT+Fg@mail.gmail.com>

On Tue, Oct 14, 2025 at 03:33:19PM -0700, Caleb Sander Mateos wrote:
> On Mon, Oct 13, 2025 at 11:00 AM Keith Busch <kbusch@meta.com> wrote:
> > +               /*
> > +                * A 128b op on a non-128b SQ requires mixed SQE support as
> > +                * well as 2 contiguous entries.
> > +                */
> > +               if (!(ctx->flags & IORING_SETUP_SQE_MIXED) || *left < 2 ||
> > +                   !(ctx->cached_sq_head & (ctx->sq_entries - 1)))
> > +                       return io_init_fail_req(req, -EINVAL);
> > +               /*
> > +                * A 128b operation on a mixed SQ uses two entries, so we have
> > +                * to increment the head and decrement what's left.
> > +                */
> > +               ctx->cached_sq_head++;
> > +               (*left)--;
> 
> Hmm, io_submit_sqes() calls io_get_task_refs() at the start to
> decrement cached_refs by the number of SQEs (counting 128-byte SQEs
> twice) but io_put_task() only increments it once for each completed
> request (counting 128-byte SQEs once). Does that mean there's a
> refcount leak? Perhaps io_submit_sqes() or this block needs to
> increment cached_refs to account for each 128-byte SQE?

It looks like you're right. I think the increment option is the easiest
way to deal with it, just adding this line into the above:

+ 	current->io_uring->cached_refs++;

I'm going to take a moment to figure out a good way to test this because
I don't think I'm hitting any problem with the admittedly simple tests
I've offered to liburing, so I may be missing something.

  reply	other threads:[~2025-10-15  2:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 18:00 [PATCHv5 0/4] liburing: support for mix sized sqe's Keith Busch
2025-10-13 18:00 ` [PATCHv5 0/1] io_uring: mixed submission queue entries sizes Keith Busch
2025-10-13 18:00 ` [PATCHv5 1/1] io_uring: add support for IORING_SETUP_SQE_MIXED Keith Busch
2025-10-14 22:33   ` Caleb Sander Mateos
2025-10-15  2:03     ` Keith Busch [this message]
2025-10-16 18:06       ` Keith Busch
2025-10-13 18:00 ` [PATCHv5 1/4] liburing: provide uring_cmd prep function Keith Busch
2025-10-19 16:24   ` Caleb Sander Mateos
2025-10-21 16:45     ` Keith Busch
2025-10-13 18:00 ` [PATCHv5 2/4] Add support IORING_SETUP_SQE_MIXED Keith Busch
2025-10-13 18:00 ` [PATCHv5 3/4] Add nop testing for IORING_SETUP_SQE_MIXED Keith Busch
2025-10-13 18:00 ` [PATCHv5 4/4] Add mixed sqe test for uring commands 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=aO8A_nGt9D0bVnPt@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kbusch@meta.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