Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-13 Thread Bart Van Assche
On 2020-08-13 01:55, Stanley Chu wrote: > I tried many ways to come out the final solution. Currently two options > are considered, > > == Option 1 == > pm_runtime_get_sync(hba->dev); > > shost_for_each_device(sdev, hba->host) { > scsi_autopm_get_device(sdev); >

Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-13 Thread Stanley Chu
Hi Bart, Can, Chaotian, Very appreciate your comments and suggestions, please see update below, On Tue, 2020-08-04 at 00:04 +0800, Bart Van Assche wrote: > On 2020-08-03 03:04, Stanley Chu wrote: > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > > index 307622284239..7cb220

Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-03 Thread Bart Van Assche
On 2020-08-03 03:04, Stanley Chu wrote: > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 307622284239..7cb220b3fde0 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -8640,6 +8640,7 @@ EXPORT_SYMBOL(ufshcd_runtime_idle); > int ufshcd_shutdo

Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-03 Thread Can Guo
Hi Stanley, Sorry for the noises, please ignore my previous 2 mails and let's focus on this one. On 2020-08-03 18:04, Stanley Chu wrote: Currently I/O request could be still submitted to UFS device while UFS is working on shutdown flow. This may lead to racing as below scenarios and finally sys

Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-03 Thread Can Guo
Slightly updated my comments On 2020-08-03 19:50, Can Guo wrote: Hi Stanley, On 2020-08-03 18:04, Stanley Chu wrote: Currently I/O request could be still submitted to UFS device while UFS is working on shutdown flow. This may lead to racing as below scenarios and finally system may crash due t

Re: [PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-03 Thread Can Guo
Hi Stanley, On 2020-08-03 18:04, Stanley Chu wrote: Currently I/O request could be still submitted to UFS device while UFS is working on shutdown flow. This may lead to racing as below scenarios and finally system may crash due to unclocked register accesses. To fix this kind of issues, in ufsh

[PATCH v7] scsi: ufs: Quiesce all scsi devices before shutdown

2020-08-03 Thread Stanley Chu
Currently I/O request could be still submitted to UFS device while UFS is working on shutdown flow. This may lead to racing as below scenarios and finally system may crash due to unclocked register accesses. To fix this kind of issues, in ufshcd_shutdown(), 1. Use pm_runtime_get_sync() instead of