linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1] ufs: relocate flush of exceptional event
       [not found] <CGME20201219065127epcas2p4ee350f78ba75619dfd502dbb2e694a9b@epcas2p4.samsung.com>
@ 2020-12-19  6:40 ` Kiwoong Kim
  2020-12-20  5:48   ` Can Guo
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kiwoong Kim @ 2020-12-19  6:40 UTC (permalink / raw)
  To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim
  Cc: Kiwoong Kim

I found one case as follows and the current flush
location doesn't guarantee disabling BKOPS in the
case of requsting device power off.
1) The exceptional event handler is queued.
2) ufs suspend starts with a request of device power off
3) BKOPS is disabled in ufs suspend
4) The queued work for the handler is done and BKOPS
is enabled again.

Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 92d433d..414025c 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8608,6 +8608,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 			ufshcd_wb_need_flush(hba));
 	}
 
+	flush_work(&hba->eeh_work);
+
 	if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) {
 		if ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) ||
 		    !ufshcd_is_runtime_pm(pm_op)) {
@@ -8622,8 +8624,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 		}
 	}
 
-	flush_work(&hba->eeh_work);
-
 	/*
 	 * In the case of DeepSleep, the device is expected to remain powered
 	 * with the link off, so do not check for bkops.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH v1] ufs: relocate flush of exceptional event
  2020-12-19  6:40 ` [RFC PATCH v1] ufs: relocate flush of exceptional event Kiwoong Kim
@ 2020-12-20  5:48   ` Can Guo
  2020-12-20 14:09   ` Stanley Chu
  2021-01-08  4:19   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Can Guo @ 2020-12-20  5:48 UTC (permalink / raw)
  To: Kiwoong Kim
  Cc: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, bvanassche, grant.jung, sc.suh, hy50.seo,
	sh425.lee, bhoon95.kim

On 2020-12-19 14:40, Kiwoong Kim wrote:
> I found one case as follows and the current flush
> location doesn't guarantee disabling BKOPS in the
> case of requsting device power off.
> 1) The exceptional event handler is queued.
> 2) ufs suspend starts with a request of device power off
> 3) BKOPS is disabled in ufs suspend
> 4) The queued work for the handler is done and BKOPS
> is enabled again.
> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 92d433d..414025c 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8608,6 +8608,8 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
>  			ufshcd_wb_need_flush(hba));
>  	}
> 
> +	flush_work(&hba->eeh_work);
> +
>  	if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) {
>  		if ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) ||
>  		    !ufshcd_is_runtime_pm(pm_op)) {
> @@ -8622,8 +8624,6 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
>  		}
>  	}
> 
> -	flush_work(&hba->eeh_work);
> -
>  	/*
>  	 * In the case of DeepSleep, the device is expected to remain powered
>  	 * with the link off, so do not check for bkops.

Reviewed-by: Can Guo <cang@codeaurora.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH v1] ufs: relocate flush of exceptional event
  2020-12-19  6:40 ` [RFC PATCH v1] ufs: relocate flush of exceptional event Kiwoong Kim
  2020-12-20  5:48   ` Can Guo
@ 2020-12-20 14:09   ` Stanley Chu
  2021-01-08  4:19   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Stanley Chu @ 2020-12-20 14:09 UTC (permalink / raw)
  To: Kiwoong Kim
  Cc: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim

On Sat, 2020-12-19 at 15:40 +0900, Kiwoong Kim wrote:
> I found one case as follows and the current flush
> location doesn't guarantee disabling BKOPS in the
> case of requsting device power off.
> 1) The exceptional event handler is queued.
> 2) ufs suspend starts with a request of device power off
> 3) BKOPS is disabled in ufs suspend
> 4) The queued work for the handler is done and BKOPS
> is enabled again.
> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH v1] ufs: relocate flush of exceptional event
  2020-12-19  6:40 ` [RFC PATCH v1] ufs: relocate flush of exceptional event Kiwoong Kim
  2020-12-20  5:48   ` Can Guo
  2020-12-20 14:09   ` Stanley Chu
@ 2021-01-08  4:19   ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2021-01-08  4:19 UTC (permalink / raw)
  To: grant.jung, linux-scsi, bvanassche, hy50.seo, Kiwoong Kim, cang,
	jejb, beanhuo, avri.altman, asutoshd, bhoon95.kim, alim.akhtar,
	sc.suh, sh425.lee
  Cc: Martin K . Petersen

On Sat, 19 Dec 2020 15:40:39 +0900, Kiwoong Kim wrote:

> I found one case as follows and the current flush
> location doesn't guarantee disabling BKOPS in the
> case of requsting device power off.
> 1) The exceptional event handler is queued.
> 2) ufs suspend starts with a request of device power off
> 3) BKOPS is disabled in ufs suspend
> 4) The queued work for the handler is done and BKOPS
> is enabled again.

Applied to 5.11/scsi-fixes, thanks!

[1/1] ufs: relocate flush of exceptional event
      https://git.kernel.org/mkp/scsi/c/6948a96a0d69

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-08  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201219065127epcas2p4ee350f78ba75619dfd502dbb2e694a9b@epcas2p4.samsung.com>
2020-12-19  6:40 ` [RFC PATCH v1] ufs: relocate flush of exceptional event Kiwoong Kim
2020-12-20  5:48   ` Can Guo
2020-12-20 14:09   ` Stanley Chu
2021-01-08  4:19   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).