diff mbox series

[v2,3/4] scsi: ufs: Avoid messing up the compl_time_stamp of lrbs

Message ID 0101016e7ca63d9d-c9360196-acbf-4e53-9041-ccf8935f0d2b-000000@us-west-2.amazonses.com (mailing list archive)
State Changes Requested
Headers show
Series UFS driver general fixes bundle 5 | expand

Commit Message

Can Guo Nov. 18, 2019, 3:54 a.m. UTC
To be on the safe side, do not touch one lrb after clear its slot in the
lrb_in_use bitmap to avoid messing up the next task which would possibly
occupy this lrb.

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

Comments

Alim Akhtar Nov. 18, 2019, 1:20 p.m. UTC | #1
On Mon, Nov 18, 2019 at 9:27 AM Can Guo <cang@codeaurora.org> wrote:
>
> To be on the safe side, do not touch one lrb after clear its slot in the
> lrb_in_use bitmap to avoid messing up the next task which would possibly
> occupy this lrb.
>
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>

>  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 8e7c362..5950a7c 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4902,12 +4902,14 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
>                         cmd->result = result;
>                         /* Mark completed command as NULL in LRB */
>                         lrbp->cmd = NULL;
> +                       lrbp->compl_time_stamp = ktime_get();
>                         clear_bit_unlock(index, &hba->lrb_in_use);
>                         /* Do not touch lrbp after scsi done */
>                         cmd->scsi_done(cmd);
>                         __ufshcd_release(hba);
>                 } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
>                         lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
> +                       lrbp->compl_time_stamp = ktime_get();
>                         if (hba->dev_cmd.complete) {
>                                 ufshcd_add_command_trace(hba, index,
>                                                 "dev_complete");
> @@ -4916,8 +4918,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
>                 }
>                 if (ufshcd_is_clkscaling_supported(hba))
>                         hba->clk_scaling.active_reqs--;
> -
> -               lrbp->compl_time_stamp = ktime_get();
>         }
>
>         /* clear corresponding bits of completed commands */
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8e7c362..5950a7c 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4902,12 +4902,14 @@  static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 			cmd->result = result;
 			/* Mark completed command as NULL in LRB */
 			lrbp->cmd = NULL;
+			lrbp->compl_time_stamp = ktime_get();
 			clear_bit_unlock(index, &hba->lrb_in_use);
 			/* Do not touch lrbp after scsi done */
 			cmd->scsi_done(cmd);
 			__ufshcd_release(hba);
 		} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
 			lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
+			lrbp->compl_time_stamp = ktime_get();
 			if (hba->dev_cmd.complete) {
 				ufshcd_add_command_trace(hba, index,
 						"dev_complete");
@@ -4916,8 +4918,6 @@  static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 		}
 		if (ufshcd_is_clkscaling_supported(hba))
 			hba->clk_scaling.active_reqs--;
-
-		lrbp->compl_time_stamp = ktime_get();
 	}
 
 	/* clear corresponding bits of completed commands */