Skip to contentSkip to conversation

ufs: core: wlun suspend dev/link state error recovery

PATCH Applied [email protected] 3 participants 3 messages Mar 29, 2024 – Apr 2, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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
index e30fd125988d..292b06f361a2 100644
@@ -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 trigger err recovery */
+		if (!ufshcd_eh_in_progress(hba))
+			ufshcd_force_error_recovery(hba);
+		ret = -EBUSY;
 		goto enable_scaling;
 	}
 
Signature · 1 line
2.18.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · On 3/28/24 6:50 PM, [email protected] wrote:

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.

#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Fri, 29 Mar 2024 09:50:36 +0800, [email protected] wrote:

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.

[...]

Applied to 6.9/scsi-fixes, thanks!

[1/1] ufs: core: wlun suspend dev/link state error recovery

      https://git.kernel.org/mkp/scsi/c/6bc5e70b1c79
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering