Skip to contentSkip to conversation

ufs: core: Fix runtime suspend error deadlock

PATCH Superseded [email protected] 2 participants 3 messages Sep 25, 2025 – Sep 26, 2025

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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
#2 lore raw
Quoted 6 lines · Bart Van Assche

External email : Please do not click links or open attachments until you have verified the sender or the content.

On 9/25/25 3:22 AM, [email protected] wrote:

Quoted 8 lines
Quoted 1 line

Did I ever claim that I tested this patch? I think the Tested-by tag should be removed.

Anyway, since this patch looks good to me:

Hi Bart,

Sorry, I misread previous mail.
I will correct commit message aging.

Thanks.
Peter