scsi: ufs: core: Schedule EH on WLUN resume failure
Subsystems (2)
PATCH 1/1 scsi: ufs: core: Schedule EH on WLUN resume failure
From: Brian Kao <[email protected]>
On WLUN resume failed, core driver leaves wlun dev in error runtime PM state without taking further action. To ensure the driver can recover from such errors, this patch schedules the error handler to perform a full reset when error occurs during WLUN resume.
--- drivers/ufs/core/ufshcd.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/ufs/core/ufshcd.c +9 -0
@@ -10236,6 +10236,15 @@ static int __ufshcd_wl_resume(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; + +if (ret) { +/* ufshcd_reset_and_restore() might set host to UFSHCD_STATE_ERROR */ +scoped_guard (spinlock_irqsave, hba->host->host_lock) + hba->ufshcd_state = UFSHCD_STATE_RESET; + +ufshcd_force_error_recovery (hba); + } +return ret; }
base-commit: a9e03ec01ef2633288fd1b506980f54ae41c5a85
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Quoted 8 lines · Po-Wen Kao
From: Brian Kao <[email protected]>
On WLUN resume failed, core driver leaves wlun dev in error runtime PM state without taking further action. To ensure the driver can recover
from such errors, this patch schedules the error handler to perform a full reset when error occurs during WLUN resume.
Hi Powen,
May I know at which step in __ufshcd_wl_resume the error occurred?
Quoted 24 lines
Signed-off-by Brian Kao <[email protected]>---
drivers/ufs/core/ufshcd.c | 9 +++++++++1 file changed, 9 insertions(+)drivers/ufs/core/ufshcd.c +3
-0@@ -10236,6 +10236,15 @@ static int __ufshcd_wl_resume(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; + +if (ret) { +/* ufshcd_reset_and_restore() might set host to
UFSHCD_STATE_ERROR*/drivers/ufs/core/ufshcd.c +6
-0+scoped_guard (spinlock_irqsave, hba->host->host_lock) + hba->ufshcd_state = UFSHCD_STATE_RESET; + +ufshcd_force_error_recovery (hba); + } +
Quoted 2 lines
return ret;
After recovery, is the return value still an error?
Thanks.
Peter
Quoted 4 lines
}
base-commit:
a9e03ec01ef2633288fd1b506980f54ae41c5a85
A message that is not in the archive (sent off-list or not yet received): CA+=0d2ZKT7ynBLvBcqM3YqLk7tX3knhpNwyL9LKxjB3=KvpVMg@mail.gmail.com
[RESEND in plaintext]
Hi Peter,
Quoted 1 line
May I know at which step in
__ufshcd_wl_resumethe error occurred?
In our case, ufshcd_reset_and_restore() may return errors due to Link Startup (LSS) failure.
Quoted 1 line
After recovery, is the return value still an error?
Since the error handler is scheduled to run asynchronously, the error still propagates to the runtime PM framework when __ufshcd_wl_resume() returns. If LSS succeeds during the error handler's execution, the runtime PM error should be cleared in ufshcd_recover_pm_error(), returning the host to an operational state.
Best regards,
Brian Kao
Quoted 11 lines · Brian Kao
Hi Peter,
Quoted 1 line
May I know at which step in
__ufshcd_wl_resumethe error occurred?In our case,
ufshcd_reset_and_restore()may return errors due to Link Startup (LSS) failure.Quoted 1 line
After recovery, is the return value still an error?
Since the error handler is scheduled to run asynchronously, the error still propagates to the runtime PM framework when
__ufshcd_wl_resume()returns. If LSS succeeds during the error handler's execution, the runtime PM error should be cleared inufshcd_recover_pm_error(), returning the host to an operational state.Best regards,
Brian Kao
Quoted 19 lines · Po-Wen Kao
drivers/ufs/core/ufshcd.c +3
-0@@ -10236,6 +10236,15 @@ static int __ufshcd_wl_resume(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; + +if (ret) { +/* ufshcd_reset_and_restore() might set host to
UFSHCD_STATE_ERROR*/drivers/ufs/core/ufshcd.c +6
-0+scoped_guard (spinlock_irqsave, hba->host->host_lock) + hba->ufshcd_state = UFSHCD_STATE_RESET; + +ufshcd_force_error_recovery (hba); + } +
Quoted 3 lines
return ret;
}
Bart Van Assche
reviewerQuoted 21 lines · Po-Wen Kao
From: Brian Kao <[email protected]>
On WLUN resume failed, core driver leaves wlun dev in error runtime PM state without taking further action. To ensure the driver can recover from such errors, this patch schedules the error handler to perform a full reset when error occurs during WLUN resume.
Signed-off-by Brian Kao <[email protected]>--- drivers/ufs/core/ufshcd.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/ufs/core/ufshcd.c +1
-0@@ -10236,6 +10236,15 @@ static int __ufshcd_wl_resume(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; +
drivers/ufs/core/ufshcd.c static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) · line 10249
Quoted 10 lines
drivers/ufs/core/ufshcd.c +8
-0+if (ret) { +/* ufshcd_reset_and_restore() might set host to UFSHCD_STATE_ERROR */ +scoped_guard (spinlock_irqsave, hba->host->host_lock) + hba->ufshcd_state = UFSHCD_STATE_RESET; + +ufshcd_force_error_recovery (hba); + } +return ret; }
Isn't the hba->ufshcd_state assignment needed for all ufshcd_force_error_recovery() callers? I'm wondering whether that assignment should be moved into ufshcd_force_error_recovery().
Thanks,
Bart.