public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org, Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH liburing 0/2] Add support for IORING_SETUP_SQ_REWIND
Date: Thu, 22 Jan 2026 16:05:10 -0700	[thread overview]
Message-ID: <517fc5f0-5e6d-46ef-800d-9ef4428278a1@kernel.dk> (raw)
In-Reply-To: <176912275112.522897.5400530813917730862.b4-ty@kernel.dk>

On 1/22/26 3:59 PM, Jens Axboe wrote:
> 
> On Wed, 21 Jan 2026 22:23:20 +0000, Pavel Begunkov wrote:
>> Add liburing support and tests for IORING_SETUP_SQ_REWIND.
>>
>> Pavel Begunkov (2):
>>   src/queue: Add support for non circular SQ
>>   tests: add SETUP_SQ_REWIND tests
>>
>> src/include/liburing.h          |  5 ++++-
>>  src/include/liburing/io_uring.h | 12 ++++++++++++
>>  src/queue.c                     |  5 +++++
>>  test/test.h                     |  2 ++
>>  4 files changed, 23 insertions(+), 1 deletion(-)
>>
>> [...]
> 
> Applied, thanks!
> 
> [1/2] src/queue: Add support for non circular SQ
>       commit: c22129cf0b8c936eb478d920ef84e53d89c6a5cc
> [2/2] tests: add SETUP_SQ_REWIND tests
>       commit: 346c063d16bda52f02d00feb744aafe35b4002a9

Hmm I do think you're missing some spots though, no?

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 987b28aaf99e..016be1e80ef2 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1702,8 +1702,13 @@ IOURINGINLINE unsigned io_uring_load_sq_head(const struct io_uring *ring)
 IOURINGINLINE unsigned io_uring_sq_ready(const struct io_uring *ring)
 	LIBURING_NOEXCEPT
 {
+	unsigned head = 0;
+
+	if (!(ring->flags & IORING_SETUP_SQ_REWIND))
+		head = io_uring_load_sq_head(ring);
+
 	/* always use real head, to avoid losing sync for short submit */
-	return ring->sq.sqe_tail - io_uring_load_sq_head(ring);
+	return ring->sq.sqe_tail - head;
 }
 
 /*
@@ -2063,7 +2068,7 @@ IOURINGINLINE struct io_uring_sqe *io_uring_get_sqe128(struct io_uring *ring)
 	LIBURING_NOEXCEPT
 {
 	struct io_uring_sq *sq = &ring->sq;
-	unsigned head = io_uring_load_sq_head(ring), tail = sq->sqe_tail;
+	unsigned head = 0, tail = sq->sqe_tail;
 	struct io_uring_sqe *sqe;
 
 	if (ring->flags & IORING_SETUP_SQE128)
@@ -2071,6 +2076,9 @@ IOURINGINLINE struct io_uring_sqe *io_uring_get_sqe128(struct io_uring *ring)
 	if (!(ring->flags & IORING_SETUP_SQE_MIXED))
 		return NULL;
 
+	if (!(ring->flags & IORING_SETUP_SQ_REWIND))
+		head = io_uring_load_sq_head(ring);
+
 	if (((tail + 1) & sq->ring_mask) == 0) {
 		if ((tail + 2) - head >= sq->ring_entries)
 			return NULL;

-- 
Jens Axboe

  reply	other threads:[~2026-01-22 23:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21 22:23 [PATCH liburing 0/2] Add support for IORING_SETUP_SQ_REWIND Pavel Begunkov
2026-01-21 22:23 ` [PATCH liburing 1/2] src/queue: Add support for non circular SQ Pavel Begunkov
2026-01-21 22:23 ` [PATCH liburing 2/2] tests: add SETUP_SQ_REWIND tests Pavel Begunkov
2026-01-22 22:59 ` [PATCH liburing 0/2] Add support for IORING_SETUP_SQ_REWIND Jens Axboe
2026-01-22 23:05   ` Jens Axboe [this message]
2026-01-23 14:14     ` Pavel Begunkov
2026-01-23 19:04       ` Jens Axboe
2026-01-24 10:44         ` Pavel Begunkov
2026-01-24 15:12           ` Jens Axboe
2026-01-24 16:37             ` Pavel Begunkov

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=517fc5f0-5e6d-46ef-800d-9ef4428278a1@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --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