nvme-tcp: add additional info for nvme_tcp_timeout log
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 nvme-tcp: add additional info for nvme_tcp_timeout log
From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
--- drivers/nvme/host/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +3 -2
@@ -2277,8 +2277,9 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)struct nvme_tcp_cmd_pdu *pdu = req->pdu;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 opcode %#x type %d\n" , +nvme_tcp_queue_id (req->queue),nvme_cid (rq), + pdu->cmd.common.opcode, pdu->hdr.type);if (ctrl->state !=NVME_CTRL_LIVE ) {/*
Signature · 1 line
2.31.1
Sagi Grimberg
maintainerQuoted 15 lines
From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
Signed-off-by Amit Engel <[email protected]>--- drivers/nvme/host/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/nvme/host/tcp.c +0
-0
drivers/nvme/host/tcp.c static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq) · line 2280
Quoted 6 lines
drivers/nvme/host/tcp.c +1
-2@@ -2277,8 +2277,9 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)struct nvme_tcp_cmd_pdu *pdu = req->pdu; 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 opcode %#x type %d\n",
How about using show_opcode_name() instead (or in addition).
Hi Sagi,
Do you mean show_opcode_name() macro which is defined as part of TRACE_EVENT?
As far as I understand, I can't use show_opcode_name() directly outside of TRACE_EVENT
Can you please share an example?
Thanks in advance,
Amit
-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Wednesday, 7 December 2022 13:20
To: Engel, Amit <[email protected]>; [email protected]
Subject: Re: [PATCH] nvme-tcp: add additional info for nvme_tcp_timeout log
[EXTERNAL EMAIL]
Quoted 14 lines
From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
Signed-off-by Amit Engel <[email protected]>--- drivers/nvme/host/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/nvme/host/tcp.c index renamed from drivers/nvme/host/tcp.c +0
-0
1eed0fc26b3a..f2be7c23ace5100644
drivers/nvme/host/tcp.c static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq) · line 2280
Quoted 6 lines
drivers/nvme/host/tcp.c +1
-2@@ -2277,8 +2277,9 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)struct nvme_tcp_cmd_pdu *pdu = req->pdu; 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 opcode %#x type %d\n",
How about using show_opcode_name() instead (or in addition).
Sagi Grimberg
maintainerQuoted 8 lines
Hi Sagi,
Do you mean
show_opcode_name()macro which is defined as part ofTRACE_EVENT?As far as I understand, I can't use
show_opcode_name()directly outside ofTRACE_EVENTCan you please share an example?
Sorry, I meant something like nvme_get_opcode_str()...
Something like (untested and needs a split):
--
drivers/nvme/host/constants.c +17 -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_connect] ="Connect" , + [nvme_fabrics_type_property_get] ="Property Get" , + [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,12 @@ 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 +15 -4
@@ -1086,19 +1086,30 @@ 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) { -return "I/O Error" ; +return __stringify (status); }static inline const unsigned char *nvme_get_opcode_str (u8 opcode) { -return "I/O Cmd" ; +return __stringify (opcode); }static inline const unsigned char *nvme_get_admin_opcode_str (u8 opcode) { -return "Admin Cmd" ; +return __stringify (opcode); +} +static inline const unsigned char *nvme_get_fabrics_opcode_str (u8 opcode) +{ +return __stringify (opcode); }#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 */
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 opcode = 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 op %s\n" , + qid,nvme_cid (rq), pdu->hdr.type, +nvme_opcode_str (qid, opcode, fctype));if (ctrl->state !=NVME_CTRL_LIVE ) {/*
--
Sure, I will add it and apply the patch for your review
Thanks
Amit
-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Wednesday, 7 December 2022 17:17
To: Engel, Amit <[email protected]>; [email protected]
Subject: Re: [PATCH] nvme-tcp: add additional info for nvme_tcp_timeout log
[EXTERNAL EMAIL]
Quoted 8 lines
Hi Sagi,
Do you mean
show_opcode_name()macro which is defined as part ofTRACE_EVENT?As far as I understand, I can't use
show_opcode_name()directly outside ofTRACE_EVENTCan you please share an example?
Sorry, I meant something like nvme_get_opcode_str()...
Something like (untested and needs a split):
--
drivers/nvme/host/constants.c +7 -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_connect] ="Connect" , + [nvme_fabrics_type_property_get] ="Property Get" , + [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,12 @@ 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 +9 -4
@@ -1086,19 +1086,30 @@ 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) { -return "I/O Error" ; +return __stringify (status); }static inline const unsigned char *nvme_get_opcode_str (u8 opcode) { -return "I/O Cmd" ; +return __stringify (opcode); }static inline const unsigned char *nvme_get_admin_opcode_str (u8 opcode) { -return "Admin Cmd" ; +return __stringify (opcode); +} +static inline const unsigned char *nvme_get_fabrics_opcode_str (u8 +opcode) { +return __stringify (opcode); }#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 */
drivers/nvme/host/tcp.c +1 -0
@@ -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 opcode = 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 op %s\n", + qid, nvme_cid(rq), pdu->hdr.type, + nvme_opcode_str(qid, opcode, fctype));
if (ctrl->state != NVME_CTRL_LIVE) {
/*--
PATCH 1/1 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
--- 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(-)
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 */
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
Sagi Grimberg
maintainerQuoted 4 lines
From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
I think that you should separate the patches to add the fabrics opcode string and then another patch to have nvme-tcp call it.
Also, please make sure that this is fine with/without CONFIG_NVME_VERBOSE_ERRORS and provide example log message for each variant in the commit-msg.
Ok, np
-----Original Message-----
From: Sagi Grimberg <[email protected]>
Sent: Monday, 12 December 2022 12:17
To: Engel, Amit <[email protected]>; [email protected]
Subject: Re: [PATCH] nvme-tcp: add additional info for nvme_tcp_timeout log
[EXTERNAL EMAIL]
Quoted 3 lines
From: Amit Engel <[email protected]>
This provides additional details about the rq/cmd that is timed out
I think that you should separate the patches to add the fabrics opcode string and then another patch to have nvme-tcp call it.
Also, please make sure that this is fine with/without CONFIG_NVME_VERBOSE_ERRORS and provide example log message for each variant in the commit-msg.