ufs: core: wlun suspend dev/link state error recovery
Subsystems (3)
PATCH 1/1 ufs: core: wlun suspend dev/link state error recovery
From: Peter Wang <[email protected]>
When wl suspend error occurs, for example, BKOP or SSU timeout, the host triggers an error handler and returns -EBUSY to break the wl suspend process. However, it is possible for the runtime PM to enter wl suspend again before the error handler has finished, and return -EINVAL because the device is in an error state. To address this, ensure that the rumtime PM waits for the error handler to finish, or trigger the error handler in such cases, because returning -EINVAL can cause the I/O to hang.
--- drivers/ufs/core/ufshcd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +4 -1
@@ -9791,7 +9791,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)/* UFS device & link must be active before we enter in this function */ if (!ufshcd_is_ufs_dev_active (hba) || !ufshcd_is_link_active (hba)) { - ret = -EINVAL ; +/* Wait err handler finish or tirgger err recovery in this case */ +if (!ufshcd_eh_in_progress (hba)) +ufshcd_force_error_recovery (hba); + ret = -EBUSY ; goto enable_scaling; }
Signature · 1 line
2.18.0
Bart Van Assche
reviewerQuoted 5 lines · On 3/28/24 03:47, [email protected] wrote:
drivers/ufs/core/ufshcd.c +0
-0
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) · line 9799
Quoted 10 lines
drivers/ufs/core/ufshcd.c +4
-1@@ -9791,7 +9791,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)/* UFS device & link must be active before we enter in this function */ if (!ufshcd_is_ufs_dev_active (hba) || !ufshcd_is_link_active (hba)) { - ret = -EINVAL ; +/* Wait err handler finish or tirgger err recovery in this case */ +if (!ufshcd_eh_in_progress (hba)) +ufshcd_force_error_recovery (hba); + ret = -EBUSY ; goto enable_scaling; }
Please fix the spelling in the above source code comment ("tirgger").
Thanks,
Bart.
Quoted 26 lines · Bart Van Assche
External email : Please do not click links or open attachments until you have verified the sender or the content.
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct
Quoted 5 lines · On 3/28/24 03:47, [email protected] wrote:
drivers/ufs/core/ufshcd.c +0
-0@@ -9791,7 +9791,10 @@ static int __ufshcd_wl_suspend(struct
ufs_hba*hba, enumufs_pm_oppm_op)drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct · line 9791
Quoted 2 lines
drivers/ufs/core/ufshcd.c +0
-0/* UFS device & link must be active before we enter in this function */
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct · line 9792
Quoted 1 line
drivers/ufs/core/ufshcd.c +0
-0if (!ufshcd_is_ufs_dev_active(hba) ||!ufshcd_is_link_active(hba)) {
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct · line 9793
Quoted 2 lines
drivers/ufs/core/ufshcd.c +1
-1-ret = -EINVAL ; +/* Wait err handler finish or tirgger err recovery in this case */
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) · line 9799
Quoted 5 lines
drivers/ufs/core/ufshcd.c +3
-0+if (!ufshcd_eh_in_progress (hba)) +ufshcd_force_error_recovery (hba); +ret = -EBUSY ; goto enable_scaling; }Please fix the spelling in the above source code comment ("tirgger").
Quoted 5 lines
Thanks,
Bart.
Hi Bart,
Will fix typo next version.
Thanks
Peter