2020-08-06 05:09:24

by Can Guo

[permalink] [raw]
Subject: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully

In current UFS task abort hook, namely ufshcd_abort(), if a task is
aborted successfully, clock scaling busy time statistics is not updated
and, most important, clk_gating.active_reqs is not decreased, which makes
clk_gating.active_reqs stay above zero forever, thus clock gating would
never happen. To fix it, instead of releasing resources "mannually", use
the existing func __ufshcd_transfer_req_compl(). This can also eliminate
racing of scsi_dma_unmap() from the real completion in IRQ handler path.

Signed-off-by: Can Guo <[email protected]>
CC: Stanley Chu <[email protected]>
Reviewed-by: Stanley Chu <[email protected]>

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b2947ab..9541fc7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6636,11 +6636,8 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out;
}

- scsi_dma_unmap(cmd);
-
spin_lock_irqsave(host->host_lock, flags);
- ufshcd_outstanding_req_clear(hba, tag);
- hba->lrb[tag].cmd = NULL;
+ __ufshcd_transfer_req_compl(hba, (1UL << tag));
spin_unlock_irqrestore(host->host_lock, flags);

out:
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


2020-08-07 13:03:42

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH 9/9] scsi: ufs: Properly release resources if a task is aborted successfully

Hi Markus,

On 2020-08-07 17:33, Markus Elfring wrote:
>> … To fix it, …
>
> I propose to replace this wording by the tag “Fixes”.
>
>
>> … "mannually", …
>
> Please avoid a typo:
> … "manually", …
>
>
> Regards,
> Markus

Thanks, will fix these in next version.

Regards,
Can Guo.