Skip to contentSkip to conversation

nvme-tcp: add additional info for nvme_tcp_timeout log

PATCH In review Sagi Grimberg 2 participants 8 messages Dec 7, 2022 – Dec 12, 2022 1 message not in the archive NVMe

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

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
index 1eed0fc26b3a..f2be7c23ace5 100644
@@ -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
author maintainer
#2 lore raw
Quoted 15 lines

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 +0 -0
index 1eed0fc26b3a..f2be7c23ace5 100644

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).

#3 lore raw

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

---
  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..f2be7c23ace5 100644

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).

author maintainer
#4 lore raw
Quoted 8 lines

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?

Sorry, I meant something like nvme_get_opcode_str()...

Something like (untested and needs a split):
--

drivers/nvme/host/constants.c +17 -0
index e958d5015585..eacf282f04d8 100644
@@ -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
index e01fa9f696fa..56f2cec6e5b1 100644
@@ -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
index 79789daddeac..77450f52c146 100644
@@ -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) {
                /*

--

#5 lore raw

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 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?

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) {
                 /*

--

#6 lore raw

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
index e958d5015585..81a1d1d8d506 100644
@@ -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
index 16b34a491495..c247daf8c86a 100644
@@ -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
index 1eed0fc26b3a..2676f6787d30 100644
@@ -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
author maintainer
#7 lore raw
Quoted 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.

#8 lore raw

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.