From: Jens Axboe <axboe@kernel.dk>
To: Xinyu Zhang <xizhang@purestorage.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Caleb Sander Mateos <csander@purestorage.com>
Subject: Re: [PATCH] nvme: map uring_cmd data even if address is 0
Date: Thu, 20 Feb 2025 17:55:01 -0700 [thread overview]
Message-ID: <0a11a42f-3476-46bd-b87a-a72d68344802@kernel.dk> (raw)
In-Reply-To: <20250220235101.119852-1-xizhang@purestorage.com>
On 2/20/25 4:51 PM, Xinyu Zhang wrote:
> 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 in
> https://lore.kernel.org/io-uring/20250218224229.837848-1-kbusch@meta.com/T/#u.
>
> Signed-off-by: Xinyu Zhang <xizhang@purestorage.com>
> Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
> ---
> 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 60383da86feda..724ab542b4c33 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -500,7 +500,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, 0, ioucmd, vec);
Looks good to me:
Reviewed-by: Jens Axboe <axboe@kernel.dk>
--
Jens Axboe
next prev parent reply other threads:[~2025-02-21 0:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 23:51 [PATCH] nvme: map uring_cmd data even if address is 0 Xinyu Zhang
2025-02-20 23:58 ` Keith Busch
2025-02-21 0:55 ` Jens Axboe [this message]
2025-02-24 14:33 ` Christoph Hellwig
2025-02-24 14:54 ` Keith Busch
2025-02-24 16:04 ` Christoph Hellwig
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 \
--in-reply-to=0a11a42f-3476-46bd-b87a-a72d68344802@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=xizhang@purestorage.com \
/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