linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] scsi: ufs: skip shutdown if hba is not powered
@ 2019-09-18  4:20 Stanley Chu
  2019-09-19 15:49 ` [EXT] " Bean Huo (beanhuo)
  2019-09-24  2:24 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Stanley Chu @ 2019-09-18  4:20 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar,
	pedrom.sousa, jejb
  Cc: andy.teng, chun-hung.wu, kuohong.wang, linux-mediatek,
	peter.wang, matthias.bgg, Stanley Chu, linux-arm-kernel, beanhuo

In some cases, hba may go through shutdown flow without successful
initialization and then make system hang.

For example, if ufshcd_change_power_mode() gets error and
leads to ufshcd_hba_exit() to release resources of the host,
future shutdown flow may hang the system since the host register
will be accessed in unpowered state.

To solve this issue, simply add checking to skip shutdown for above
kind of situation.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 60a24fe908e7..a601ce0f6195 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8121,6 +8121,9 @@ int ufshcd_shutdown(struct ufs_hba *hba)
 {
 	int ret = 0;
 
+	if (!hba->is_powered)
+		goto out;
+
 	if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
 		goto out;
 
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [EXT] [PATCH v1] scsi: ufs: skip shutdown if hba is not powered
  2019-09-18  4:20 [PATCH v1] scsi: ufs: skip shutdown if hba is not powered Stanley Chu
@ 2019-09-19 15:49 ` Bean Huo (beanhuo)
  2019-09-24  2:24 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Bean Huo (beanhuo) @ 2019-09-19 15:49 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, avri.altman,
	alim.akhtar, pedrom.sousa, jejb
  Cc: andy.teng, chun-hung.wu, kuohong.wang, linux-mediatek,
	peter.wang, matthias.bgg, linux-arm-kernel

>To solve this issue, simply add checking to skip shutdown for above kind of
>situation.
>
>Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Acked-by: Bean Huo <beanhuo@micron.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1] scsi: ufs: skip shutdown if hba is not powered
  2019-09-18  4:20 [PATCH v1] scsi: ufs: skip shutdown if hba is not powered Stanley Chu
  2019-09-19 15:49 ` [EXT] " Bean Huo (beanhuo)
@ 2019-09-24  2:24 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-09-24  2:24 UTC (permalink / raw)
  To: Stanley Chu
  Cc: linux-scsi, martin.petersen, andy.teng, jejb, chun-hung.wu,
	kuohong.wang, avri.altman, linux-mediatek, peter.wang,
	alim.akhtar, matthias.bgg, pedrom.sousa, linux-arm-kernel,
	beanhuo


Stanley,

> In some cases, hba may go through shutdown flow without successful
> initialization and then make system hang.

Applied to 5.4/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-09-24  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18  4:20 [PATCH v1] scsi: ufs: skip shutdown if hba is not powered Stanley Chu
2019-09-19 15:49 ` [EXT] " Bean Huo (beanhuo)
2019-09-24  2:24 ` 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).