public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: guzebing <guzebing1612@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] io_uring/register: preserve SQ array entries on resize
Date: Tue, 16 Jun 2026 19:58:56 +0800	[thread overview]
Message-ID: <cfdb0fcf-5687-448a-ba44-3b16535b3a90@gmail.com> (raw)
In-Reply-To: <20260608133316.3656440-1-guzebing1612@gmail.com>

Hi Jens,

A gentle ping on this patch.

Please allow me to add some details about the root cause and the
reproducer.

There appear to be two related parts to how the resize path migrates 
pending SQ entries in regular SQ-array mode.

1. It copies SQEs by walking the logical SQ head/tail range directly.
For a pending SQ entry in regular SQ-array mode, the resize path should
first resolve the old sq_array[] entry to find the source physical SQE
slot, and then copy that SQE into the new SQE array.

2. The old resize path switches ctx->sq_array to the SQ array in the
new ring, but it does not initialize the SQ array entries for the 
pending submissions.


And I reproduced this with a small test that:

1. creates a ring with IORING_SETUP_SINGLE_ISSUER | 
IORING_SETUP_DEFER_TASKRUN,
2. writes two NOP SQEs into physical slots 1 and 2,
3. queues two pending entries by setting sq_array[0] = 1 and
    sq_array[1] = 2 and advancing the SQ tail,
4. resizes the ring,
5. calls io_uring_enter() to submit those pending SQ entries.

Without the fix, the subsequent submission path can consume the wrong 
SQE after resize and return a CQE with the wrong user_data. With the 
patch applied, pending SQ entries are migrated using the old SQ-array 
mapping, so they still refer to the intended SQEs after resize.

Could you please take a look when you have a chance? I would also
appreciate feedback if you think this is not the right direction, or if
there is a better way to preserve pending SQ-array entries during resize.

Thanks,
guzebing

  reply	other threads:[~2026-06-16 11:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 13:33 [PATCH] io_uring/register: preserve SQ array entries on resize guzebing
2026-06-16 11:58 ` guzebing [this message]
2026-06-16 16:08 ` 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=cfdb0fcf-5687-448a-ba44-3b16535b3a90@gmail.com \
    --to=guzebing1612@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@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