Skip to contentSkip to conversation

ufs: core: fix another deadlock when rtc update

PATCH Superseded [email protected] 2 participants 3 messages Oct 23, 2024 – Oct 24, 2024

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ufs: core: fix another deadlock when rtc update

From: Peter Wang <[email protected]>

When ufshcd_rtc_work calls ufshcd_rpm_put_sync and the pm's usage_count is 0, it will enter the runtime suspend callback. However, the runtime suspend callback will wait to flush ufshcd_rtc_work, causing a deadlock.
Replacing ufshcd_rpm_put_sync with ufshcd_rpm_put can avoid the deadlock.

Fixes 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Cc <[email protected]> 6.11.x
---
 drivers/ufs/core/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +1 -1
index a63dcf48e59d..f5846598d80e 100644
@@ -8219,7 +8219,7 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
 
 	err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
 				0, 0, &val);
-	ufshcd_rpm_put_sync(hba);
+	ufshcd_rpm_put(hba);
 
 	if (err)
 		dev_err(hba->dev, "%s: Failed to update rtc %d\n", __func__, err);
Signature · 1 line
2.18.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On 10/23/24 6:19 AM, [email protected] wrote:

From: Peter Wang <[email protected]>

When ufshcd_rtc_work calls ufshcd_rpm_put_sync and the pm's usage_count is 0, it will enter the runtime suspend callback. However, the runtime suspend callback will wait to flush ufshcd_rtc_work, causing a deadlock.
Replacing ufshcd_rpm_put_sync with ufshcd_rpm_put can avoid the deadlock.

Quoted 4 lines
Fixes 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Cc <[email protected]> 6.11.x

No blank lines in the tags section please. Additionally, a hash sign (#) is missing between "<[email protected]>" and "6.11.x". Otherwise this patch looks good to me. Hence:

#2 lore raw
Quoted 17 lines · Bart Van Assche

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

Quoted 12 lines · On 10/23/24 6:19 AM, [email protected] wrote:

From: Peter Wang <[email protected]>

When ufshcd_rtc_work calls ufshcd_rpm_put_sync and the pm's usage_count is 0, it will enter the runtime suspend callback. However, the runtime suspend callback will wait to flush ufshcd_rtc_work, causing a deadlock.
Replacing ufshcd_rpm_put_sync with ufshcd_rpm_put can avoid the deadlock.

Fixes 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Cc <[email protected]> 6.11.x
Quoted 7 lines
Quoted 1 line

No blank lines in the tags section please. Additionally, a hash sign (#) is missing between "<[email protected]>" and "6.11.x". Otherwise this patch looks good to me. Hence:

Hi Bart,

I will update commit message next version.

Thanks
Peter