* [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
@ 2022-12-06 3:11 peter.wang
2022-12-06 3:33 ` Stanley Chu
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: peter.wang @ 2022-12-06 3:11 UTC (permalink / raw)
To: stanley.chu, linux-scsi, martin.petersen, avri.altman,
alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, peter.wang, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu
From: Peter Wang <peter.wang@mediatek.com>
When SSU/enter hibern8 fail in wlun suspend flow, trigger error
handler and return busy to break the suspend.
If not, wlun runtime pm status become error and the consumer will
stuck in runtime suspend status.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index b1f59a5fe632..98f105f32877 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -9049,6 +9049,19 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
if (!hba->dev_info.b_rpm_dev_flush_capable) {
ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode);
+ if (ret && pm_op != UFS_SHUTDOWN_PM) {
+ /*
+ * If return err in suspend flow, IO will hang.
+ * Trigger error handler and break suspend for
+ * error recovery.
+ */
+ spin_lock_irq(hba->host->host_lock);
+ hba->force_reset = true;
+ ufshcd_schedule_eh_work(hba);
+ spin_unlock_irq(hba->host->host_lock);
+
+ ret = -EBUSY;
+ }
if (ret)
goto enable_scaling;
}
@@ -9060,6 +9073,19 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
*/
check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
+ if (ret && pm_op != UFS_SHUTDOWN_PM) {
+ /*
+ * If return err in suspend flow, IO will hang.
+ * Trigger error handler and break suspend for
+ * error recovery.
+ */
+ spin_lock_irq(hba->host->host_lock);
+ hba->force_reset = true;
+ ufshcd_schedule_eh_work(hba);
+ spin_unlock_irq(hba->host->host_lock);
+
+ ret = -EBUSY;
+ }
if (ret)
goto set_dev_active;
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
2022-12-06 3:11 [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery peter.wang
@ 2022-12-06 3:33 ` Stanley Chu
2022-12-06 18:59 ` Bart Van Assche
2022-12-07 17:17 ` Adrian Hunter
2 siblings, 0 replies; 6+ messages in thread
From: Stanley Chu @ 2022-12-06 3:33 UTC (permalink / raw)
To: peter.wang
Cc: stanley.chu, linux-scsi, martin.petersen, avri.altman,
alim.akhtar, jejb, wsd_upstream, linux-mediatek, chun-hung.wu,
alice.chao, cc.chou, chaotian.jing, jiajie.hao, powen.kao,
qilin.tan, lin.gui, tun-yu.yu, eddie.huang, naomi.chu
On Tue, Dec 6, 2022 at 11:18 AM <peter.wang@mediatek.com> wrote:
>
> From: Peter Wang <peter.wang@mediatek.com>
>
> When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> handler and return busy to break the suspend.
> If not, wlun runtime pm status become error and the consumer will
> stuck in runtime suspend status.
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
2022-12-06 3:11 [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery peter.wang
2022-12-06 3:33 ` Stanley Chu
@ 2022-12-06 18:59 ` Bart Van Assche
2022-12-07 17:17 ` Adrian Hunter
2 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2022-12-06 18:59 UTC (permalink / raw)
To: peter.wang, stanley.chu, linux-scsi, martin.petersen, avri.altman,
alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao, powen.kao, qilin.tan, lin.gui,
tun-yu.yu, eddie.huang, naomi.chu
On 12/5/22 19:11, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
>
> When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> handler and return busy to break the suspend.
> If not, wlun runtime pm status become error and the consumer will
> stuck in runtime suspend status.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
2022-12-06 3:11 [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery peter.wang
2022-12-06 3:33 ` Stanley Chu
2022-12-06 18:59 ` Bart Van Assche
@ 2022-12-07 17:17 ` Adrian Hunter
2022-12-08 2:59 ` Peter Wang (王信友)
2022-12-08 3:01 ` Peter Wang (王信友)
2 siblings, 2 replies; 6+ messages in thread
From: Adrian Hunter @ 2022-12-07 17:17 UTC (permalink / raw)
To: peter.wang, stanley.chu, linux-scsi, martin.petersen, avri.altman,
alim.akhtar, jejb
Cc: wsd_upstream, linux-mediatek, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao, powen.kao, qilin.tan, lin.gui,
tun-yu.yu, eddie.huang, naomi.chu
On 6/12/22 05:11, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
>
> When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> handler and return busy to break the suspend.
> If not, wlun runtime pm status become error and the consumer will
> stuck in runtime suspend status.
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Should this have a Fixes or stable tag?
Another minor comment below, otherwise:
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index b1f59a5fe632..98f105f32877 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -9049,6 +9049,19 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>
> if (!hba->dev_info.b_rpm_dev_flush_capable) {
> ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode);
> + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> + /*
> + * If return err in suspend flow, IO will hang.
> + * Trigger error handler and break suspend for
> + * error recovery.
> + */
> + spin_lock_irq(hba->host->host_lock);
> + hba->force_reset = true;
> + ufshcd_schedule_eh_work(hba);
> + spin_unlock_irq(hba->host->host_lock);
> +
> + ret = -EBUSY;
> + }
> if (ret)
> goto enable_scaling;
> }
> @@ -9060,6 +9073,19 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> */
> check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
> + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> + /*
> + * If return err in suspend flow, IO will hang.
> + * Trigger error handler and break suspend for
> + * error recovery.
> + */
> + spin_lock_irq(hba->host->host_lock);
> + hba->force_reset = true;
> + ufshcd_schedule_eh_work(hba);
> + spin_unlock_irq(hba->host->host_lock);
Same 4 lines of code could be separated into a helper function.
> +
> + ret = -EBUSY;
> + }
> if (ret)
> goto set_dev_active;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
2022-12-07 17:17 ` Adrian Hunter
@ 2022-12-08 2:59 ` Peter Wang (王信友)
2022-12-08 3:01 ` Peter Wang (王信友)
1 sibling, 0 replies; 6+ messages in thread
From: Peter Wang (王信友) @ 2022-12-08 2:59 UTC (permalink / raw)
To: linux-scsi@vger.kernel.org, avri.altman@wdc.com,
alim.akhtar@samsung.com, Stanley Chu (朱原陞),
jejb@linux.ibm.com, martin.petersen@oracle.com,
adrian.hunter@intel.com
Cc: linux-mediatek@lists.infradead.org,
Jiajie Hao (郝加节),
CC Chou (周志杰),
Eddie Huang (黃智傑),
Alice Chao (趙珮均), wsd_upstream,
Lin Gui (桂林),
Chun-Hung Wu (巫駿宏),
Tun-yu Yu (游敦聿),
Chaotian Jing (井朝天),
Powen Kao (高伯文),
Naomi Chu (朱詠田),
Qilin Tan (谭麒麟)
On Wed, 2022-12-07 at 19:17 +0200, Adrian Hunter wrote:
> On 6/12/22 05:11, peter.wang@mediatek.com wrote:
> > From: Peter Wang <peter.wang@mediatek.com>
> >
> > When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> > handler and return busy to break the suspend.
> > If not, wlun runtime pm status become error and the consumer will
> > stuck in runtime suspend status.
> >
> > Signed-off-by: Peter Wang <peter.wang@mediatek.com>
>
> Should this have a Fixes or stable tag?
>
Hi Adrian,
Yes, will add Fixes tag.
Thanks for reminder.
> Another minor comment below, otherwise:
>
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
>
> > ---
> > drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index b1f59a5fe632..98f105f32877 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -9049,6 +9049,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> >
> > if (!hba->dev_info.b_rpm_dev_flush_capable) {
> > ret = ufshcd_set_dev_pwr_mode(hba,
> > req_dev_pwr_mode);
> > + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> > + /*
> > + * If return err in suspend flow, IO
> > will hang.
> > + * Trigger error handler and break
> > suspend for
> > + * error recovery.
> > + */
> > + spin_lock_irq(hba->host->host_lock);
> > + hba->force_reset = true;
> > + ufshcd_schedule_eh_work(hba);
> > + spin_unlock_irq(hba->host->host_lock);
> > +
> > + ret = -EBUSY;
> > + }
> > if (ret)
> > goto enable_scaling;
> > }
> > @@ -9060,6 +9073,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> > */
> > check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> > ret = ufshcd_link_state_transition(hba, req_link_state,
> > check_for_bkops);
> > + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> > + /*
> > + * If return err in suspend flow, IO will hang.
> > + * Trigger error handler and break suspend for
> > + * error recovery.
> > + */
> > + spin_lock_irq(hba->host->host_lock);
> > + hba->force_reset = true;
> > + ufshcd_schedule_eh_work(hba);
> > + spin_unlock_irq(hba->host->host_lock);
>
> Same 4 lines of code could be separated into a helper function.
OK, will change next version.
Thanks for review.
>
> > +
> > + ret = -EBUSY;
> > + }
> > if (ret)
> > goto set_dev_active;
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
2022-12-07 17:17 ` Adrian Hunter
2022-12-08 2:59 ` Peter Wang (王信友)
@ 2022-12-08 3:01 ` Peter Wang (王信友)
1 sibling, 0 replies; 6+ messages in thread
From: Peter Wang (王信友) @ 2022-12-08 3:01 UTC (permalink / raw)
To: linux-scsi@vger.kernel.org, avri.altman@wdc.com,
alim.akhtar@samsung.com, Stanley Chu (朱原陞),
jejb@linux.ibm.com, martin.petersen@oracle.com,
adrian.hunter@intel.com
Cc: linux-mediatek@lists.infradead.org,
Jiajie Hao (郝加节),
CC Chou (周志杰),
Eddie Huang (黃智傑),
Alice Chao (趙珮均), wsd_upstream,
Lin Gui (桂林),
Chun-Hung Wu (巫駿宏),
Tun-yu Yu (游敦聿),
Chaotian Jing (井朝天),
Powen Kao (高伯文),
Naomi Chu (朱詠田),
Qilin Tan (谭麒麟)
On Wed, 2022-12-07 at 19:17 +0200, Adrian Hunter wrote:
> On 6/12/22 05:11, peter.wang@mediatek.com wrote:
> > From: Peter Wang <peter.wang@mediatek.com>
> >
> > When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> > handler and return busy to break the suspend.
> > If not, wlun runtime pm status become error and the consumer will
> > stuck in runtime suspend status.
> >
> > Signed-off-by: Peter Wang <peter.wang@mediatek.com>
>
> Should this have a Fixes or stable tag?
>
> Another minor comment below, otherwise:
>
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
>
> > ---
> > drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index b1f59a5fe632..98f105f32877 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -9049,6 +9049,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> >
> > if (!hba->dev_info.b_rpm_dev_flush_capable) {
> > ret = ufshcd_set_dev_pwr_mode(hba,
> > req_dev_pwr_mode);
> > + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> > + /*
> > + * If return err in suspend flow, IO
> > will hang.
> > + * Trigger error handler and break
> > suspend for
> > + * error recovery.
> > + */
> > + spin_lock_irq(hba->host->host_lock);
> > + hba->force_reset = true;
> > + ufshcd_schedule_eh_work(hba);
> > + spin_unlock_irq(hba->host->host_lock);
> > +
> > + ret = -EBUSY;
> > + }
> > if (ret)
> > goto enable_scaling;
> > }
> > @@ -9060,6 +9073,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> > */
> > check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> > ret = ufshcd_link_state_transition(hba, req_link_state,
> > check_for_bkops);
> > + if (ret && pm_op != UFS_SHUTDOWN_PM) {
> > + /*
> > + * If return err in suspend flow, IO will hang.
> > + * Trigger error handler and break suspend for
> > + * error recovery.
> > + */
> > + spin_lock_irq(hba->host->host_lock);
> > + hba->force_reset = true;
> > + ufshcd_schedule_eh_work(hba);
> > + spin_unlock_irq(hba->host->host_lock);
>
> Same 4 lines of code could be separated into a helper function.
>
> > +
> > + ret = -EBUSY;
> > + }
> > if (ret)
> > goto set_dev_active;
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-12-08 3:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-06 3:11 [PATCH v4] ufs: core: wlun suspend SSU/enter hibern8 fail recovery peter.wang
2022-12-06 3:33 ` Stanley Chu
2022-12-06 18:59 ` Bart Van Assche
2022-12-07 17:17 ` Adrian Hunter
2022-12-08 2:59 ` Peter Wang (王信友)
2022-12-08 3:01 ` Peter Wang (王信友)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox