public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks
@ 2026-02-19  1:35 ` Caleb Sander Mateos
  2026-02-19 13:35   ` Kanchan Joshi
                     ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Caleb Sander Mateos @ 2026-02-19  1:35 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch; +Cc: io-uring, linux-kernel, Caleb Sander Mateos

io_should_commit(), io_uring_classic_poll(), and io_do_iopoll() compare
struct io_kiocb's opcode against IORING_OP_URING_CMD to implement
special treatment for uring_cmds. The recently added opcode
IORING_OP_URING_CMD128 is meant to be equivalent to IORING_OP_URING_CMD,
so treat it the same way in these functions.

Fixes: 1cba30bf9fdd ("io_uring: add support for IORING_SETUP_SQE_MIXED")
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 io_uring/io_uring.h | 6 ++++++
 io_uring/kbuf.c     | 2 +-
 io_uring/rw.c       | 4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 503663d6fd6d..0fa844faf287 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -528,10 +528,16 @@ static inline bool io_file_can_poll(struct io_kiocb *req)
 		return true;
 	}
 	return false;
 }
 
+static inline bool io_is_uring_cmd(const struct io_kiocb *req)
+{
+	return req->opcode == IORING_OP_URING_CMD ||
+	       req->opcode == IORING_OP_URING_CMD128;
+}
+
 static inline ktime_t io_get_time(struct io_ring_ctx *ctx)
 {
 	if (ctx->clockid == CLOCK_MONOTONIC)
 		return ktime_get();
 
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index 67d4fe576473..dae5b4ab3819 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -169,11 +169,11 @@ static bool io_should_commit(struct io_kiocb *req, unsigned int issue_flags)
 	*/
 	if (issue_flags & IO_URING_F_UNLOCKED)
 		return true;
 
 	/* uring_cmd commits kbuf upfront, no need to auto-commit */
-	if (!io_file_can_poll(req) && req->opcode != IORING_OP_URING_CMD)
+	if (!io_file_can_poll(req) && !io_is_uring_cmd(req))
 		return true;
 	return false;
 }
 
 static struct io_br_sel io_ring_buffer_select(struct io_kiocb *req, size_t *len,
diff --git a/io_uring/rw.c b/io_uring/rw.c
index b3971171c342..1a5f262734e8 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -1252,11 +1252,11 @@ void io_rw_fail(struct io_kiocb *req)
 static int io_uring_classic_poll(struct io_kiocb *req, struct io_comp_batch *iob,
 				unsigned int poll_flags)
 {
 	struct file *file = req->file;
 
-	if (req->opcode == IORING_OP_URING_CMD) {
+	if (io_is_uring_cmd(req)) {
 		struct io_uring_cmd *ioucmd;
 
 		ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
 		return file->f_op->uring_cmd_iopoll(ioucmd, iob, poll_flags);
 	} else {
@@ -1378,11 +1378,11 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
 			continue;
 		list_del(&req->iopoll_node);
 		wq_list_add_tail(&req->comp_list, &ctx->submit_state.compl_reqs);
 		nr_events++;
 		req->cqe.flags = io_put_kbuf(req, req->cqe.res, NULL);
-		if (req->opcode != IORING_OP_URING_CMD)
+		if (!io_is_uring_cmd(req))
 			io_req_rw_cleanup(req, 0);
 	}
 	if (nr_events)
 		__io_submit_flush_completions(ctx);
 	return nr_events;
-- 
2.45.2


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

* Re: [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks
  2026-02-19  1:35 ` [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks Caleb Sander Mateos
@ 2026-02-19 13:35   ` Kanchan Joshi
  2026-02-19 13:40   ` Anuj gupta
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kanchan Joshi @ 2026-02-19 13:35 UTC (permalink / raw)
  To: Caleb Sander Mateos, Jens Axboe, Keith Busch; +Cc: io-uring, linux-kernel

On 2/19/2026 7:05 AM, Caleb Sander Mateos wrote:
> io_should_commit(), io_uring_classic_poll(), and io_do_iopoll() compare
> struct io_kiocb's opcode against IORING_OP_URING_CMD to implement
> special treatment for uring_cmds. The recently added opcode
> IORING_OP_URING_CMD128 is meant to be equivalent to IORING_OP_URING_CMD,
> so treat it the same way in these functions.
> 
> Fixes: 1cba30bf9fdd ("io_uring: add support for IORING_SETUP_SQE_MIXED")
> Signed-off-by: Caleb Sander Mateos<csander@purestorage.com>

Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>

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

* Re: [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks
  2026-02-19  1:35 ` [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks Caleb Sander Mateos
  2026-02-19 13:35   ` Kanchan Joshi
@ 2026-02-19 13:40   ` Anuj gupta
  2026-02-19 14:32   ` Jens Axboe
  2026-02-19 15:23   ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Anuj gupta @ 2026-02-19 13:40 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, Keith Busch, io-uring, linux-kernel

Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>

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

* Re: [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks
  2026-02-19  1:35 ` [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks Caleb Sander Mateos
  2026-02-19 13:35   ` Kanchan Joshi
  2026-02-19 13:40   ` Anuj gupta
@ 2026-02-19 14:32   ` Jens Axboe
  2026-02-19 15:23   ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2026-02-19 14:32 UTC (permalink / raw)
  To: Keith Busch, Caleb Sander Mateos; +Cc: io-uring, linux-kernel


On Wed, 18 Feb 2026 18:35:34 -0700, Caleb Sander Mateos wrote:
> io_should_commit(), io_uring_classic_poll(), and io_do_iopoll() compare
> struct io_kiocb's opcode against IORING_OP_URING_CMD to implement
> special treatment for uring_cmds. The recently added opcode
> IORING_OP_URING_CMD128 is meant to be equivalent to IORING_OP_URING_CMD,
> so treat it the same way in these functions.
> 
> 
> [...]

Applied, thanks!

[1/1] io_uring: add IORING_OP_URING_CMD128 to opcode checks
      commit: 42a6bd57ee9f930a72c26f863c72f666d6ed9ea5

Best regards,
-- 
Jens Axboe




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

* Re: [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks
  2026-02-19  1:35 ` [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks Caleb Sander Mateos
                     ` (2 preceding siblings ...)
  2026-02-19 14:32   ` Jens Axboe
@ 2026-02-19 15:23   ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2026-02-19 15:23 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, io-uring, linux-kernel

On Wed, Feb 18, 2026 at 06:35:34PM -0700, Caleb Sander Mateos wrote:
> io_should_commit(), io_uring_classic_poll(), and io_do_iopoll() compare
> struct io_kiocb's opcode against IORING_OP_URING_CMD to implement
> special treatment for uring_cmds. The recently added opcode
> IORING_OP_URING_CMD128 is meant to be equivalent to IORING_OP_URING_CMD,
> so treat it the same way in these functions.
> 
> Fixes: 1cba30bf9fdd ("io_uring: add support for IORING_SETUP_SQE_MIXED")

Looks good, thanks for the fix.

Reviewed-by: Keith Busch <kbusch@kernel.org>

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

end of thread, other threads:[~2026-02-19 15:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20260219013614epcas5p32f6ea6efe36e9df4d2bb0760f55dce03@epcas5p3.samsung.com>
2026-02-19  1:35 ` [PATCH] io_uring: add IORING_OP_URING_CMD128 to opcode checks Caleb Sander Mateos
2026-02-19 13:35   ` Kanchan Joshi
2026-02-19 13:40   ` Anuj gupta
2026-02-19 14:32   ` Jens Axboe
2026-02-19 15:23   ` Keith Busch

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