Skip to contentSkip to conversation

scsi: pm80xx: Improve debugging for aborted commands

PATCH Applied Salomon Dushimirimana 2 participants 3 messages Nov 26, 2024 – Dec 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: pm80xx: Improve debugging for aborted commands

From: Vishakha Channapattan <[email protected]>

This patch improves the debugging capabilities of the driver by adding more context to debug messages

1. Introduces a new function to show pending commands
2. Include the tag number in NCQ EH path debug messages
3. Adds logging for ata_tag along with pm80xx tag to map IOs aborted with ata logs.

---
 drivers/scsi/pm8001/pm8001_hwi.c |  5 +--
 drivers/scsi/pm8001/pm8001_sas.c | 57 ++++++++++++++++++++++++++++++++
 drivers/scsi/pm8001/pm8001_sas.h |  2 ++
 drivers/scsi/pm8001/pm80xx_hwi.c | 22 ++++++++----
 4 files changed, 77 insertions(+), 9 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -2
index dec1e2d380f1..42a4eeac24c9 100644
@@ -3472,12 +3472,13 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 			   status, tag, scp);
 	switch (status) {
 	case IO_SUCCESS:
-		pm8001_dbg(pm8001_ha, EH, "IO_SUCCESS\n");
+		pm8001_dbg(pm8001_ha, FAIL, "ABORT IO_SUCCESS for tag %#x\n",
+			   tag);
 		ts->resp = SAS_TASK_COMPLETE;
 		ts->stat = SAS_SAM_STAT_GOOD;
 		break;
 	case IO_NOT_VALID:
-		pm8001_dbg(pm8001_ha, EH, "IO_NOT_VALID\n");
+		pm8001_dbg(pm8001_ha, FAIL, "IO_NOT_VALID for tag %#x\n", tag);
 		ts->resp = TMF_RESP_FUNC_FAILED;
 		break;
 	}
drivers/scsi/pm8001/pm8001_sas.c +57 -0

63 lines not on this page · raw message

drivers/scsi/pm8001/pm8001_sas.h +2 -0
index ced6721380a8..a73d1382cbc5 100644
@@ -785,6 +785,8 @@ static inline void pm8001_ccb_task_free_done(struct pm8001_hba_info *pm8001_ha,
 }
 void pm8001_setds_completion(struct domain_device *dev);
 void pm8001_tmf_aborted(struct sas_task *task);
+void pm80xx_show_pending_commands(struct pm8001_hba_info *pm8001_ha,
+				  struct pm8001_device *dev);
 
 #endif
 
drivers/scsi/pm8001/pm80xx_hwi.c +15 -7
index a9869cd8c4c0..1b9aaea26148 100644
@@ -2245,7 +2245,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
 	u32 param;
 	u32 status;
 	u32 tag;
-	int i, j;
+	int i, j, ata_tag = -1;
 	u8 sata_addr_low[4];
 	u32 temp_sata_addr_low, temp_sata_addr_hi;
 	u8 sata_addr_hi[4];
@@ -2255,6 +2255,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
 	u32 *sata_resp;
 	struct pm8001_device *pm8001_dev;
 	unsigned long flags;
+	struct ata_queued_cmd *qc;
 
 	psataPayload = (struct sata_completion_resp *)(piomb + 4);
 	status = le32_to_cpu(psataPayload->status);
@@ -2266,8 +2267,11 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
 	pm8001_dev = ccb->device;
 
 	if (t) {
-		if (t->dev && (t->dev->lldd_dev))
+		if (t->dev && (t->dev->lldd_dev)) {
 			pm8001_dev = t->dev->lldd_dev;
+			qc = t->uldd_task;
+			ata_tag = qc ? qc->tag : -1;
+		}
 	} else {
 		pm8001_dbg(pm8001_ha, FAIL, "task null, freeing CCB tag %d\n",
 			   ccb->ccb_tag);
@@ -2275,16 +2279,14 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
 		return;
 	}
 
-
 	if (pm8001_dev && unlikely(!t->lldd_task || !t->dev))
 		return;
 
 	ts = &t->task_status;
-
 	if (status != IO_SUCCESS) {
 		pm8001_dbg(pm8001_ha, FAIL,
-			"IO failed device_id %u status 0x%x tag %d\n",
-			pm8001_dev->device_id, status, tag);
+			"IO failed status %#x pm80xx tag %#x ata tag %d\n",
+			status, tag, ata_tag);
 	}
 
 	/* Print sas address of IO failed device */
@@ -2666,13 +2668,19 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha,
 
 	/* Check if this is NCQ error */
 	if (event == IO_XFER_ERROR_ABORTED_NCQ_MODE) {
+		/* tag value is invalid with this event */
+		pm8001_dbg(pm8001_ha, FAIL, "NCQ ERROR for device %#x tag %#x\n",
+			dev_id, tag);
+
 		/* find device using device id */
 		pm8001_dev = pm8001_find_dev(pm8001_ha, dev_id);
 		/* send read log extension by aborting the link - libata does what we want */
-		if (pm8001_dev)
+		if (pm8001_dev) {
+			pm80xx_show_pending_commands(pm8001_ha, pm8001_dev);
 			pm8001_handle_event(pm8001_ha,
 				pm8001_dev,
 				IO_XFER_ERROR_ABORTED_NCQ_MODE);
+		}
 		return;
 	}
 
Signature · 1 line
2.47.0.338.g60cca15819-goog
#1 lore raw

Salomon,

Quoted 2 lines

This patch improves the debugging capabilities of the driver by adding more context to debug messages

In the future please use imperative mood for commit descriptions. See Documentation/process/submitting-patches.rst.

Applied to 6.14/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Salomon Dushimirimana
Quoted 9 lines · Salomon Dushimirimana

This patch improves the debugging capabilities of the driver by adding more context to debug messages

1. Introduces a new function to show pending commands
2. Include the tag number in NCQ EH path debug messages
3. Adds logging for ata_tag along with pm80xx tag to map IOs aborted with ata logs.

[...]

Applied to 6.14/scsi-queue, thanks!

[1/1] scsi: pm80xx: Improve debugging for aborted commands

      https://git.kernel.org/mkp/scsi/c/5efff64c6be9
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering