public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: fix mixed cqe overflow handling
@ 2025-11-25 12:33 Pavel Begunkov
  2025-11-25 14:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-11-25 12:33 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, axboe

I started to see zcrx data corruptions. That turned out to be due
to CQ tail pointing to a stale entry which happened to be from
a zcrx request. I.e. the tail is incremented without the CQE
memory being changed.

The culprit is __io_cqring_overflow_flush() passing "cqe32=true"
to io_get_cqe_overflow() for non-mixed CQE32 setups, which only
expects it to be set for mixed 32B CQEs and not for SETUP_CQE32.

The fix is slightly hacky, long term it's better to unify mixed and
CQE32 handling.

Fixes: e26dca67fde19 ("io_uring: add support for IORING_SETUP_CQE_MIXED")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 1e58fc1d5667..5d130c578435 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -601,6 +601,8 @@ static void __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool dying)
 			is_cqe32 = true;
 			cqe_size <<= 1;
 		}
+		if (ctx->flags & IORING_SETUP_CQE32)
+			is_cqe32 = false;
 
 		if (!dying) {
 			if (!io_get_cqe_overflow(ctx, &cqe, true, is_cqe32))
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] io_uring: fix mixed cqe overflow handling
  2025-11-25 12:33 [PATCH 1/1] io_uring: fix mixed cqe overflow handling Pavel Begunkov
@ 2025-11-25 14:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-11-25 14:04 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Tue, 25 Nov 2025 12:33:06 +0000, Pavel Begunkov wrote:
> I started to see zcrx data corruptions. That turned out to be due
> to CQ tail pointing to a stale entry which happened to be from
> a zcrx request. I.e. the tail is incremented without the CQE
> memory being changed.
> 
> The culprit is __io_cqring_overflow_flush() passing "cqe32=true"
> to io_get_cqe_overflow() for non-mixed CQE32 setups, which only
> expects it to be set for mixed 32B CQEs and not for SETUP_CQE32.
> 
> [...]

Applied, thanks!

[1/1] io_uring: fix mixed cqe overflow handling
      commit: f6dc5a36195d3f5be769f60d6987150192dfb099

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-25 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 12:33 [PATCH 1/1] io_uring: fix mixed cqe overflow handling Pavel Begunkov
2025-11-25 14:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox