improve nvme error logging
cover improve nvme error logging
From: Amit Engel <[email protected]>
Add nvme_opcode_str func for all nvme cmd types (io/admin/fabrics) Add additional debug info for nvme_tcp_timeout log
Amit Engel (2):
nvme: add nvme_opcode_str function for all nvme cmd types
nvme-tcp: add additional info for nvme_tcp_timeout log
drivers/nvme/host/constants.c | 16 ++++++++++++++++ drivers/nvme/host/nvme.h | 13 +++++++++++++ drivers/nvme/host/tcp.c | 7 +++++-- 3 files changed, 34 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 nvme: add nvme_opcode_str function for all nvme cmd types
From: Amit Engel <[email protected]>
nvme_opcode_str will handle io/admin/fabrics ops
This improves NVMe errors logging
--- drivers/nvme/host/constants.c | 16 ++++++++++++++++ drivers/nvme/host/nvme.h | 13 +++++++++++++ 2 files changed, 29 insertions(+)
drivers/nvme/host/constants.c +16 -0
@@ -54,6 +54,14 @@ static const char * const nvme_admin_ops[] = { [nvme_admin_get_lba_status] = "Get LBA Status", }; +static const char *const nvme_fabrics_ops[] = { + [nvme_fabrics_type_property_set] ="Property Set" , + [nvme_fabrics_type_property_get] ="Property Get" , + [nvme_fabrics_type_connect] ="Connect" , + [nvme_fabrics_type_auth_send] ="Authentication Send" , + [nvme_fabrics_type_auth_receive] ="Authentication Receive" , +}; +static const char *const nvme_statuses[] = { [NVME_SC_SUCCESS ] ="Success" , [NVME_SC_INVALID_OPCODE ] ="Invalid Command Opcode" ,
@@ -185,3 +193,11 @@ const unsigned char *nvme_get_admin_opcode_str(u8 opcode)return nvme_admin_ops[opcode];return "Unknown" ; } +EXPORT_SYMBOL_GPL (nvme_get_admin_opcode_str); + +const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) { +if (opcode <ARRAY_SIZE (nvme_admin_ops) && nvme_fabrics_ops[opcode]) +return nvme_fabrics_ops[opcode]; +return "Unknown" ; +} +EXPORT_SYMBOL_GPL (nvme_get_fabrics_opcode_str);
drivers/nvme/host/nvme.h +13 -0
@@ -1057,6 +1057,7 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)const unsigned char *nvme_get_error_status_str (u16 status);const unsigned char *nvme_get_opcode_str (u8 opcode);const unsigned char *nvme_get_admin_opcode_str (u8 opcode); +const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode);#else /* CONFIG_NVME_VERBOSE_ERRORS */ static inline const unsigned char *nvme_get_error_status_str (u16 status) {
@@ -1070,6 +1071,18 @@ static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode) {return "Admin Cmd" ; } + +static inline const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) +{ +return "Fabrics Cmd" ; +}#endif /* CONFIG_NVME_VERBOSE_ERRORS */ +static inline const unsigned char *nvme_opcode_str (int qid,u8 opcode,u8 fctype) +{ +if (opcode == nvme_fabrics_command) +return nvme_get_fabrics_opcode_str (fctype); +return qid ?nvme_get_opcode_str (opcode) : +nvme_get_admin_opcode_str (opcode); +}#endif /* _NVME_H */
Signature · 1 line
2.31.1
Re: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
drivers/nvme/host/constants.c const unsigned char *nvme_get_admin_opcode_str(u8 opcode) · line 200
Quoted 4 lines · On Mon, Dec 12, 2022 at 6:33 AM <[email protected]> wrote:
drivers/nvme/host/constants.c +3
-0+const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) { +if (opcode <ARRAY_SIZE (nvme_admin_ops) && nvme_fabrics_ops[opcode]) +return nvme_fabrics_ops[opcode];
Why bounds-check opcode against nvme_admin_ops but access nvme_fabrics_ops?
RE: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
Correct, fixed
-----Original Message-----
From: Caleb Sander <[email protected]>
Sent: Monday, 12 December 2022 18:33
To: Engel, Amit <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
[EXTERNAL EMAIL]
drivers/nvme/host/constants.c const unsigned char *nvme_get_admin_opcode_str(u8 opcode) · line 200
Quoted 4 lines · On Mon, Dec 12, 2022 at 6:33 AM <[email protected]> wrote:
drivers/nvme/host/constants.c +3
-0+const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) { +if (opcode <ARRAY_SIZE (nvme_admin_ops) && nvme_fabrics_ops[opcode]) +return nvme_fabrics_ops[opcode];
Why bounds-check opcode against nvme_admin_ops but access nvme_fabrics_ops?
Re: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
In reply to [email protected]Quoted 7 lines · On 12/12/22 06:25, [email protected] wrote:
From: Amit Engel <[email protected]>
nvme_opcode_strwill handle io/admin/fabrics opsThis improves NVMe errors logging
Signed-off-by Amit Engel <[email protected]>
fix the commit log...
-ck
RE: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
Hi ck,
thank you for the review.
what's wrong with the commit log for [PATCH 1/2]?
"
nvme: add nvme_opcode_str function for all nvme cmd types
nvme_opcode_str will handle io/admin/fabrics ops
This improves NVMe errors logging
Thanks
Amit
-----Original Message-----
From: Chaitanya Kulkarni <[email protected]>
Sent: Monday, 12 December 2022 22:01
To: Engel, Amit <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
[EXTERNAL EMAIL]
Quoted 7 lines · On 12/12/22 06:25, [email protected] wrote:
From: Amit Engel <[email protected]>
nvme_opcode_strwill handle io/admin/fabrics opsThis improves NVMe errors logging
Signed-off-by Amit Engel <[email protected]>
fix the commit log...
-ck
PATCH 2/2 nvme-tcp: add additional info for nvme_tcp_timeout log
In reply to [email protected]From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
example log if CONFIG_NVME_VERBOSE_ERRORS is configured:
"nvme nvme0: queue 2 timeout cid 0xd058 type 4 opc Write (0x1)"
example log if CONFIG_NVME_VERBOSE_ERRORS is not configured:
"nvme nvme0: queue 2 timeout cid 0xd058 type 4 opc I/O Cmd (0x1)"
--- drivers/nvme/host/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +5 -2
@@ -2275,10 +2275,13 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)struct nvme_tcp_request *req =blk_mq_rq_to_pdu (rq);struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;struct nvme_tcp_cmd_pdu *pdu = req->pdu; +u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype; +int qid =nvme_tcp_queue_id (req->queue);dev_warn (ctrl->device, -"queue %d: timeout request %#x type %d\n" , -nvme_tcp_queue_id (req->queue), rq->tag, pdu->hdr.type); +"queue %d: timeout cid %#x type %d opcode %#x (%s)\n" , +nvme_tcp_queue_id (req->queue),nvme_cid (rq), pdu->hdr.type, + opc,nvme_opcode_str (qid, opc, fctype));if (ctrl->state !=NVME_CTRL_LIVE ) {/*
Signature · 1 line
2.31.1
cover improve nvme error logging
From: Amit Engel <[email protected]>
Add nvme_opcode_str func for all nvme cmd types (io/admin/fabrics) Add additional debug info for nvme_tcp_timeout log
Amit Engel (2):
nvme: add nvme_opcode_str function for all nvme cmd types
nvme-tcp: add additional info for nvme_tcp_timeout log
drivers/nvme/host/constants.c | 16 ++++++++++++++++ drivers/nvme/host/nvme.h | 13 +++++++++++++ drivers/nvme/host/tcp.c | 7 +++++-- 3 files changed, 34 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 nvme: add nvme_opcode_str function for all nvme cmd types
From: Amit Engel <[email protected]>
nvme_opcode_str will handle io/admin/fabrics ops
This improves NVMe errors logging
--- drivers/nvme/host/constants.c | 16 ++++++++++++++++ drivers/nvme/host/nvme.h | 13 +++++++++++++ 2 files changed, 29 insertions(+)
drivers/nvme/host/constants.c +16 -0
@@ -54,6 +54,14 @@ static const char * const nvme_admin_ops[] = { [nvme_admin_get_lba_status] = "Get LBA Status", }; +static const char *const nvme_fabrics_ops[] = { + [nvme_fabrics_type_property_set] ="Property Set" , + [nvme_fabrics_type_property_get] ="Property Get" , + [nvme_fabrics_type_connect] ="Connect" , + [nvme_fabrics_type_auth_send] ="Authentication Send" , + [nvme_fabrics_type_auth_receive] ="Authentication Receive" , +}; +static const char *const nvme_statuses[] = { [NVME_SC_SUCCESS ] ="Success" , [NVME_SC_INVALID_OPCODE ] ="Invalid Command Opcode" ,
@@ -185,3 +193,11 @@ const unsigned char *nvme_get_admin_opcode_str(u8 opcode)return nvme_admin_ops[opcode];return "Unknown" ; } +EXPORT_SYMBOL_GPL (nvme_get_admin_opcode_str); + +const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) { +if (opcode <ARRAY_SIZE (nvme_fabrics_ops) && nvme_fabrics_ops[opcode]) +return nvme_fabrics_ops[opcode]; +return "Unknown" ; +} +EXPORT_SYMBOL_GPL (nvme_get_fabrics_opcode_str);
drivers/nvme/host/nvme.h +13 -0
@@ -1057,6 +1057,7 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)const unsigned char *nvme_get_error_status_str (u16 status);const unsigned char *nvme_get_opcode_str (u8 opcode);const unsigned char *nvme_get_admin_opcode_str (u8 opcode); +const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode);#else /* CONFIG_NVME_VERBOSE_ERRORS */ static inline const unsigned char *nvme_get_error_status_str (u16 status) {
@@ -1070,6 +1071,18 @@ static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode) {return "Admin Cmd" ; } + +static inline const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) +{ +return "Fabrics Cmd" ; +}#endif /* CONFIG_NVME_VERBOSE_ERRORS */ +static inline const unsigned char *nvme_opcode_str (int qid,u8 opcode,u8 fctype) +{ +if (opcode == nvme_fabrics_command) +return nvme_get_fabrics_opcode_str (fctype); +return qid ?nvme_get_opcode_str (opcode) : +nvme_get_admin_opcode_str (opcode); +}#endif /* _NVME_H */
Signature · 1 line
2.31.1
Re: [PATCH 1/2] nvme: add nvme_opcode_str function for all nvme cmd types
PATCH 2/2 nvme-tcp: add additional info for nvme_tcp_timeout log
In reply to [email protected]From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
example log if CONFIG_NVME_VERBOSE_ERRORS is configured:
"nvme nvme0: queue 2 timeout cid 0xd058 type 4 opc Write (0x1)"
example log if CONFIG_NVME_VERBOSE_ERRORS is not configured:
"nvme nvme0: queue 2 timeout cid 0xd058 type 4 opc I/O Cmd (0x1)"
--- drivers/nvme/host/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +5 -2
@@ -2275,10 +2275,13 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)struct nvme_tcp_request *req =blk_mq_rq_to_pdu (rq);struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;struct nvme_tcp_cmd_pdu *pdu = req->pdu; +u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype; +int qid =nvme_tcp_queue_id (req->queue);dev_warn (ctrl->device, -"queue %d: timeout request %#x type %d\n" , -nvme_tcp_queue_id (req->queue), rq->tag, pdu->hdr.type); +"queue %d: timeout cid %#x type %d opcode %#x (%s)\n" , +nvme_tcp_queue_id (req->queue),nvme_cid (rq), pdu->hdr.type, + opc,nvme_opcode_str (qid, opc, fctype));if (ctrl->state !=NVME_CTRL_LIVE ) {/*
Signature · 1 line
2.31.1
Re: [PATCH 2/2] nvme-tcp: add additional info for nvme_tcp_timeout log
Hi Sagi, can you please review and let me know if anything is missing so the below will be ready for merge ?
Thanks,
Amit
-----Original Message-----
From: Engel, Amit <[email protected]>
Sent: Monday, 12 December 2022 21:41
To: [email protected]; [email protected]
Cc: Engel, Amit <[email protected]>; Engel, Amit <[email protected]>
Subject: [PATCH 0/2] improve nvme error logging
From: Amit Engel <[email protected]>
Add nvme_opcode_str func for all nvme cmd types (io/admin/fabrics) Add additional debug info for nvme_tcp_timeout log
Amit Engel (2):
nvme: add nvme_opcode_str function for all nvme cmd types
nvme-tcp: add additional info for nvme_tcp_timeout log
drivers/nvme/host/constants.c | 16 ++++++++++++++++ drivers/nvme/host/nvme.h | 13 +++++++++++++ drivers/nvme/host/tcp.c | 7 +++++-- 3 files changed, 34 insertions(+), 2 deletions(-)
--
2.31.1
Christoph Hellwig
AppliedThanks,
applied to nvme-6.3.