Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
@ 2025-05-20 15:22 ` Pavel Begunkov
  2025-05-20 15:36   ` Anuj gupta
                     ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Pavel Begunkov @ 2025-05-20 15:22 UTC (permalink / raw)
  To: Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: asml.silence, linux-nvme, Jens Axboe, Kanchan Joshi, Anuj Gupta,
	dw

nvme already supports registered buffers for non-vectored io_uring
passthrough commands, enable it for the vectored mode as well. It takes
an iovec, each entry of which should contain a range within the same
registered buffer specificied in sqe->buf_index.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 drivers/nvme/host/ioctl.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index f29107d95ff2..0bfaf5d75461 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -493,13 +493,15 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 	d.timeout_ms = READ_ONCE(cmd->timeout_ms);
 
 	if (d.data_len && (ioucmd->flags & IORING_URING_CMD_FIXED)) {
-		/* fixedbufs is only for non-vectored io */
-		if (vec)
-			return -EINVAL;
+		int ddir = nvme_is_write(&c) ? WRITE : READ;
 
-		ret = io_uring_cmd_import_fixed(d.addr, d.data_len,
-			nvme_is_write(&c) ? WRITE : READ, &iter, ioucmd,
-			issue_flags);
+		if (vec)
+			ret = io_uring_cmd_import_fixed_vec(ioucmd,
+				u64_to_user_ptr(d.addr), d.data_len,
+				ddir, &iter, issue_flags);
+		else
+			ret = io_uring_cmd_import_fixed(d.addr, d.data_len,
+				ddir, &iter, ioucmd, issue_flags);
 		if (ret < 0)
 			return ret;
 
-- 
2.49.0



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

* Re: [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
  2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
@ 2025-05-20 15:36   ` Anuj gupta
  2025-05-20 15:52   ` Kanchan Joshi
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Anuj gupta @ 2025-05-20 15:36 UTC (permalink / raw)
  To: Pavel Begunkov
  Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme,
	Jens Axboe, Kanchan Joshi, Anuj Gupta, dw

Looks good to me.
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>


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

* Re: [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
  2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
  2025-05-20 15:36   ` Anuj gupta
@ 2025-05-20 15:52   ` Kanchan Joshi
  2025-05-20 15:55   ` Jens Axboe
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kanchan Joshi @ 2025-05-20 15:52 UTC (permalink / raw)
  To: Pavel Begunkov, Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, Jens Axboe, Anuj Gupta, dw

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


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

* Re: [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
  2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
  2025-05-20 15:36   ` Anuj gupta
  2025-05-20 15:52   ` Kanchan Joshi
@ 2025-05-20 15:55   ` Jens Axboe
  2025-05-20 19:18   ` Caleb Sander Mateos
  2025-05-21 11:09   ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-05-20 15:55 UTC (permalink / raw)
  To: Pavel Begunkov, Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, Kanchan Joshi, Anuj Gupta, dw

Reviewed-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe


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

* Re: [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
  2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
                     ` (2 preceding siblings ...)
  2025-05-20 15:55   ` Jens Axboe
@ 2025-05-20 19:18   ` Caleb Sander Mateos
  2025-05-21 11:09   ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Caleb Sander Mateos @ 2025-05-20 19:18 UTC (permalink / raw)
  To: Pavel Begunkov
  Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme,
	Jens Axboe, Kanchan Joshi, Anuj Gupta, dw

On Tue, May 20, 2025 at 8:30 AM Pavel Begunkov <asml.silence@gmail.com> wrote:
>
> nvme already supports registered buffers for non-vectored io_uring
> passthrough commands, enable it for the vectored mode as well. It takes
> an iovec, each entry of which should contain a range within the same
> registered buffer specificied in sqe->buf_index.
>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>

Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>


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

* Re: [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds
  2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
                     ` (3 preceding siblings ...)
  2025-05-20 19:18   ` Caleb Sander Mateos
@ 2025-05-21 11:09   ` Christoph Hellwig
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-05-21 11:09 UTC (permalink / raw)
  To: Pavel Begunkov
  Cc: Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme,
	Jens Axboe, Kanchan Joshi, Anuj Gupta, dw

Thanks,

applied to nvme-6.16.


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

end of thread, other threads:[~2025-05-21 11:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250520152111epcas5p27d108cbc62386e9e078c43bf6208f78a@epcas5p2.samsung.com>
2025-05-20 15:22 ` [PATCH 1/1] nvme: enable vectored registered bufs for passthrough cmds Pavel Begunkov
2025-05-20 15:36   ` Anuj gupta
2025-05-20 15:52   ` Kanchan Joshi
2025-05-20 15:55   ` Jens Axboe
2025-05-20 19:18   ` Caleb Sander Mateos
2025-05-21 11:09   ` Christoph Hellwig

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