2020-03-16 03:44:13

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v5 7/8] scsi: ufs: make HCE polling more compact to improve initialization latency

Reduce the waiting period between each HCE (Host Controller Enable)
polling from 5 ms to 1 ms. In the same time, increase the maximum polling
times to make "total polling time" unchanged approximately.

This change could make HCE initializatoin faster to improve latency of
ufshcd initialization, error recovery, and resume behaviors.

Signed-off-by: Stanley Chu <[email protected]>
Reviewed-by: Avri Altman <[email protected]>
---
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 dcbf45d547d8..cd33d07c56cf 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4301,7 +4301,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
ufshcd_wait_us(hba->hba_enable_delay_us, 100, true);

/* wait for the host controller to complete initialization */
- retry = 10;
+ retry = 50;
while (ufshcd_is_hba_active(hba)) {
if (retry) {
retry--;
@@ -4310,7 +4310,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
"Controller enable failed\n");
return -EIO;
}
- ufshcd_wait_us(5000, 100, true);
+ ufshcd_wait_us(1000, 100, true);
}

/* enable UIC related interrupts */
--
2.18.0


2020-03-16 06:37:08

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v5 7/8] scsi: ufs: make HCE polling more compact to improve initialization latency

On 2020-03-16 11:42, Stanley Chu wrote:
> Reduce the waiting period between each HCE (Host Controller Enable)
> polling from 5 ms to 1 ms. In the same time, increase the maximum
> polling
> times to make "total polling time" unchanged approximately.
>
> This change could make HCE initializatoin faster to improve latency of
> ufshcd initialization, error recovery, and resume behaviors.
>
> Signed-off-by: Stanley Chu <[email protected]>
> Reviewed-by: Avri Altman <[email protected]>

Reviewed-by: Can Guo <[email protected]>

> ---
> 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 dcbf45d547d8..cd33d07c56cf 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4301,7 +4301,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
> ufshcd_wait_us(hba->hba_enable_delay_us, 100, true);
>
> /* wait for the host controller to complete initialization */
> - retry = 10;
> + retry = 50;
> while (ufshcd_is_hba_active(hba)) {
> if (retry) {
> retry--;
> @@ -4310,7 +4310,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba)
> "Controller enable failed\n");
> return -EIO;
> }
> - ufshcd_wait_us(5000, 100, true);
> + ufshcd_wait_us(1000, 100, true);
> }
>
> /* enable UIC related interrupts */