* nvme/nvmet AEN and log page fixups v2
@ 2018-05-30 16:45 Christoph Hellwig
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
` (10 more replies)
0 siblings, 11 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Hi all,
this series started as prep work for ANA, but has grown a lot.
The idea is to make the AEN handling in the target closer to what
the standard says, and implement the changed namespaces list log page,
which is required to clear the namespace attribute notice event.
One the host side this just makes sure we actually have the events
we handle enabled using Set Features, and it fixes the handling of
the namespace attribute notice event so that it actually does get
cleared by issuing the log page.
Last but not last two block cleanups are thrown in so that we don't
print a pointless message when we delete a namespaces, and also
unexport the function printing said message as it should only be
called from the core code.
Changes from v1:
- don't copy garbage when more then 1024 namespaces changed
- filter out duplicates in the changed namespace list log page
- use the proper define for the supported events to initialize
OAES
- add the nvmet_aen_disabled helper from the ANA series
- allow the mandatory smart AENs in Set Features
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 01/12] nvme.h: untangle AEN notice definitions
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:21 ` Sagi Grimberg
` (2 more replies)
2018-05-30 16:45 ` [PATCH 02/12] nvme.h: add the changed namespace list log Christoph Hellwig
` (9 subsequent siblings)
10 siblings, 3 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Stop including the event type in the definitions for the notice type.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/host/core.c | 30 ++++++++++++++++++------------
include/linux/nvme.h | 8 ++++++--
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2c4cf65641a6..86cb78653155 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3321,6 +3321,21 @@ static void nvme_fw_act_work(struct work_struct *work)
nvme_get_fw_slot_info(ctrl);
}
+static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
+{
+ switch ((result & 0xff00) >> 8) {
+ case NVME_AER_NOTICE_NS_CHANGED:
+ dev_info(ctrl->device, "rescanning\n");
+ nvme_queue_scan(ctrl);
+ break;
+ case NVME_AER_NOTICE_FW_ACT_STARTING:
+ queue_work(nvme_wq, &ctrl->fw_act_work);
+ break;
+ default:
+ dev_warn(ctrl->device, "async event result %08x\n", result);
+ }
+}
+
void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
volatile union nvme_result *res)
{
@@ -3330,6 +3345,9 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
return;
switch (result & 0x7) {
+ case NVME_AER_NOTICE:
+ nvme_handle_aen_notice(ctrl, result);
+ break;
case NVME_AER_ERROR:
case NVME_AER_SMART:
case NVME_AER_CSS:
@@ -3339,18 +3357,6 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
default:
break;
}
-
- switch (result & 0xff07) {
- case NVME_AER_NOTICE_NS_CHANGED:
- dev_info(ctrl->device, "rescanning\n");
- nvme_queue_scan(ctrl);
- break;
- case NVME_AER_NOTICE_FW_ACT_STARTING:
- queue_work(nvme_wq, &ctrl->fw_act_work);
- break;
- default:
- dev_warn(ctrl->device, "async event result %08x\n", result);
- }
queue_work(nvme_wq, &ctrl->async_event_work);
}
EXPORT_SYMBOL_GPL(nvme_complete_async_event);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 4112e2bd747f..c37103a4ad38 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -436,10 +436,14 @@ enum {
enum {
NVME_AER_ERROR = 0,
NVME_AER_SMART = 1,
+ NVME_AER_NOTICE = 2,
NVME_AER_CSS = 6,
NVME_AER_VS = 7,
- NVME_AER_NOTICE_NS_CHANGED = 0x0002,
- NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102,
+};
+
+enum {
+ NVME_AER_NOTICE_NS_CHANGED = 0x00,
+ NVME_AER_NOTICE_FW_ACT_STARTING = 0x01,
};
struct nvme_lba_range_type {
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 02/12] nvme.h: add the changed namespace list log
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:22 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 03/12] nvme.h: add AER configuration symbols Christoph Hellwig
` (8 subsequent siblings)
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
include/linux/nvme.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index c37103a4ad38..7ce0f3cf4409 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -751,6 +751,7 @@ enum {
NVME_LOG_ERROR = 0x01,
NVME_LOG_SMART = 0x02,
NVME_LOG_FW_SLOT = 0x03,
+ NVME_LOG_CHANGED_NS = 0x04,
NVME_LOG_CMD_EFFECTS = 0x05,
NVME_LOG_DISC = 0x70,
NVME_LOG_RESERVATION = 0x80,
@@ -759,6 +760,8 @@ enum {
NVME_FWACT_ACTV = (2 << 3),
};
+#define NVME_MAX_CHANGED_NAMESPACES 1024
+
struct nvme_identify {
__u8 opcode;
__u8 flags;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 03/12] nvme.h: add AER configuration symbols
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
2018-05-30 16:45 ` [PATCH 02/12] nvme.h: add the changed namespace list log Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:23 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper Christoph Hellwig
` (7 subsequent siblings)
10 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block, Hannes Reinecke
From: Hannes Reinecke <hare@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
[hch: split from a larger patch]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
include/linux/nvme.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 7ce0f3cf4409..2950ce957656 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -446,6 +446,11 @@ enum {
NVME_AER_NOTICE_FW_ACT_STARTING = 0x01,
};
+enum {
+ NVME_AEN_CFG_NS_ATTR = 1 << 8,
+ NVME_AEN_CFG_FW_ACT = 1 << 9,
+};
+
struct nvme_lba_range_type {
__u8 type;
__u8 attributes;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (2 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 03/12] nvme.h: add AER configuration symbols Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:24 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 05/12] nvmet: split log page implementation Christoph Hellwig
` (6 subsequent siblings)
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Zeroes the SGL in the payload.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/target/core.c | 7 +++++++
drivers/nvme/target/nvmet.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 800aaf96ddcd..55c4bc693aa2 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -57,6 +57,13 @@ u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf, size_t len)
return 0;
}
+u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len)
+{
+ if (sg_zero_buffer(req->sg, req->sg_cnt, len, off) != len)
+ return NVME_SC_SGL_INVALID_DATA | NVME_SC_DNR;
+ return 0;
+}
+
static unsigned int nvmet_max_nsid(struct nvmet_subsys *subsys)
{
struct nvmet_ns *ns;
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 32ebffcf464c..768abe203298 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -330,6 +330,7 @@ u16 nvmet_copy_to_sgl(struct nvmet_req *req, off_t off, const void *buf,
size_t len);
u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf,
size_t len);
+u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len);
u32 nvmet_get_log_page_len(struct nvme_command *cmd);
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 05/12] nvmet: split log page implementation
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (3 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:25 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
` (5 subsequent siblings)
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Remove the common code to allocate a buffer and copy it into the SGL.
Instead the two no-op implementations just zero the SGL directly, and
the smart log allocates a buffer on its own. This prepares for the
more elaborate ANA log page.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/target/admin-cmd.c | 99 ++++++++++++---------------------
1 file changed, 36 insertions(+), 63 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 7f906e4ccc96..678a393f01de 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -32,6 +32,11 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd)
return len;
}
+static void nvmet_execute_get_log_page_noop(struct nvmet_req *req)
+{
+ nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len));
+}
+
static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
struct nvme_smart_log *slog)
{
@@ -97,74 +102,26 @@ static u16 nvmet_get_smart_log_all(struct nvmet_req *req,
return NVME_SC_SUCCESS;
}
-static u16 nvmet_get_smart_log(struct nvmet_req *req,
- struct nvme_smart_log *slog)
-{
- u16 status;
-
- WARN_ON(req == NULL || slog == NULL);
- if (req->cmd->get_log_page.nsid == cpu_to_le32(NVME_NSID_ALL))
- status = nvmet_get_smart_log_all(req, slog);
- else
- status = nvmet_get_smart_log_nsid(req, slog);
- return status;
-}
-
-static void nvmet_execute_get_log_page(struct nvmet_req *req)
+static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
{
- struct nvme_smart_log *smart_log;
- size_t data_len = nvmet_get_log_page_len(req->cmd);
- void *buf;
- u16 status = 0;
+ struct nvme_smart_log *log;
+ u16 status = NVME_SC_INTERNAL;
- buf = kzalloc(data_len, GFP_KERNEL);
- if (!buf) {
- status = NVME_SC_INTERNAL;
+ if (req->data_len != sizeof(*log))
goto out;
- }
- switch (req->cmd->get_log_page.lid) {
- case NVME_LOG_ERROR:
- /*
- * We currently never set the More bit in the status field,
- * so all error log entries are invalid and can be zeroed out.
- * This is called a minum viable implementation (TM) of this
- * mandatory log page.
- */
- break;
- case NVME_LOG_SMART:
- /*
- * XXX: fill out actual smart log
- *
- * We might have a hard time coming up with useful values for
- * many of the fields, and even when we have useful data
- * available (e.g. units or commands read/written) those aren't
- * persistent over power loss.
- */
- if (data_len != sizeof(*smart_log)) {
- status = NVME_SC_INTERNAL;
- goto err;
- }
- smart_log = buf;
- status = nvmet_get_smart_log(req, smart_log);
- if (status)
- goto err;
- break;
- case NVME_LOG_FW_SLOT:
- /*
- * We only support a single firmware slot which always is
- * active, so we can zero out the whole firmware slot log and
- * still claim to fully implement this mandatory log page.
- */
- break;
- default:
- BUG();
- }
+ log = kzalloc(sizeof(*log), GFP_KERNEL);
+ if (!log)
+ goto out;
- status = nvmet_copy_to_sgl(req, 0, buf, data_len);
+ if (req->cmd->get_log_page.nsid == cpu_to_le32(NVME_NSID_ALL))
+ status = nvmet_get_smart_log_all(req, log);
+ else
+ status = nvmet_get_smart_log_nsid(req, log);
+ if (status)
+ goto out;
-err:
- kfree(buf);
+ status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
out:
nvmet_req_complete(req, status);
}
@@ -572,9 +529,25 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
switch (cmd->get_log_page.lid) {
case NVME_LOG_ERROR:
+ /*
+ * We currently never set the More bit in the status
+ * field, so all error log entries are invalid and can
+ * be zeroed out. This is called a minum viable
+ * implementation (TM) of this mandatory log page.
+ */
+ req->execute = nvmet_execute_get_log_page_noop;
+ return 0;
case NVME_LOG_SMART:
+ req->execute = nvmet_execute_get_log_page_smart;
+ return 0;
case NVME_LOG_FW_SLOT:
- req->execute = nvmet_execute_get_log_page;
+ /*
+ * We only support a single firmware slot which always
+ * is active, so we can zero out the whole firmware slot
+ * log and still claim to fully implement this mandatory
+ * log page.
+ */
+ req->execute = nvmet_execute_get_log_page_noop;
return 0;
}
break;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (4 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 05/12] nvmet: split log page implementation Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 17:33 ` Daniel Verkamp
` (2 more replies)
2018-05-30 16:45 ` [PATCH 07/12] nvmet: Add AEN configuration support Christoph Hellwig
` (4 subsequent siblings)
10 siblings, 3 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Just keep a per-controller buffer of changed namespaces and copy it out
in the get log page implementation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/admin-cmd.c | 26 +++++++++++++++++
drivers/nvme/target/core.c | 50 +++++++++++++++++++++++++++------
drivers/nvme/target/nvmet.h | 3 ++
3 files changed, 70 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 678a393f01de..453d76db1647 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -126,6 +126,29 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
nvmet_req_complete(req, status);
}
+static void nvmet_execute_get_log_changed_ns(struct nvmet_req *req)
+{
+ struct nvmet_ctrl *ctrl = req->sq->ctrl;
+ u16 status = NVME_SC_INTERNAL;
+ size_t len;
+
+ if (req->data_len != NVME_MAX_CHANGED_NAMESPACES * sizeof(__le32))
+ goto out;
+
+ mutex_lock(&ctrl->lock);
+ if (ctrl->nr_changed_ns == U32_MAX)
+ len = sizeof(__le32);
+ else
+ len = ctrl->nr_changed_ns * sizeof(__le32);
+ status = nvmet_copy_to_sgl(req, 0, ctrl->changed_ns_list, len);
+ if (!status)
+ status = nvmet_zero_sgl(req, len, req->data_len - len);
+ ctrl->nr_changed_ns = 0;
+ mutex_unlock(&ctrl->lock);
+out:
+ nvmet_req_complete(req, status);
+}
+
static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
@@ -549,6 +572,9 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
*/
req->execute = nvmet_execute_get_log_page_noop;
return 0;
+ case NVME_LOG_CHANGED_NS:
+ req->execute = nvmet_execute_get_log_changed_ns;
+ return 0;
}
break;
case nvme_admin_identify:
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 55c4bc693aa2..99fcff757608 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -144,6 +144,36 @@ static void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
schedule_work(&ctrl->async_event_work);
}
+static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid)
+{
+ mutex_lock(&ctrl->lock);
+ if (ctrl->nr_changed_ns < NVME_MAX_CHANGED_NAMESPACES) {
+ u32 i;
+
+ for (i = 0; i < ctrl->nr_changed_ns; i++)
+ if (ctrl->changed_ns_list[i] == nsid)
+ goto out_unlock;
+ ctrl->changed_ns_list[ctrl->nr_changed_ns++] = nsid;
+ } else if (ctrl->nr_changed_ns == NVME_MAX_CHANGED_NAMESPACES) {
+ ctrl->changed_ns_list[0] = cpu_to_le32(0xffffffff);
+ ctrl->nr_changed_ns = U32_MAX;
+ }
+out_unlock:
+ mutex_unlock(&ctrl->lock);
+}
+
+static void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid)
+{
+ struct nvmet_ctrl *ctrl;
+
+ list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
+ nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid));
+ nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
+ NVME_AER_NOTICE_NS_CHANGED,
+ NVME_LOG_CHANGED_NS);
+ }
+}
+
int nvmet_register_transport(const struct nvmet_fabrics_ops *ops)
{
int ret = 0;
@@ -287,7 +317,6 @@ static void nvmet_ns_dev_disable(struct nvmet_ns *ns)
int nvmet_ns_enable(struct nvmet_ns *ns)
{
struct nvmet_subsys *subsys = ns->subsys;
- struct nvmet_ctrl *ctrl;
int ret = 0;
mutex_lock(&subsys->lock);
@@ -326,9 +355,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
list_add_tail_rcu(&ns->dev_link, &old->dev_link);
}
- list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
- nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 0, 0);
-
+ nvmet_ns_changed(subsys, ns->nsid);
ns->enabled = true;
ret = 0;
out_unlock:
@@ -342,7 +369,6 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
void nvmet_ns_disable(struct nvmet_ns *ns)
{
struct nvmet_subsys *subsys = ns->subsys;
- struct nvmet_ctrl *ctrl;
mutex_lock(&subsys->lock);
if (!ns->enabled)
@@ -368,9 +394,7 @@ void nvmet_ns_disable(struct nvmet_ns *ns)
percpu_ref_exit(&ns->ref);
mutex_lock(&subsys->lock);
- list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
- nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 0, 0);
-
+ nvmet_ns_changed(subsys, ns->nsid);
nvmet_ns_dev_disable(ns);
out_unlock:
mutex_unlock(&subsys->lock);
@@ -832,11 +856,16 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
kref_init(&ctrl->ref);
ctrl->subsys = subsys;
+ ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES,
+ sizeof(__le32), GFP_KERNEL);
+ if (!ctrl->changed_ns_list)
+ goto out_free_ctrl;
+
ctrl->cqs = kcalloc(subsys->max_qid + 1,
sizeof(struct nvmet_cq *),
GFP_KERNEL);
if (!ctrl->cqs)
- goto out_free_ctrl;
+ goto out_free_changed_ns_list;
ctrl->sqs = kcalloc(subsys->max_qid + 1,
sizeof(struct nvmet_sq *),
@@ -894,6 +923,8 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
kfree(ctrl->sqs);
out_free_cqs:
kfree(ctrl->cqs);
+out_free_changed_ns_list:
+ kfree(ctrl->changed_ns_list);
out_free_ctrl:
kfree(ctrl);
out_put_subsystem:
@@ -920,6 +951,7 @@ static void nvmet_ctrl_free(struct kref *ref)
kfree(ctrl->sqs);
kfree(ctrl->cqs);
+ kfree(ctrl->changed_ns_list);
kfree(ctrl);
nvmet_subsys_put(subsys);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 768abe203298..8cdc1e550396 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -135,6 +135,9 @@ struct nvmet_ctrl {
const struct nvmet_fabrics_ops *ops;
+ __le32 *changed_ns_list;
+ u32 nr_changed_ns;
+
char subsysnqn[NVMF_NQN_FIELD_LEN];
char hostnqn[NVMF_NQN_FIELD_LEN];
};
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 07/12] nvmet: Add AEN configuration support
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (5 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:30 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 09/12] nvme: submit AEN event configuration on startup Christoph Hellwig
` (3 subsequent siblings)
10 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block, Hannes Reinecke
AEN configuration via the 'Get Features' and 'Set Features' admin
command is mandatory, so we should be implemeting handling for it.
Signed-off-by: Hannes Reinecke <hare@suse.com>
[hch: use WRITE_ONCE, check for invalid values]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/admin-cmd.c | 15 +++++++++++++--
drivers/nvme/target/core.c | 3 +++
drivers/nvme/target/nvmet.h | 16 ++++++++++++++++
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 453d76db1647..4e269a8c8dbe 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -189,7 +189,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
id->ver = cpu_to_le32(ctrl->subsys->ver);
/* XXX: figure out what to do about RTD3R/RTD3 */
- id->oaes = cpu_to_le32(1 << 8);
+ id->oaes = cpu_to_le32(NVMET_AEN_CFG_OPTIONAL);
id->ctratt = cpu_to_le32(1 << 0);
id->oacs = 0;
@@ -441,6 +441,16 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
nvmet_set_result(req, req->sq->ctrl->kato);
break;
+ case NVME_FEAT_ASYNC_EVENT:
+ val32 = le32_to_cpu(req->cmd->common.cdw10[1]);
+ if (val32 & ~NVMET_AEN_CFG_ALL) {
+ status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
+ break;
+ }
+
+ WRITE_ONCE(req->sq->ctrl->aen_enabled, val32);
+ nvmet_set_result(req, val32);
+ break;
case NVME_FEAT_HOST_ID:
status = NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
break;
@@ -479,9 +489,10 @@ static void nvmet_execute_get_features(struct nvmet_req *req)
break;
case NVME_FEAT_WRITE_ATOMIC:
break;
+#endif
case NVME_FEAT_ASYNC_EVENT:
+ nvmet_set_result(req, READ_ONCE(req->sq->ctrl->aen_enabled));
break;
-#endif
case NVME_FEAT_VOLATILE_WC:
nvmet_set_result(req, 1);
break;
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 99fcff757608..b2da65aec8b7 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -168,6 +168,8 @@ static void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid)
list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid));
+ if (!(READ_ONCE(ctrl->aen_enabled) & NVME_AEN_CFG_NS_ATTR))
+ continue;
nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
NVME_AER_NOTICE_NS_CHANGED,
NVME_LOG_CHANGED_NS);
@@ -855,6 +857,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
kref_init(&ctrl->ref);
ctrl->subsys = subsys;
+ WRITE_ONCE(ctrl->aen_enabled, NVMET_AEN_CFG_OPTIONAL);
ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES,
sizeof(__le32), GFP_KERNEL);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 8cdc1e550396..f4d16d9b3582 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -30,6 +30,21 @@
#define NVMET_ASYNC_EVENTS 4
#define NVMET_ERROR_LOG_SLOTS 128
+
+/*
+ * Supported optional AENs:
+ */
+#define NVMET_AEN_CFG_OPTIONAL \
+ NVME_AEN_CFG_NS_ATTR
+
+/*
+ * Plus mandatory SMART AENs (we'll never send them, but allow enabling them):
+ */
+#define NVMET_AEN_CFG_ALL \
+ (NVME_SMART_CRIT_SPARE | NVME_SMART_CRIT_TEMPERATURE | \
+ NVME_SMART_CRIT_RELIABILITY | NVME_SMART_CRIT_MEDIA | \
+ NVME_SMART_CRIT_VOLATILE_MEMORY | NVMET_AEN_CFG_OPTIONAL)
+
/* Helper Macros when NVMe error is NVME_SC_CONNECT_INVALID_PARAM
* The 16 bit shift is to set IATTR bit to 1, which means offending
* offset starts in the data section of connect()
@@ -123,6 +138,7 @@ struct nvmet_ctrl {
u16 cntlid;
u32 kato;
+ u32 aen_enabled;
struct nvmet_req *async_event_cmds[NVMET_ASYNC_EVENTS];
unsigned int nr_async_event_cmds;
struct list_head async_events;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 09/12] nvme: submit AEN event configuration on startup
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (6 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 07/12] nvmet: Add AEN configuration support Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:31 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 10/12] nvme: mark nvme_queue_scan static Christoph Hellwig
` (2 subsequent siblings)
10 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block, Hannes Reinecke
From: Hannes Reinecke <hare@suse.de>
We should register for AEN events; some law-abiding targets might
not be sending us AENs otherwise.
Signed-off-by: Hannes Reinecke <hare@suse.com>
[hch: slight cleanups]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/host/core.c | 17 +++++++++++++++++
drivers/nvme/host/nvme.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 86cb78653155..c0bc76d98194 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1030,6 +1030,21 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
}
EXPORT_SYMBOL_GPL(nvme_set_queue_count);
+#define NVME_AEN_SUPPORTED \
+ (NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT)
+
+static void nvme_enable_aen(struct nvme_ctrl *ctrl)
+{
+ u32 result;
+ int status;
+
+ status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
+ ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
+ if (status)
+ dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
+ ctrl->oaes & NVME_AEN_SUPPORTED);
+}
+
static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
{
struct nvme_user_io io;
@@ -2347,6 +2362,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->oacs = le16_to_cpu(id->oacs);
ctrl->oncs = le16_to_cpup(&id->oncs);
+ ctrl->oaes = le32_to_cpu(id->oaes);
atomic_set(&ctrl->abort_limit, id->acl + 1);
ctrl->vwc = id->vwc;
ctrl->cntlid = le16_to_cpup(&id->cntlid);
@@ -3379,6 +3395,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
if (ctrl->queue_count > 1) {
nvme_queue_scan(ctrl);
+ nvme_enable_aen(ctrl);
queue_work(nvme_wq, &ctrl->async_event_work);
nvme_start_queues(ctrl);
}
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index ec6e4acc4d48..dcf9e9592c1a 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -176,6 +176,7 @@ struct nvme_ctrl {
u16 kas;
u8 npss;
u8 apsta;
+ u32 oaes;
u32 aen_result;
unsigned int shutdown_timeout;
unsigned int kato;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 10/12] nvme: mark nvme_queue_scan static
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (7 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 09/12] nvme: submit AEN event configuration on startup Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:31 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs Christoph Hellwig
2018-05-30 16:46 ` [PATCH 12/12] nvme: limit warnings from nvme_identify_ns Christoph Hellwig
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
And move it toward the top of the file to avoid a forward declaration.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/host/core.c | 19 +++++++++----------
drivers/nvme/host/nvme.h | 1 -
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c0bc76d98194..06cd04dcffbc 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -100,6 +100,15 @@ static struct class *nvme_subsys_class;
static void nvme_ns_remove(struct nvme_ns *ns);
static int nvme_revalidate_disk(struct gendisk *disk);
+static void nvme_queue_scan(struct nvme_ctrl *ctrl)
+{
+ /*
+ * Only new queue scan work when admin and IO queues are both alive
+ */
+ if (ctrl->state == NVME_CTRL_LIVE)
+ queue_work(nvme_wq, &ctrl->scan_work);
+}
+
int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
{
if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
@@ -3214,16 +3223,6 @@ static void nvme_scan_work(struct work_struct *work)
kfree(id);
}
-void nvme_queue_scan(struct nvme_ctrl *ctrl)
-{
- /*
- * Only new queue scan work when admin and IO queues are both alive
- */
- if (ctrl->state == NVME_CTRL_LIVE)
- queue_work(nvme_wq, &ctrl->scan_work);
-}
-EXPORT_SYMBOL_GPL(nvme_queue_scan);
-
/*
* This function iterates the namespace list unlocked to allow recovery from
* controller failure. It is up to the caller to ensure the namespace list is
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index dcf9e9592c1a..11681278fdf6 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -395,7 +395,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl);
void nvme_put_ctrl(struct nvme_ctrl *ctrl);
int nvme_init_identify(struct nvme_ctrl *ctrl);
-void nvme_queue_scan(struct nvme_ctrl *ctrl);
void nvme_remove_namespaces(struct nvme_ctrl *ctrl);
int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t len,
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (8 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 10/12] nvme: mark nvme_queue_scan static Christoph Hellwig
@ 2018-05-30 16:45 ` Christoph Hellwig
2018-05-30 21:34 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
2018-05-30 16:46 ` [PATCH 12/12] nvme: limit warnings from nvme_identify_ns Christoph Hellwig
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:45 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
Per section 5.2 we need to issue the corresponding log page to clear an
AEN, so for a namespace data changed AEN we need to read the changed
namespace list log. And once we read that log anyway we might as well
use it to optimize the rescan.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/core.c | 51 ++++++++++++++++++++++++++++++++++++----
drivers/nvme/host/nvme.h | 2 ++
2 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 06cd04dcffbc..1ae77428a1a5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3194,6 +3194,42 @@ static void nvme_scan_ns_sequential(struct nvme_ctrl *ctrl, unsigned nn)
nvme_remove_invalid_namespaces(ctrl, nn);
}
+static bool nvme_scan_changed_ns_log(struct nvme_ctrl *ctrl)
+{
+ size_t log_size = NVME_MAX_CHANGED_NAMESPACES * sizeof(__le32);
+ __le32 *log;
+ int error, i;
+ bool ret = false;
+
+ log = kzalloc(log_size, GFP_KERNEL);
+ if (!log)
+ return false;
+
+ error = nvme_get_log(ctrl, NVME_LOG_CHANGED_NS, log, log_size);
+ if (error) {
+ dev_warn(ctrl->device,
+ "reading changed ns log failed: %d\n", error);
+ goto out_free_log;
+ }
+
+ if (log[0] == cpu_to_le32(0xffffffff))
+ goto out_free_log;
+
+ for (i = 0; i < NVME_MAX_CHANGED_NAMESPACES; i++) {
+ u32 nsid = le32_to_cpu(log[i]);
+
+ if (nsid == 0)
+ break;
+ dev_info(ctrl->device, "rescanning namespace %d.\n", nsid);
+ nvme_validate_ns(ctrl, nsid);
+ }
+ ret = true;
+
+out_free_log:
+ kfree(log);
+ return ret;
+}
+
static void nvme_scan_work(struct work_struct *work)
{
struct nvme_ctrl *ctrl =
@@ -3206,6 +3242,12 @@ static void nvme_scan_work(struct work_struct *work)
WARN_ON_ONCE(!ctrl->tagset);
+ if (test_and_clear_bit(EVENT_NS_CHANGED, &ctrl->events)) {
+ if (nvme_scan_changed_ns_log(ctrl))
+ goto out_sort_namespaces;
+ dev_info(ctrl->device, "rescanning namespaces.\n");
+ }
+
if (nvme_identify_ctrl(ctrl, &id))
return;
@@ -3213,14 +3255,15 @@ static void nvme_scan_work(struct work_struct *work)
if (ctrl->vs >= NVME_VS(1, 1, 0) &&
!(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) {
if (!nvme_scan_ns_list(ctrl, nn))
- goto done;
+ goto out_free_id;
}
nvme_scan_ns_sequential(ctrl, nn);
- done:
+out_free_id:
+ kfree(id);
+out_sort_namespaces:
down_write(&ctrl->namespaces_rwsem);
list_sort(NULL, &ctrl->namespaces, ns_cmp);
up_write(&ctrl->namespaces_rwsem);
- kfree(id);
}
/*
@@ -3340,7 +3383,7 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
{
switch ((result & 0xff00) >> 8) {
case NVME_AER_NOTICE_NS_CHANGED:
- dev_info(ctrl->device, "rescanning\n");
+ set_bit(EVENT_NS_CHANGED, &ctrl->events);
nvme_queue_scan(ctrl);
break;
case NVME_AER_NOTICE_FW_ACT_STARTING:
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 11681278fdf6..07e8bfe705c6 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -189,6 +189,8 @@ struct nvme_ctrl {
struct delayed_work ka_work;
struct nvme_command ka_cmd;
struct work_struct fw_act_work;
+#define EVENT_NS_CHANGED (1 << 0)
+ unsigned long events;
/* Power saving configuration */
u64 ps_max_latency_us;
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 12/12] nvme: limit warnings from nvme_identify_ns
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
` (9 preceding siblings ...)
2018-05-30 16:45 ` [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs Christoph Hellwig
@ 2018-05-30 16:46 ` Christoph Hellwig
2018-05-30 21:35 ` Sagi Grimberg
2018-06-04 6:17 ` Hannes Reinecke
10 siblings, 2 replies; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-30 16:46 UTC (permalink / raw)
To: linux-nvme
Cc: Jens Axboe, Keith Busch, Sagi Grimberg, Hannes Reinecke,
linux-block
When rescanning namespaces after an AEN we will issue Identify Namespace
comands to namespaces that have gone away, so don't warn for this specific
case.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/host/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1ae77428a1a5..7ad3cfc9d4e1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -984,7 +984,9 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
error = nvme_submit_sync_cmd(ctrl->admin_q, &c, id, sizeof(*id));
if (error) {
- dev_warn(ctrl->device, "Identify namespace failed\n");
+ /* don't warn on a namespace that has gone away */
+ if (error < 0 || ((error & ~NVME_SC_DNR) != NVME_SC_INVALID_NS))
+ dev_warn(ctrl->device, "Identify namespace failed\n");
kfree(id);
return NULL;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
@ 2018-05-30 17:33 ` Daniel Verkamp
2018-05-31 16:25 ` Christoph Hellwig
2018-05-30 21:28 ` Sagi Grimberg
2018-06-04 6:15 ` Hannes Reinecke
2 siblings, 1 reply; 35+ messages in thread
From: Daniel Verkamp @ 2018-05-30 17:33 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, linux-block, Sagi Grimberg,
Hannes Reinecke
On 05/30/2018 09:45 AM, Christoph Hellwig wrote:
> Just keep a per-controller buffer of changed namespaces and copy it out
> in the get log page implementation.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
[...]
> +static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid)
> +{
> + mutex_lock(&ctrl->lock);
> + if (ctrl->nr_changed_ns < NVME_MAX_CHANGED_NAMESPACES) {
Minor nitpick here: if ctrlr->nr_changed_ns is exactly
NVME_MAX_CHANGED_NAMESPACES and the new nsid is already in the list,
this will skip down to the 0xffffffff case below, even though it could
have just left the list as-is.
I don't know if this is a problem in practice; reporting 0xffffffff is
probably always safe, since the host will presumably treat that as
"rescan everything".
> + u32 i;
> +
> + for (i = 0; i < ctrl->nr_changed_ns; i++)
> + if (ctrl->changed_ns_list[i] == nsid)
> + goto out_unlock;
> + ctrl->changed_ns_list[ctrl->nr_changed_ns++] = nsid;
> + } else if (ctrl->nr_changed_ns == NVME_MAX_CHANGED_NAMESPACES) {
> + ctrl->changed_ns_list[0] = cpu_to_le32(0xffffffff);
> + ctrl->nr_changed_ns = U32_MAX;
> + }
> +out_unlock:
> + mutex_unlock(&ctrl->lock);
> +}
Thanks,
-- Daniel
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 01/12] nvme.h: untangle AEN notice definitions
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
@ 2018-05-30 21:21 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
2018-06-04 6:13 ` Hannes Reinecke
2 siblings, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:21 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, linux-block, Hannes Reinecke
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 02/12] nvme.h: add the changed namespace list log
2018-05-30 16:45 ` [PATCH 02/12] nvme.h: add the changed namespace list log Christoph Hellwig
@ 2018-05-30 21:22 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:22 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 03/12] nvme.h: add AER configuration symbols
2018-05-30 16:45 ` [PATCH 03/12] nvme.h: add AER configuration symbols Christoph Hellwig
@ 2018-05-30 21:23 ` Sagi Grimberg
0 siblings, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:23 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block,
Hannes Reinecke
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper
2018-05-30 16:45 ` [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper Christoph Hellwig
@ 2018-05-30 21:24 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:24 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
> +u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len)
Would personally prefer nvmet_clear_sgl, but not hard headed on it,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 05/12] nvmet: split log page implementation
2018-05-30 16:45 ` [PATCH 05/12] nvmet: split log page implementation Christoph Hellwig
@ 2018-05-30 21:25 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:25 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
2018-05-30 17:33 ` Daniel Verkamp
@ 2018-05-30 21:28 ` Sagi Grimberg
2018-06-04 6:15 ` Hannes Reinecke
2 siblings, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:28 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 07/12] nvmet: Add AEN configuration support
2018-05-30 16:45 ` [PATCH 07/12] nvmet: Add AEN configuration support Christoph Hellwig
@ 2018-05-30 21:30 ` Sagi Grimberg
0 siblings, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:30 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block,
Hannes Reinecke
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 09/12] nvme: submit AEN event configuration on startup
2018-05-30 16:45 ` [PATCH 09/12] nvme: submit AEN event configuration on startup Christoph Hellwig
@ 2018-05-30 21:31 ` Sagi Grimberg
0 siblings, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:31 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block,
Hannes Reinecke
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 10/12] nvme: mark nvme_queue_scan static
2018-05-30 16:45 ` [PATCH 10/12] nvme: mark nvme_queue_scan static Christoph Hellwig
@ 2018-05-30 21:31 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:31 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs
2018-05-30 16:45 ` [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs Christoph Hellwig
@ 2018-05-30 21:34 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:34 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/12] nvme: limit warnings from nvme_identify_ns
2018-05-30 16:46 ` [PATCH 12/12] nvme: limit warnings from nvme_identify_ns Christoph Hellwig
@ 2018-05-30 21:35 ` Sagi Grimberg
2018-06-04 6:17 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Sagi Grimberg @ 2018-05-30 21:35 UTC (permalink / raw)
To: Christoph Hellwig, linux-nvme
Cc: Jens Axboe, Keith Busch, Hannes Reinecke, linux-block
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-30 17:33 ` Daniel Verkamp
@ 2018-05-31 16:25 ` Christoph Hellwig
2018-05-31 16:36 ` Daniel Verkamp
0 siblings, 1 reply; 35+ messages in thread
From: Christoph Hellwig @ 2018-05-31 16:25 UTC (permalink / raw)
To: Daniel Verkamp
Cc: Christoph Hellwig, linux-nvme, Jens Axboe, Keith Busch,
linux-block, Sagi Grimberg, Hannes Reinecke
On Wed, May 30, 2018 at 10:33:49AM -0700, Daniel Verkamp wrote:
> Minor nitpick here: if ctrlr->nr_changed_ns is exactly
> NVME_MAX_CHANGED_NAMESPACES and the new nsid is already in the list,
> this will skip down to the 0xffffffff case below, even though it could
> have just left the list as-is.
>
> I don't know if this is a problem in practice; reporting 0xffffffff is
> probably always safe, since the host will presumably treat that as
> "rescan everything".
It probably doesn't matter, but it turns doing this propely actually
looks cleaner as well:
---
>From d4baf4068220a90ecf67309d01ece5d0aadd952e Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Fri, 25 May 2018 17:16:09 +0200
Subject: nvmet: implement the changed namespaces log
Just keep a per-controller buffer of changed namespaces and copy it out
in the get log page implementation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/admin-cmd.c | 26 +++++++++++++++
drivers/nvme/target/core.c | 56 +++++++++++++++++++++++++++------
drivers/nvme/target/nvmet.h | 3 ++
3 files changed, 76 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 25b4e4ea69c8..7677b7b188ea 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -126,6 +126,29 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
nvmet_req_complete(req, status);
}
+static void nvmet_execute_get_log_changed_ns(struct nvmet_req *req)
+{
+ struct nvmet_ctrl *ctrl = req->sq->ctrl;
+ u16 status = NVME_SC_INTERNAL;
+ size_t len;
+
+ if (req->data_len != NVME_MAX_CHANGED_NAMESPACES * sizeof(__le32))
+ goto out;
+
+ mutex_lock(&ctrl->lock);
+ if (ctrl->nr_changed_ns == U32_MAX)
+ len = sizeof(__le32);
+ else
+ len = ctrl->nr_changed_ns * sizeof(__le32);
+ status = nvmet_copy_to_sgl(req, 0, ctrl->changed_ns_list, len);
+ if (!status)
+ status = nvmet_zero_sgl(req, len, req->data_len - len);
+ ctrl->nr_changed_ns = 0;
+ mutex_unlock(&ctrl->lock);
+out:
+ nvmet_req_complete(req, status);
+}
+
static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
@@ -546,6 +569,9 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
*/
req->execute = nvmet_execute_get_log_page_noop;
return 0;
+ case NVME_LOG_CHANGED_NS:
+ req->execute = nvmet_execute_get_log_changed_ns;
+ return 0;
}
break;
case nvme_admin_identify:
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 55c4bc693aa2..4fe88e15c641 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -144,6 +144,42 @@ static void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
schedule_work(&ctrl->async_event_work);
}
+static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid)
+{
+ u32 i;
+
+ mutex_lock(&ctrl->lock);
+ if (ctrl->nr_changed_ns > NVME_MAX_CHANGED_NAMESPACES)
+ goto out_unlock;
+
+ for (i = 0; i < ctrl->nr_changed_ns; i++) {
+ if (ctrl->changed_ns_list[i] == nsid)
+ goto out_unlock;
+ }
+
+ if (ctrl->nr_changed_ns == NVME_MAX_CHANGED_NAMESPACES) {
+ ctrl->changed_ns_list[0] = cpu_to_le32(0xffffffff);
+ ctrl->nr_changed_ns = U32_MAX;
+ goto out_unlock;
+ }
+
+ ctrl->changed_ns_list[ctrl->nr_changed_ns++] = nsid;
+out_unlock:
+ mutex_unlock(&ctrl->lock);
+}
+
+static void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid)
+{
+ struct nvmet_ctrl *ctrl;
+
+ list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
+ nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid));
+ nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
+ NVME_AER_NOTICE_NS_CHANGED,
+ NVME_LOG_CHANGED_NS);
+ }
+}
+
int nvmet_register_transport(const struct nvmet_fabrics_ops *ops)
{
int ret = 0;
@@ -287,7 +323,6 @@ static void nvmet_ns_dev_disable(struct nvmet_ns *ns)
int nvmet_ns_enable(struct nvmet_ns *ns)
{
struct nvmet_subsys *subsys = ns->subsys;
- struct nvmet_ctrl *ctrl;
int ret = 0;
mutex_lock(&subsys->lock);
@@ -326,9 +361,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
list_add_tail_rcu(&ns->dev_link, &old->dev_link);
}
- list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
- nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 0, 0);
-
+ nvmet_ns_changed(subsys, ns->nsid);
ns->enabled = true;
ret = 0;
out_unlock:
@@ -342,7 +375,6 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
void nvmet_ns_disable(struct nvmet_ns *ns)
{
struct nvmet_subsys *subsys = ns->subsys;
- struct nvmet_ctrl *ctrl;
mutex_lock(&subsys->lock);
if (!ns->enabled)
@@ -368,9 +400,7 @@ void nvmet_ns_disable(struct nvmet_ns *ns)
percpu_ref_exit(&ns->ref);
mutex_lock(&subsys->lock);
- list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
- nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE, 0, 0);
-
+ nvmet_ns_changed(subsys, ns->nsid);
nvmet_ns_dev_disable(ns);
out_unlock:
mutex_unlock(&subsys->lock);
@@ -832,11 +862,16 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
kref_init(&ctrl->ref);
ctrl->subsys = subsys;
+ ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES,
+ sizeof(__le32), GFP_KERNEL);
+ if (!ctrl->changed_ns_list)
+ goto out_free_ctrl;
+
ctrl->cqs = kcalloc(subsys->max_qid + 1,
sizeof(struct nvmet_cq *),
GFP_KERNEL);
if (!ctrl->cqs)
- goto out_free_ctrl;
+ goto out_free_changed_ns_list;
ctrl->sqs = kcalloc(subsys->max_qid + 1,
sizeof(struct nvmet_sq *),
@@ -894,6 +929,8 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
kfree(ctrl->sqs);
out_free_cqs:
kfree(ctrl->cqs);
+out_free_changed_ns_list:
+ kfree(ctrl->changed_ns_list);
out_free_ctrl:
kfree(ctrl);
out_put_subsystem:
@@ -920,6 +957,7 @@ static void nvmet_ctrl_free(struct kref *ref)
kfree(ctrl->sqs);
kfree(ctrl->cqs);
+ kfree(ctrl->changed_ns_list);
kfree(ctrl);
nvmet_subsys_put(subsys);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 768abe203298..8cdc1e550396 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -135,6 +135,9 @@ struct nvmet_ctrl {
const struct nvmet_fabrics_ops *ops;
+ __le32 *changed_ns_list;
+ u32 nr_changed_ns;
+
char subsysnqn[NVMF_NQN_FIELD_LEN];
char hostnqn[NVMF_NQN_FIELD_LEN];
};
--
2.17.0
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-31 16:25 ` Christoph Hellwig
@ 2018-05-31 16:36 ` Daniel Verkamp
0 siblings, 0 replies; 35+ messages in thread
From: Daniel Verkamp @ 2018-05-31 16:36 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, linux-block, Sagi Grimberg,
Hannes Reinecke
On 05/31/2018 09:25 AM, Christoph Hellwig wrote:
> On Wed, May 30, 2018 at 10:33:49AM -0700, Daniel Verkamp wrote:
>> Minor nitpick here: if ctrlr->nr_changed_ns is exactly
>> NVME_MAX_CHANGED_NAMESPACES and the new nsid is already in the list,
>> this will skip down to the 0xffffffff case below, even though it could
>> have just left the list as-is.
>>
>> I don't know if this is a problem in practice; reporting 0xffffffff is
>> probably always safe, since the host will presumably treat that as
>> "rescan everything".
>
> It probably doesn't matter, but it turns doing this propely actually
> looks cleaner as well:
>
> ---
> From d4baf4068220a90ecf67309d01ece5d0aadd952e Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Fri, 25 May 2018 17:16:09 +0200
> Subject: nvmet: implement the changed namespaces log
Agreed, this version looks good to me:
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Thanks,
-- Daniel
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 01/12] nvme.h: untangle AEN notice definitions
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
2018-05-30 21:21 ` Sagi Grimberg
@ 2018-06-04 6:13 ` Hannes Reinecke
2018-06-04 6:13 ` Hannes Reinecke
2 siblings, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:13 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:49 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Stop including the event type in the definitions for the notice type.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/host/core.c | 30 ++++++++++++++++++------------
> include/linux/nvme.h | 8 ++++++--
> 2 files changed, 24 insertions(+), 14 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 01/12] nvme.h: untangle AEN notice definitions
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
2018-05-30 21:21 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
@ 2018-06-04 6:13 ` Hannes Reinecke
2 siblings, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:13 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:49 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Stop including the event type in the definitions for the notice type.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/host/core.c | 30 ++++++++++++++++++------------
> include/linux/nvme.h | 8 ++++++--
> 2 files changed, 24 insertions(+), 14 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 02/12] nvme.h: add the changed namespace list log
2018-05-30 16:45 ` [PATCH 02/12] nvme.h: add the changed namespace list log Christoph Hellwig
2018-05-30 21:22 ` Sagi Grimberg
@ 2018-06-04 6:13 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:13 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:50 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> include/linux/nvme.h | 3 +++
> 1 file changed, 3 insertions(+)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper
2018-05-30 16:45 ` [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper Christoph Hellwig
2018-05-30 21:24 ` Sagi Grimberg
@ 2018-06-04 6:14 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:14 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:52 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Zeroes the SGL in the payload.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/target/core.c | 7 +++++++
> drivers/nvme/target/nvmet.h | 1 +
> 2 files changed, 8 insertions(+)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 05/12] nvmet: split log page implementation
2018-05-30 16:45 ` [PATCH 05/12] nvmet: split log page implementation Christoph Hellwig
2018-05-30 21:25 ` Sagi Grimberg
@ 2018-06-04 6:14 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:14 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:53 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Remove the common code to allocate a buffer and copy it into the SGL.
> Instead the two no-op implementations just zero the SGL directly, and
> the smart log allocates a buffer on its own. This prepares for the
> more elaborate ANA log page.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/target/admin-cmd.c | 99
> ++++++++++++--------------------- 1 file changed, 36 insertions(+),
> 63 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 06/12] nvmet: implement the changed namespaces log
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
2018-05-30 17:33 ` Daniel Verkamp
2018-05-30 21:28 ` Sagi Grimberg
@ 2018-06-04 6:15 ` Hannes Reinecke
2 siblings, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:15 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:54 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Just keep a per-controller buffer of changed namespaces and copy it
> out in the get log page implementation.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/nvme/target/admin-cmd.c | 26 +++++++++++++++++
> drivers/nvme/target/core.c | 50
> +++++++++++++++++++++++++++------ drivers/nvme/target/nvmet.h |
> 3 ++ 3 files changed, 70 insertions(+), 9 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 10/12] nvme: mark nvme_queue_scan static
2018-05-30 16:45 ` [PATCH 10/12] nvme: mark nvme_queue_scan static Christoph Hellwig
2018-05-30 21:31 ` Sagi Grimberg
@ 2018-06-04 6:16 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:16 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:58 +0200
Christoph Hellwig <hch@lst.de> wrote:
> And move it toward the top of the file to avoid a forward declaration.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/host/core.c | 19 +++++++++----------
> drivers/nvme/host/nvme.h | 1 -
> 2 files changed, 9 insertions(+), 11 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs
2018-05-30 16:45 ` [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs Christoph Hellwig
2018-05-30 21:34 ` Sagi Grimberg
@ 2018-06-04 6:16 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:16 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:45:59 +0200
Christoph Hellwig <hch@lst.de> wrote:
> Per section 5.2 we need to issue the corresponding log page to clear
> an AEN, so for a namespace data changed AEN we need to read the
> changed namespace list log. And once we read that log anyway we
> might as well use it to optimize the rescan.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/nvme/host/core.c | 51
> ++++++++++++++++++++++++++++++++++++---- drivers/nvme/host/nvme.h |
> 2 ++ 2 files changed, 49 insertions(+), 4 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 12/12] nvme: limit warnings from nvme_identify_ns
2018-05-30 16:46 ` [PATCH 12/12] nvme: limit warnings from nvme_identify_ns Christoph Hellwig
2018-05-30 21:35 ` Sagi Grimberg
@ 2018-06-04 6:17 ` Hannes Reinecke
1 sibling, 0 replies; 35+ messages in thread
From: Hannes Reinecke @ 2018-06-04 6:17 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-nvme, Jens Axboe, Keith Busch, Sagi Grimberg, linux-block
On Wed, 30 May 2018 18:46:00 +0200
Christoph Hellwig <hch@lst.de> wrote:
> When rescanning namespaces after an AEN we will issue Identify
> Namespace comands to namespaces that have gone away, so don't warn
> for this specific case.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/nvme/host/core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2018-06-04 6:17 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-30 16:45 nvme/nvmet AEN and log page fixups v2 Christoph Hellwig
2018-05-30 16:45 ` [PATCH 01/12] nvme.h: untangle AEN notice definitions Christoph Hellwig
2018-05-30 21:21 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
2018-06-04 6:13 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 02/12] nvme.h: add the changed namespace list log Christoph Hellwig
2018-05-30 21:22 ` Sagi Grimberg
2018-06-04 6:13 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 03/12] nvme.h: add AER configuration symbols Christoph Hellwig
2018-05-30 21:23 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 04/12] nvmet: add a new nvmet_zero_sgl helper Christoph Hellwig
2018-05-30 21:24 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 05/12] nvmet: split log page implementation Christoph Hellwig
2018-05-30 21:25 ` Sagi Grimberg
2018-06-04 6:14 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 06/12] nvmet: implement the changed namespaces log Christoph Hellwig
2018-05-30 17:33 ` Daniel Verkamp
2018-05-31 16:25 ` Christoph Hellwig
2018-05-31 16:36 ` Daniel Verkamp
2018-05-30 21:28 ` Sagi Grimberg
2018-06-04 6:15 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 07/12] nvmet: Add AEN configuration support Christoph Hellwig
2018-05-30 21:30 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 09/12] nvme: submit AEN event configuration on startup Christoph Hellwig
2018-05-30 21:31 ` Sagi Grimberg
2018-05-30 16:45 ` [PATCH 10/12] nvme: mark nvme_queue_scan static Christoph Hellwig
2018-05-30 21:31 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
2018-05-30 16:45 ` [PATCH 11/12] nvme: use the changed namespaces list log to clear ns data changed AENs Christoph Hellwig
2018-05-30 21:34 ` Sagi Grimberg
2018-06-04 6:16 ` Hannes Reinecke
2018-05-30 16:46 ` [PATCH 12/12] nvme: limit warnings from nvme_identify_ns Christoph Hellwig
2018-05-30 21:35 ` Sagi Grimberg
2018-06-04 6:17 ` Hannes Reinecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).