* [PATCH v1] scsi: ufs: skip shutdown if hba is not powered
@ 2019-09-18 4:20 Stanley Chu
[not found] ` <1568780438-28753-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Stanley Chu @ 2019-09-18 4:20 UTC (permalink / raw)
To: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
martin.petersen-QHcLZuEGTsvQT0dZR+AlfA, avri.altman-Sjgp3cTcYWE,
alim.akhtar-Sze3O3UU22JBDgjK7y7TUQ,
pedrom.sousa-HKixBCOQz3hWk0Htik3J/w, jejb-tEXmvtCZX7AybS5Ee8rs3A
Cc: andy.teng-NuS5LvNUpcJWk0Htik3J/w,
chun-hung.wu-NuS5LvNUpcJWk0Htik3J/w,
kuohong.wang-NuS5LvNUpcJWk0Htik3J/w,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
peter.wang-NuS5LvNUpcJWk0Htik3J/w,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, Stanley Chu,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
beanhuo-AL4WhLSQfzjQT0dZR+AlfA
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-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1568780438-28753-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* RE: [EXT] [PATCH v1] scsi: ufs: skip shutdown if hba is not powered [not found] ` <1568780438-28753-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, martin.petersen-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, avri.altman-Sjgp3cTcYWE@public.gmane.org, alim.akhtar-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, pedrom.sousa-HKixBCOQz3hWk0Htik3J/w@public.gmane.org, jejb-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org Cc: andy.teng-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, chun-hung.wu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, kuohong.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, peter.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org >To solve this issue, simply add checking to skip shutdown for above kind of >situation. > >Signed-off-by: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> Acked-by: Bean Huo <beanhuo-AL4WhLSQfzjQT0dZR+AlfA@public.gmane.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] scsi: ufs: skip shutdown if hba is not powered [not found] ` <1568780438-28753-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 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-u79uwXL29TY76Z2rM5mHXA, martin.petersen-QHcLZuEGTsvQT0dZR+AlfA, andy.teng-NuS5LvNUpcJWk0Htik3J/w, jejb-tEXmvtCZX7AybS5Ee8rs3A, chun-hung.wu-NuS5LvNUpcJWk0Htik3J/w, kuohong.wang-NuS5LvNUpcJWk0Htik3J/w, avri.altman-Sjgp3cTcYWE, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, peter.wang-NuS5LvNUpcJWk0Htik3J/w, alim.akhtar-Sze3O3UU22JBDgjK7y7TUQ, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, pedrom.sousa-HKixBCOQz3hWk0Htik3J/w, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, beanhuo-AL4WhLSQfzjQT0dZR+AlfA 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-24 2:24 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
[not found] ` <1568780438-28753-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
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).