[lkml]   [2021]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v1 3/3] scsi: ufs: Narrow down fast pass in system suspend path
If spm_lvl is set to 0 or 1, when system suspend kicks start and hba is
runtime active, system suspend may just bail without doing anything (the
fast pass), leaving other contexts still running, e.g., clock gating and
clock scaling. When system resume kicks start, concurrency can happen btw
ufshcd_resume() and these contexts, leading to various stability issues.
Fix it by adding a check against hba's runtime status and allowing fast
pass only if hba is runtime suspended, otherwise let system suspend go
ahead call ufshcd_suspend(). This can guarantee that these contexts are
stopped by either runtime suspend or system suspend.

Fixes: 0b257734344aa ("scsi: ufs: optimize system suspend handling")
Signed-off-by: Can Guo <>
drivers/scsi/ufs/ufshcd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 090b654..1fd965f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9060,7 +9060,8 @@ int ufshcd_system_suspend(struct ufs_hba *hba)


- if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
+ if (pm_runtime_suspended(hba->dev) &&
+ (ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
hba->curr_dev_pwr_mode) &&
(ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) ==
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
 \ /
  Last update: 2021-04-26 04:28    [W:0.036 / U:6.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site