Skip to contentSkip to conversation

nvme: Improve warnings for scan_work

PATCH Applied Minwoo Im 2 participants 5 messages Nov 30, 2020 – Dec 2, 2020 NVMe

lore
Share & tools
lore

Minwoo Im

author
#0 lore raw

cover nvme: Improve warnings for scan_work

These two patches improve warning logs when identify commands fail during the scan_work.

Please have a look.

Minwoo Im (2):
nvme: elaborate ns-descs failure warning in detail
nvme: Print warning for list-ns command failure

 drivers/nvme/host/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Signature · 7 lines
2.17.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author
#1 lore raw

PATCH 1/2 nvme: elaborate ns-descs failure warning in detail

Add nsid to figure out which namespace id has been failed during ns-descs commands. If we don't print it out, some of duplicated warnings which don't have much meaningful statement can be seen like:

[    1.321031] nvme nvme0: Identify Descriptors failed (16386)
[    1.321948] nvme nvme0: Identify Descriptors failed (16386)
[    1.322872] nvme nvme0: Identify Descriptors failed (16386)
[    1.323775] nvme nvme0: Identify Descriptors failed (16386)
[    1.324687] nvme nvme0: Identify Descriptors failed (16386)

...

Also, this patch prints status value in hexadecimal format rather than decimal for better readability.

---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +2 -1
index f42ed266bd7f..ded6376facbe 100644
@@ -1357,7 +1357,8 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid,
 				      NVME_IDENTIFY_DATA_SIZE);
 	if (status) {
 		dev_warn(ctrl->device,
-			"Identify Descriptors failed (%d)\n", status);
+			"Identify Descriptors failed (nsid=%u, status=0x%x)\n",
+			nsid, status);
 		goto free_data;
 	}
 
Signature · 7 lines
2.17.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author
#2 lore raw

PATCH 2/2 nvme: Print warning for list-ns command failure

In reply to Minwoo Im

During the scan_work, list-ns command is issued to figure out which namespaces are in active state. But if this command is failed, it will try to scan namespaces sequentially. In this situation, we don't see any warnings and don't even know whether list-ns command has been failed or not easiliy.

This patch prints out warning for the failure of the list-ns command. Then we can find easily what's going on in the scan_work like:

[    1.108399] nvme nvme0: Identify NS List failed (status=0x400b)
[    1.109583] nvme0n1: detected capacity change from 0 to 1048576
[    1.112186] nvme nvme0: Identify Descriptors failed (nsid=2, status=0x4002)
[    1.113929] nvme nvme0: Identify Descriptors failed (nsid=3, status=0x4002)
[    1.116537] nvme nvme0: Identify Descriptors failed (nsid=4, status=0x4002)

...

---
 drivers/nvme/host/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +5 -1
index ded6376facbe..64905bc83e9d 100644
@@ -4096,8 +4096,12 @@ static int nvme_scan_ns_list(struct nvme_ctrl *ctrl)
 
 		ret = nvme_submit_sync_cmd(ctrl->admin_q, &cmd, ns_list,
 					    NVME_IDENTIFY_DATA_SIZE);
-		if (ret)
+		if (ret) {
+			dev_warn(ctrl->device,
+				"Identify NS List failed (status=0x%x)\n",
+				ret);
 			goto free;
+		}
 
 		for (i = 0; i < nr_entries; i++) {
 			u32 nsid = le32_to_cpu(ns_list[i]);
Signature · 7 lines
2.17.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme