All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups
@ 2025-08-21 16:33 Caleb Sander Mateos
  2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Caleb Sander Mateos @ 2025-08-21 16:33 UTC (permalink / raw)
  To: Jens Axboe, Ming Lei; +Cc: io-uring, Caleb Sander Mateos

One compile fix and a couple code simplifications for the recent series
adding support for multishot uring_cmd buffer selection.

Caleb Sander Mateos (3):
  io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING
  io_uring/cmd: deduplicate uring_cmd_flags checks
  io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks

 include/linux/io_uring/cmd.h |  3 ++-
 io_uring/uring_cmd.c         | 12 +++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

-- 
2.45.2


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

* [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING
  2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
@ 2025-08-21 16:33 ` Caleb Sander Mateos
  2025-08-21 16:38   ` Jens Axboe
  2025-08-21 16:33 ` [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks Caleb Sander Mateos
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Caleb Sander Mateos @ 2025-08-21 16:33 UTC (permalink / raw)
  To: Jens Axboe, Ming Lei; +Cc: io-uring, Caleb Sander Mateos

io_uring_mshot_cmd_post_cqe() is declared with a different signature
when CONFIG_IO_URING is defined than when it isn't. Match the
!CONFIG_IO_URING definition's signature to the CONFIG_IO_URING one.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: 55dc643dd2ad ("io_uring: uring_cmd: add multishot support")
---
 include/linux/io_uring/cmd.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
index be0e29b72669..f746f6a77e96 100644
--- a/include/linux/io_uring/cmd.h
+++ b/include/linux/io_uring/cmd.h
@@ -122,11 +122,12 @@ io_uring_cmd_buffer_select(struct io_uring_cmd *ioucmd, unsigned buf_group,
 			   size_t *len, unsigned int issue_flags);
 {
 	return (struct io_br_sel) { .val = -EOPNOTSUPP };
 }
 static inline bool io_uring_mshot_cmd_post_cqe(struct io_uring_cmd *ioucmd,
-				ssize_t ret, unsigned int issue_flags)
+					       struct io_br_sel *sel,
+					       unsigned int issue_flags)
 {
 	return true;
 }
 #endif
 
-- 
2.45.2


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

* [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks
  2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
  2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
@ 2025-08-21 16:33 ` Caleb Sander Mateos
  2025-08-22  1:16   ` Ming Lei
  2025-08-21 16:33 ` [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks Caleb Sander Mateos
  2025-08-22  1:59 ` (subset) [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Caleb Sander Mateos @ 2025-08-21 16:33 UTC (permalink / raw)
  To: Jens Axboe, Ming Lei; +Cc: io-uring, Caleb Sander Mateos

io_uring_cmd_prep() currently has two checks for whether
IORING_URING_CMD_FIXED and IORING_URING_CMD_MULTISHOT are both set in
uring_cmd_flags. Remove the second check.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 io_uring/uring_cmd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 3cfb5d51b88a..c8fd204f6892 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -200,12 +200,10 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 			return -EINVAL;
 		req->buf_index = READ_ONCE(sqe->buf_index);
 	}
 
 	if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) {
-		if (ioucmd->flags & IORING_URING_CMD_FIXED)
-			return -EINVAL;
 		if (!(req->flags & REQ_F_BUFFER_SELECT))
 			return -EINVAL;
 	} else {
 		if (req->flags & REQ_F_BUFFER_SELECT)
 			return -EINVAL;
-- 
2.45.2


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

* [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks
  2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
  2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
  2025-08-21 16:33 ` [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks Caleb Sander Mateos
@ 2025-08-21 16:33 ` Caleb Sander Mateos
  2025-08-22  1:18   ` Ming Lei
  2025-08-22  1:59 ` (subset) [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Jens Axboe
  3 siblings, 1 reply; 8+ messages in thread
From: Caleb Sander Mateos @ 2025-08-21 16:33 UTC (permalink / raw)
  To: Jens Axboe, Ming Lei; +Cc: io-uring, Caleb Sander Mateos

io_uring_cmd_prep() checks that REQ_F_BUFFER_SELECT is set in the
io_kiocb's flags iff IORING_URING_CMD_MULTISHOT is set in the SQE's
uring_cmd_flags. Consolidate the IORING_URING_CMD_MULTISHOT and
!IORING_URING_CMD_MULTISHOT branches into a single check that the
IORING_URING_CMD_MULTISHOT flag matches the REQ_F_BUFFER_SELECT flag.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 io_uring/uring_cmd.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index c8fd204f6892..482cc5be1f8d 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -199,17 +199,13 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 		if (ioucmd->flags & IORING_URING_CMD_MULTISHOT)
 			return -EINVAL;
 		req->buf_index = READ_ONCE(sqe->buf_index);
 	}
 
-	if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) {
-		if (!(req->flags & REQ_F_BUFFER_SELECT))
-			return -EINVAL;
-	} else {
-		if (req->flags & REQ_F_BUFFER_SELECT)
-			return -EINVAL;
-	}
+	if (!!(ioucmd->flags & IORING_URING_CMD_MULTISHOT) !=
+	    !!(req->flags & REQ_F_BUFFER_SELECT))
+		return -EINVAL;
 
 	ioucmd->cmd_op = READ_ONCE(sqe->cmd_op);
 
 	ac = io_uring_alloc_async_data(&req->ctx->cmd_cache, req);
 	if (!ac)
-- 
2.45.2


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

* Re: [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING
  2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
@ 2025-08-21 16:38   ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2025-08-21 16:38 UTC (permalink / raw)
  To: Caleb Sander Mateos, Ming Lei; +Cc: io-uring

On 8/21/25 10:33 AM, Caleb Sander Mateos wrote:
> io_uring_mshot_cmd_post_cqe() is declared with a different signature
> when CONFIG_IO_URING is defined than when it isn't. Match the
> !CONFIG_IO_URING definition's signature to the CONFIG_IO_URING one.

I screwed that up twice... I'll just fix this one up in-tree.

-- 
Jens Axboe


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

* Re: [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks
  2025-08-21 16:33 ` [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks Caleb Sander Mateos
@ 2025-08-22  1:16   ` Ming Lei
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lei @ 2025-08-22  1:16 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, io-uring

On Thu, Aug 21, 2025 at 10:33:07AM -0600, Caleb Sander Mateos wrote:
> io_uring_cmd_prep() currently has two checks for whether
> IORING_URING_CMD_FIXED and IORING_URING_CMD_MULTISHOT are both set in
> uring_cmd_flags. Remove the second check.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
> ---
>  io_uring/uring_cmd.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index 3cfb5d51b88a..c8fd204f6892 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -200,12 +200,10 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  			return -EINVAL;
>  		req->buf_index = READ_ONCE(sqe->buf_index);
>  	}
>  
>  	if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) {
> -		if (ioucmd->flags & IORING_URING_CMD_FIXED)
> -			return -EINVAL;
>  		if (!(req->flags & REQ_F_BUFFER_SELECT))
>  			return -EINVAL;
>  	} else {
>  		if (req->flags & REQ_F_BUFFER_SELECT)
>  			return -EINVAL;

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


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

* Re: [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks
  2025-08-21 16:33 ` [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks Caleb Sander Mateos
@ 2025-08-22  1:18   ` Ming Lei
  0 siblings, 0 replies; 8+ messages in thread
From: Ming Lei @ 2025-08-22  1:18 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, io-uring

On Thu, Aug 21, 2025 at 10:33:08AM -0600, Caleb Sander Mateos wrote:
> io_uring_cmd_prep() checks that REQ_F_BUFFER_SELECT is set in the
> io_kiocb's flags iff IORING_URING_CMD_MULTISHOT is set in the SQE's
> uring_cmd_flags. Consolidate the IORING_URING_CMD_MULTISHOT and
> !IORING_URING_CMD_MULTISHOT branches into a single check that the
> IORING_URING_CMD_MULTISHOT flag matches the REQ_F_BUFFER_SELECT flag.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
> ---
>  io_uring/uring_cmd.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index c8fd204f6892..482cc5be1f8d 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -199,17 +199,13 @@ int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>  		if (ioucmd->flags & IORING_URING_CMD_MULTISHOT)
>  			return -EINVAL;
>  		req->buf_index = READ_ONCE(sqe->buf_index);
>  	}
>  
> -	if (ioucmd->flags & IORING_URING_CMD_MULTISHOT) {
> -		if (!(req->flags & REQ_F_BUFFER_SELECT))
> -			return -EINVAL;
> -	} else {
> -		if (req->flags & REQ_F_BUFFER_SELECT)
> -			return -EINVAL;
> -	}
> +	if (!!(ioucmd->flags & IORING_URING_CMD_MULTISHOT) !=
> +	    !!(req->flags & REQ_F_BUFFER_SELECT))
> +		return -EINVAL;

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming


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

* Re: (subset) [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups
  2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
                   ` (2 preceding siblings ...)
  2025-08-21 16:33 ` [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks Caleb Sander Mateos
@ 2025-08-22  1:59 ` Jens Axboe
  3 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2025-08-22  1:59 UTC (permalink / raw)
  To: Ming Lei, Caleb Sander Mateos; +Cc: io-uring


On Thu, 21 Aug 2025 10:33:05 -0600, Caleb Sander Mateos wrote:
> One compile fix and a couple code simplifications for the recent series
> adding support for multishot uring_cmd buffer selection.
> 
> Caleb Sander Mateos (3):
>   io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING
>   io_uring/cmd: deduplicate uring_cmd_flags checks
>   io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks
> 
> [...]

Applied, thanks!

[2/3] io_uring/cmd: deduplicate uring_cmd_flags checks
      commit: a9a2fe50a46df5a494811dd3840ceaa652e79c9e
[3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks
      commit: ae6b528ace2fa1d0ed3daebbb39f76b9c7133861

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-08-22  1:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21 16:33 [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Caleb Sander Mateos
2025-08-21 16:33 ` [PATCH 1/3] io_uring/cmd: fix io_uring_mshot_cmd_post_cqe() for !CONFIG_IO_URING Caleb Sander Mateos
2025-08-21 16:38   ` Jens Axboe
2025-08-21 16:33 ` [PATCH 2/3] io_uring/cmd: deduplicate uring_cmd_flags checks Caleb Sander Mateos
2025-08-22  1:16   ` Ming Lei
2025-08-21 16:33 ` [PATCH 3/3] io_uring/cmd: consolidate REQ_F_BUFFER_SELECT checks Caleb Sander Mateos
2025-08-22  1:18   ` Ming Lei
2025-08-22  1:59 ` (subset) [PATCH 0/3] IORING_URING_CMD_MULTISHOT fixups Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.