From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <sagi@grimberg.me>, <pmenzel@molgen.mpg.de>,
Keith Busch <kbusch@kernel.org>
Subject: [RFC PATCH] nvme: replace lazy sgl warn with informational message
Date: Thu, 30 Jan 2025 09:51:31 -0800 [thread overview]
Message-ID: <20250130175131.3613423-1-kbusch@meta.com> (raw)
From: Keith Busch <kbusch@kernel.org>
Instead of warning about the device's SGL capabilities the first time we
consider using them with a passthrough command, print out what the
device is capable of during initialization. While we're at it, print
other interesting capabilities that may be useful to know when you just
have a dmesg. The ouput format was inspired by other existing subsystems
like pci.
And example of the new message when used with a default qemu nvme
emulated device:
nvme nvme0: sgl+ meta-sgl+ sed- vwc+ apst- dsm+ wz+
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 20 ++++++++++++++++++++
drivers/nvme/host/ioctl.c | 11 ++---------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2bcd9f710cb65..7535a9b9d2afa 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3440,6 +3440,22 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
return ret;
}
+#define ENABLED(cond) ((cond) ? '+' : '-')
+
+static void nvme_ctrl_caps(struct nvme_ctrl *ctrl)
+{
+ dev_info(ctrl->device,
+ "sgl%c meta-sgl%c sed%c vwc%c apst%c dsm%c wz%c\n",
+ ENABLED(nvme_ctrl_sgl_supported(ctrl)),
+ ENABLED(nvme_ctrl_meta_sgl_supported(ctrl)),
+ ENABLED(!!ctrl->opal_dev),
+ ENABLED(ctrl->vwc & NVME_CTRL_VWC_PRESENT),
+ ENABLED(ctrl->apst_enabled),
+ ENABLED(ctrl->oncs & NVME_CTRL_ONCS_DSM),
+ ENABLED(ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES)
+ );
+}
+
/*
* Initialize the cached copies of the Identify data and various controller
* register in our nvme_ctrl structure. This should be called as soon as
@@ -3489,6 +3505,10 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
}
clear_bit(NVME_CTRL_DIRTY_CAPABILITY, &ctrl->flags);
+
+ if (!ctrl->identified)
+ nvme_ctrl_caps(ctrl);
+
ctrl->identified = true;
nvme_start_keep_alive(ctrl);
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index e8930146847af..2b5b650443229 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -125,15 +125,8 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
struct bio *bio = NULL;
int ret;
- if (!nvme_ctrl_sgl_supported(ctrl))
- dev_warn_once(ctrl->device, "using unchecked data buffer\n");
- if (has_metadata) {
- if (!supports_metadata)
- return -EINVAL;
- if (!nvme_ctrl_meta_sgl_supported(ctrl))
- dev_warn_once(ctrl->device,
- "using unchecked metadata buffer\n");
- }
+ if (has_metadata && !supports_metadata)
+ return -EINVAL;
if (ioucmd && (ioucmd->flags & IORING_URING_CMD_FIXED)) {
struct iov_iter iter;
--
2.43.5
next reply other threads:[~2025-01-30 18:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 17:51 Keith Busch [this message]
2025-01-31 7:48 ` [RFC PATCH] nvme: replace lazy sgl warn with informational message Christoph Hellwig
2025-01-31 8:06 ` Sagi Grimberg
2025-01-31 17:54 ` Keith Busch
2025-02-03 6:41 ` 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=20250130175131.3613423-1-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=pmenzel@molgen.mpg.de \
--cc=sagi@grimberg.me \
/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 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.