Skip to contentSkip to conversation

add debug log for commnad timoeut

PATCH Superseded [email protected] 2 participants 5 messages Feb 9 – Feb 10

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add debug log for commnad timoeut

From: Peter Wang <[email protected]>

Add some logs to make it easier to debug after a command timeout.

Peter Wang (2):
ufs: core: add debug log for uic commnad timoeut
ufs: core: add debug log for mcq commnad timoeut

 drivers/ufs/core/ufs-mcq.c | 2 ++
 drivers/ufs/core/ufshcd.c  | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/2 ufs: core: add debug log for uic commnad timoeut

From: Peter Wang <[email protected]>

It is difficult to debug when a UIC command timeout occurs simultaneously with a UIC command complete interrupt. Currently, we only see the timeout log without any debug information, making it unclear whether the UFS device failed to respond or the host entered an incorrect state. Add a one-line log to cover this situation.

---
 drivers/ufs/core/ufshcd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +4 -1
index 604043a7533d..8c3d13f59cf5 100644
@@ -5564,8 +5564,11 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
 
 	guard(spinlock_irqsave)(hba->host->host_lock);
 	cmd = hba->active_uic_cmd;
-	if (!cmd)
+	if (!cmd) {
+		dev_err(hba->dev,
+			"No active_uic_cmd, may timeout and be cleared.\n");
 		return retval;
+	}
 
 	if (ufshcd_is_auto_hibern8_error(hba, intr_status))
 		hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status);
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH v1 1/2] ufs: core: add debug log for uic commnad timoeut

Quoted 1 line · On 2/9/26 12:28 AM, [email protected] wrote:

[ ... ]

Please change "commnad" into "command" in the cover letter of this patch series and also in the subject of this patch.

drivers/ufs/core/ufshcd.c static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) · line 5571

Quoted 5 lines
drivers/ufs/core/ufshcd.c +4 -0
+	if (!cmd) {
+		dev_err(hba->dev,
+			"No active_uic_cmd, may timeout and be cleared.\n");
  		return retval;
+	}

The new message is incomprehensible to me. Please make it more clear. Is this perhaps what you want to be reported?

"No active UIC command. Maybe a timeout occurred?"

Thanks,

Bart.

#3 lore raw

Re: [PATCH v1 1/2] ufs: core: add debug log for uic commnad timoeut

Quoted 6 lines · Bart Van Assche

On 2/9/26 12:28 AM, [email protected] wrote:
 > [ ... ]

Please change "commnad" into "command" in the cover letter of this patch
series and also in the subject of this patch.

Thank you. I will correct this typo.

Quoted 12 lines
Quoted 7 lines

+     if (!cmd) {
+             dev_err(hba->dev,
+                     "No active_uic_cmd, may timeout and be cleared.\n");
              return retval;
+     }

The new message is incomprehensible to me. Please make it more clear. Is
this perhaps what you want to be reported?

Quoted 5 lines

"No active UIC command. Maybe a timeout occurred?"

Thanks,

Bart.

Yes, this is what I mean.
If this log is followed by a timeout log, we can be sure it was cleared by the timeout.
If not, then something might be wrong.

Thanks.
Peter

#4 lore raw

PATCH 2/2 ufs: core: add debug log for mcq commnad timoeut

In reply to [email protected]

From: Peter Wang <[email protected]>

It is difficult to debug situations where a mcq command timeout occurs, the corresponding CQ tag response is received, but the request is not completed.
Add a one-line log to indicate when the CQ entry is abnormal.

---
 drivers/ufs/core/ufs-mcq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/ufs/core/ufs-mcq.c +2 -0
index 9ab91b4c05b0..ad0ada57959a 100644
@@ -301,6 +301,8 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,
 		ufshcd_compl_one_cqe(hba, tag, cqe);
 		/* After processed the cqe, mark it empty (invalid) entry */
 		cqe->command_desc_base_addr = 0;
+	} else {
+		dev_err(hba->dev, "Abnormal CQ entry!\n");
 	}
 }
 
Signature · 1 line
2.45.2