public inbox for [email protected]
 help / color / mirror / Atom feed
From: Keith Busch <[email protected]>
To: <[email protected]>, <[email protected]>,
	<[email protected]>, <[email protected]>,
	<[email protected]>
Cc: <[email protected]>, <[email protected]>,
	<[email protected]>,
	Xinyu Zhang <[email protected]>,
	Keith Busch <[email protected]>
Subject: [PATCHv6 3/6] nvme: map uring_cmd data even if address is 0
Date: Wed, 26 Feb 2025 10:09:56 -0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Xinyu Zhang <[email protected]>

When using kernel registered bvec fixed buffers, the "address" is
actually the offset into the bvec rather than userspace address.
Therefore it can be 0.

We can skip checking whether the address is NULL before mapping
uring_cmd data. Bad userspace address will be handled properly later when
the user buffer is imported.

With this patch, we will be able to use the kernel registered bvec fixed
buffers in io_uring NVMe passthru with ublk zero-copy support.

Reviewed-by: Caleb Sander Mateos <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Signed-off-by: Xinyu Zhang <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
---
 drivers/nvme/host/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 5078d9aaf88fc..ecf136489044f 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -516,7 +516,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 		return PTR_ERR(req);
 	req->timeout = d.timeout_ms ? msecs_to_jiffies(d.timeout_ms) : 0;
 
-	if (d.addr && d.data_len) {
+	if (d.data_len) {
 		ret = nvme_map_user_request(req, d.addr,
 			d.data_len, nvme_to_user_ptr(d.metadata),
 			d.metadata_len, ioucmd, vec, issue_flags);
-- 
2.43.5


  parent reply	other threads:[~2025-02-26 18:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 18:09 [PATCHv6 0/6] ublk zero copy support Keith Busch
2025-02-26 18:09 ` [PATCHv6 1/5] io_uring: add support for kernel registered bvecs Keith Busch
2025-02-26 18:09 ` [PATCHv6 1/6] io_uring/rw: move fixed buffer import to issue path Keith Busch
2025-02-26 18:09 ` [PATCHv6 2/6] io_uring: add support for kernel registered bvecs Keith Busch
2025-02-26 18:09 ` [PATCHv6 2/5] nvme: map uring_cmd data even if address is 0 Keith Busch
2025-02-26 18:09 ` Keith Busch [this message]
2025-02-26 18:09 ` [PATCHv6 3/5] ublk: zc register/unregister bvec Keith Busch
2025-02-26 18:09 ` [PATCHv6 4/5] io_uring: add abstraction for buf_table rsrc data Keith Busch
2025-02-26 18:09 ` [PATCHv6 4/6] ublk: zc register/unregister bvec Keith Busch
2025-02-26 18:10 ` [PATCHv6 5/6] io_uring: add abstraction for buf_table rsrc data Keith Busch
2025-02-26 18:10 ` [PATCHv6 5/5] io_uring: cache nodes and mapped buffers Keith Busch
2025-02-26 18:10 ` [PATCHv6 6/6] " Keith Busch
2025-02-26 18:17 ` [PATCHv6 0/6] ublk zero copy support Keith Busch

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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