diff mbox series

[v1,1/3] scsi: ufs: Remove a redundant command completion logic in error handler

Message ID 1621845419-14194-2-git-send-email-cang@codeaurora.org (mailing list archive)
State Changes Requested
Headers show
Series Optimize host lock on TR send/compl paths and utilize UTRLCNR | expand

Commit Message

Can Guo May 24, 2021, 8:36 a.m. UTC
ufshcd_host_reset_and_restore() anyways completes all pending requests
before starts re-probing, so there is no need to complete the command on
the highest bit in tr_doorbell in advance.

Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 13 -------------
 1 file changed, 13 deletions(-)

Comments

Bart Van Assche May 24, 2021, 4:43 p.m. UTC | #1
On 5/24/21 1:36 AM, Can Guo wrote:
> ufshcd_host_reset_and_restore() anyways completes all pending requests
> before starts re-probing, so there is no need to complete the command on
> the highest bit in tr_doorbell in advance.
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index d543864..c4b37d2 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6123,19 +6123,6 @@ static void ufshcd_err_handler(struct work_struct *work)
>  do_reset:
>  	/* Fatal errors need reset */
>  	if (needs_reset) {
> -		unsigned long max_doorbells = (1UL << hba->nutrs) - 1;
> -
> -		/*
> -		 * ufshcd_reset_and_restore() does the link reinitialization
> -		 * which will need atleast one empty doorbell slot to send the
> -		 * device management commands (NOP and query commands).
> -		 * If there is no slot empty at this moment then free up last
> -		 * slot forcefully.
> -		 */
> -		if (hba->outstanding_reqs == max_doorbells)
> -			__ufshcd_transfer_req_compl(hba,
> -						    (1UL << (hba->nutrs - 1)));
> -
>  		hba->force_reset = false;
>  		spin_unlock_irqrestore(hba->host->host_lock, flags);
>  		err = ufshcd_reset_and_restore(hba);
> 

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Stanley Chu May 25, 2021, 4:15 a.m. UTC | #2
On Mon, 2021-05-24 at 01:36 -0700, Can Guo wrote:
> ufshcd_host_reset_and_restore() anyways completes all pending requests
> before starts re-probing, so there is no need to complete the command on
> the highest bit in tr_doorbell in advance.
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index d543864..c4b37d2 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6123,19 +6123,6 @@ static void ufshcd_err_handler(struct work_struct *work)
>  do_reset:
>  	/* Fatal errors need reset */
>  	if (needs_reset) {
> -		unsigned long max_doorbells = (1UL << hba->nutrs) - 1;
> -
> -		/*
> -		 * ufshcd_reset_and_restore() does the link reinitialization
> -		 * which will need atleast one empty doorbell slot to send the
> -		 * device management commands (NOP and query commands).
> -		 * If there is no slot empty at this moment then free up last
> -		 * slot forcefully.
> -		 */
> -		if (hba->outstanding_reqs == max_doorbells)
> -			__ufshcd_transfer_req_compl(hba,
> -						    (1UL << (hba->nutrs - 1)));
> -
>  		hba->force_reset = false;
>  		spin_unlock_irqrestore(hba->host->host_lock, flags);
>  		err = ufshcd_reset_and_restore(hba);

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Bean Huo May 31, 2021, 7:14 a.m. UTC | #3
On Mon, 2021-05-24 at 01:36 -0700, Can Guo wrote:
> ufshcd_host_reset_and_restore() anyways completes all pending
> requests
> 
> before starts re-probing, so there is no need to complete the command
> on
> 
> the highest bit in tr_doorbell in advance.
> 
> 
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>

Looks good to me.

Reviewed-by: Bean Huo <beanhuo@micron.com>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index d543864..c4b37d2 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6123,19 +6123,6 @@  static void ufshcd_err_handler(struct work_struct *work)
 do_reset:
 	/* Fatal errors need reset */
 	if (needs_reset) {
-		unsigned long max_doorbells = (1UL << hba->nutrs) - 1;
-
-		/*
-		 * ufshcd_reset_and_restore() does the link reinitialization
-		 * which will need atleast one empty doorbell slot to send the
-		 * device management commands (NOP and query commands).
-		 * If there is no slot empty at this moment then free up last
-		 * slot forcefully.
-		 */
-		if (hba->outstanding_reqs == max_doorbells)
-			__ufshcd_transfer_req_compl(hba,
-						    (1UL << (hba->nutrs - 1)));
-
 		hba->force_reset = false;
 		spin_unlock_irqrestore(hba->host->host_lock, flags);
 		err = ufshcd_reset_and_restore(hba);