* [PATCH v2] ufs: core: Fix runtime suspend error deadlock
@ 2025-09-25 10:22 peter.wang
2025-09-25 15:48 ` Bart Van Assche
0 siblings, 1 reply; 3+ messages in thread
From: peter.wang @ 2025-09-25 10:22 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, peter.wang, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, yi-fan.peng,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu, ed.tsai,
bvanassche
From: Peter Wang <peter.wang@mediatek.com>
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.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufshcd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 88a0e9289ca6..8185a7791923 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -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);
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ufs: core: Fix runtime suspend error deadlock
2025-09-25 10:22 [PATCH v2] ufs: core: Fix runtime suspend error deadlock peter.wang
@ 2025-09-25 15:48 ` Bart Van Assche
2025-09-26 1:25 ` Peter Wang (王信友)
0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2025-09-25 15:48 UTC (permalink / raw)
To: peter.wang, linux-scsi, martin.petersen, avri.altman, alim.akhtar,
jejb
Cc: wsd_upstream, linux-mediatek, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao, yi-fan.peng, qilin.tan, lin.gui,
tun-yu.yu, eddie.huang, naomi.chu, ed.tsai
On 9/25/25 3:22 AM, peter.wang@mediatek.com wrote:
> Tested-by: Bart Van Assche <bvanassche@acm.org>
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:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ufs: core: Fix runtime suspend error deadlock
2025-09-25 15:48 ` Bart Van Assche
@ 2025-09-26 1:25 ` Peter Wang (王信友)
0 siblings, 0 replies; 3+ messages in thread
From: Peter Wang (王信友) @ 2025-09-26 1:25 UTC (permalink / raw)
To: linux-scsi@vger.kernel.org, jejb@linux.ibm.com,
bvanassche@acm.org, avri.altman@wdc.com,
martin.petersen@oracle.com, alim.akhtar@samsung.com
Cc: Alice Chao (趙珮均),
CC Chou (周志杰),
Eddie Huang (黃智傑),
Ed Tsai (蔡宗軒), wsd_upstream,
Chaotian Jing (井朝天),
Chun-Hung Wu (巫駿宏),
Yi-fan Peng (彭羿凡),
Qilin Tan (谭麒麟),
linux-mediatek@lists.infradead.org,
Jiajie Hao (郝加节), Lin Gui (桂林),
Naomi Chu (朱詠田),
Tun-yu Yu (游敦聿)
On Thu, 2025-09-25 at 08:48 -0700, Bart Van Assche wrote:
>
> 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, peter.wang@mediatek.com wrote:
> > Tested-by: Bart Van Assche <bvanassche@acm.org>
>
> 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:
>
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Hi Bart,
Sorry, I misread previous mail.
I will correct commit message aging.
Thanks.
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-26 1:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 10:22 [PATCH v2] ufs: core: Fix runtime suspend error deadlock peter.wang
2025-09-25 15:48 ` Bart Van Assche
2025-09-26 1:25 ` Peter Wang (王信友)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox