Skip to contentSkip to conversation

ufs: core: Fix runtime suspend error deadlock

PATCH Applied [email protected] 2 participants 2 messages Sep 26, 2025 – Sep 29, 2025

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

PATCH v3 1/1 ufs: core: Fix runtime suspend error deadlock

From: Peter Wang <[email protected]>

Resolve the deadlock issue during runtime suspend when an error triggers the error handler. Prevent the deadlock by checking pm_op_in_progress and performing a quick recovery. This approach ensures that the error handler does not wait indefinitely for runtime PM to resume, allowing runtime suspend to proceed smoothly.

---
 drivers/ufs/core/ufshcd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/ufs/core/ufshcd.c +8 -0
index 88a0e9289ca6..8185a7791923 100644
@@ -6681,6 +6681,14 @@ static void ufshcd_err_handler(struct work_struct *work)
 	}
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
 
+	ufshcd_rpm_get_noresume(hba);
+	if (hba->pm_op_in_progress) {
+		ufshcd_link_recovery(hba);
+		ufshcd_rpm_put(hba);
+		return;
+	}
+	ufshcd_rpm_put(hba);
+
 	ufshcd_err_handling_prepare(hba);
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
Signature · 1 line
2.45.2
#1 lore raw

Peter,

Quoted 5 lines

Resolve the deadlock issue during runtime suspend when an error triggers the error handler. Prevent the deadlock by checking pm_op_in_progress and performing a quick recovery. This approach ensures that the error handler does not wait indefinitely for runtime PM to resume, allowing runtime suspend to proceed smoothly.

Applied to 6.18/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen