Re: [PATCH v3 1/9] scsi: ufs: Differentiate status between hba pm ops and wl pm ops

From: Can Guo
Date: Tue Jun 22 2021 - 21:32:43 EST


Hi Bart,

On 2021-06-17 01:50, Bart Van Assche wrote:
On 6/9/21 9:43 PM, Can Guo wrote:
@@ -8784,7 +8786,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
enum ufs_dev_pwr_mode req_dev_pwr_mode;
enum uic_link_state req_link_state;

- hba->pm_op_in_progress = true;
+ hba->wl_pm_op_in_progress = true;
if (pm_op != UFS_SHUTDOWN_PM) {
pm_lvl = pm_op == UFS_RUNTIME_PM ?
hba->rpm_lvl : hba->spm_lvl;
@@ -8919,7 +8921,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
hba->clk_gating.is_suspended = false;
ufshcd_release(hba);
}
- hba->pm_op_in_progress = false;
+ hba->wl_pm_op_in_progress = false;
return ret;
}

Are the __ufshcd_wl_suspend() calls serialized in any way? If not, will
the value of wl_pm_op_in_progress be incorrect if multiple kernel
threads run __ufshcd_wl_suspend() concurrently and one of the
__ufshcd_wl_suspend() instances returns earlier than the other?


Sorry for getting back late on this... I was stuck by some urgent issues.

Yes, __ufshcd_wl_suspend() calls are serilized, because it is called by
either runtime suspend or system suspend, and runtime suspend and system
suspend are serialized - Rafael J. Wysocki has put a lot of efforts on it,
see also 1e2ef05bb8cf8 ("PM: Limit race conditions between runtime PM and
system sleep (v2)")).

Thanks,

Bart.