2019-11-18 03:57:02

by Can Guo

[permalink] [raw]
Subject: [PATCH v2 3/4] scsi: ufs: Avoid messing up the compl_time_stamp of lrbs

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 <[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 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


2019-11-18 13:23:06

by Alim Akhtar

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] scsi: ufs: Avoid messing up the compl_time_stamp of lrbs

On Mon, Nov 18, 2019 at 9:27 AM Can Guo <[email protected]> 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 <[email protected]>
> ---
Tested-by: Alim Akhtar <[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 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
>


--
Regards,
Alim