2023-04-25 03:27:38

by Keoseong Park

[permalink] [raw]
Subject: [PATCH] scsi: ufs: core: Fix IO hang that occurs when BKOPS fails in W-LUN suspend

Even when urgent BKOPS fails, the consumer will get stuck in runtime
suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend
SSU/enter hibern8 fail recovery"), trigger the error handler and return
-EBUSY to break the suspend.

Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
Signed-off-by: Keoseong Park <[email protected]>
---
drivers/ufs/core/ufshcd.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9434328ba323..24966e9af720 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9457,8 +9457,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* that performance might be impacted.
*/
ret = ufshcd_urgent_bkops(hba);
- if (ret)
+ if (ret) {
+ /*
+ * If return err in suspend flow, IO will hang.
+ * Trigger error handler and break suspend for
+ * error recovery.
+ */
+ ufshcd_force_error_recovery(hba);
+ ret = -EBUSY;
goto enable_scaling;
+ }
} else {
/* make sure that auto bkops is disabled */
ufshcd_disable_auto_bkops(hba);
--
2.17.1


2023-05-01 08:45:18

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH] scsi: ufs: core: Fix IO hang that occurs when BKOPS fails in W-LUN suspend


> Even when urgent BKOPS fails, the consumer will get stuck in runtime
> suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend
> SSU/enter hibern8 fail recovery"), trigger the error handler and return
> -EBUSY to break the suspend.
>
> Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
> Signed-off-by: Keoseong Park <[email protected]>
Reviewed-by: Avri Altman <[email protected]>

Thanks,
Avri

> ---
> drivers/ufs/core/ufshcd.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 9434328ba323..24966e9af720 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9457,8 +9457,16 @@ static int __ufshcd_wl_suspend(struct ufs_hba
> *hba, enum ufs_pm_op pm_op)
> * that performance might be impacted.
> */
> ret = ufshcd_urgent_bkops(hba);
> - if (ret)
> + if (ret) {
> + /*
> + * If return err in suspend flow, IO will hang.
> + * Trigger error handler and break suspend for
> + * error recovery.
> + */
> + ufshcd_force_error_recovery(hba);
> + ret = -EBUSY;
> goto enable_scaling;
> + }
> } else {
> /* make sure that auto bkops is disabled */
> ufshcd_disable_auto_bkops(hba);
> --
> 2.17.1

2023-05-08 12:32:34

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: ufs: core: Fix IO hang that occurs when BKOPS fails in W-LUN suspend

On Tue, 25 Apr 2023 12:17:21 +0900, Keoseong Park wrote:

> Even when urgent BKOPS fails, the consumer will get stuck in runtime
> suspend status. Like commit 1a5665fc8d7a ("scsi: ufs: core: WLUN suspend
> SSU/enter hibern8 fail recovery"), trigger the error handler and return
> -EBUSY to break the suspend.
>
>

Applied to 6.4/scsi-fixes, thanks!

[1/1] scsi: ufs: core: Fix IO hang that occurs when BKOPS fails in W-LUN suspend
https://git.kernel.org/mkp/scsi/c/1a7edd041f2d

--
Martin K. Petersen Oracle Linux Engineering