Skip to contentSkip to conversation

nvme-pci: print the command name of aborted commands

PATCH In review Christoph Hellwig 4 participants 7 messages Jul 18, 2022 – Jul 24, 2022 NVMe

lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

PATCH 1/1 nvme-pci: print the command name of aborted commands

To allow for slightly better debugging, print the command name when aborting an command.

---
 drivers/nvme/host/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +4 -2
index e465902e0b752..1f229dabbe7aa 100644
@@ -1434,8 +1434,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	cmd.abort.sqid = cpu_to_le16(nvmeq->qid);
 
 	dev_warn(nvmeq->dev->ctrl.device,
-		"I/O %d QID %d timeout, aborting\n",
-		 req->tag, nvmeq->qid);
+		"I/O %d (%s) QID %d timeout, aborting\n",
+		 req->tag,
+		 nvme_get_opcode_str(nvme_req(req)->cmd->common.opcode),
+		 nvmeq->qid);
 
 	abort_req = blk_mq_alloc_request(dev->ctrl.admin_q, nvme_req_op(&cmd),
 					 BLK_MQ_REQ_NOWAIT);
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Christoph Hellwig

To allow for slightly better debugging, print the command name when aborting an command.

Good idea, looks good.

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Christoph Hellwig
Quoted 14 lines

To allow for slightly better debugging, print the command name when aborting an command.

---
  drivers/nvme/host/pci.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +0 -0
index e465902e0b752..1f229dabbe7aa 100644

drivers/nvme/host/pci.c static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · line 1440

Quoted 9 lines
drivers/nvme/host/pci.c +4 -2
@@ -1434,8 +1434,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
  	cmd.abort.sqid = cpu_to_le16(nvmeq->qid);
 
  	dev_warn(nvmeq->dev->ctrl.device,
-		"I/O %d QID %d timeout, aborting\n",
-		 req->tag, nvmeq->qid);
+		"I/O %d (%s) QID %d timeout, aborting\n",
+		 req->tag,
+		 nvme_get_opcode_str(nvme_req(req)->cmd->common.opcode),
+		 nvmeq->qid);

I want that for rdma/tcp/loop as well.

author maintainer
#4 lore raw
Quoted 1 line · Sagi Grimberg

I want that for rdma/tcp/loop as well.

We don't ever send an abort from those currently.

maintainer
#5 lore raw
Quoted 4 lines
Quoted 2 lines

I want that for rdma/tcp/loop as well.

We don't ever send an abort from those currently.

I meant on timedout requests.

author maintainer
#6 lore raw
In reply to Christoph Hellwig

We'll need to fold this in to fix the modular build:

drivers/nvme/host/constants.c +1 -0
index 6973c2a17c13d..e958d50155857 100644
@@ -177,6 +177,7 @@ const unsigned char *nvme_get_opcode_str(u8 opcode)
 		return nvme_ops[opcode];
 	return "Unknown";
 }
+EXPORT_SYMBOL_GPL(nvme_get_opcode_str);
 
 const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
 {