On 2/09/20 12:27 pm, Adrian Hunter wrote: > On 2/09/20 5:12 am, Martin K. Petersen wrote: >> >> Adrian, >> >>> Intel host controllers support the setting of latency tolerance. >>> Accordingly, implement the PM QoS ->set_latency_tolerance() callback. The >>> raw register values are also exposed via debugfs. >> >> Does not apply to 5.10/scsi-queue. Please rebase. Thanks! >> > > Hi > > Thanks for processing this. > > The 5.10/scsi-queue branch seems to be missing the following fix. If you cherry > pick that, then it applies. Now there seem to be conflicts between 5.10/scsi-queue and v5.9-rc4. I am not sure what I can do? ~/git/scsi-mkp$ git branch -v --list 5.10/scsi-queue * 5.10/scsi-queue 2e9defc7e918 [ahead 427, behind 97] scsi: ufs: Fix a race condition between error handler and runtime PM ops ~/git/scsi-mkp$ git rebase --onto v5.9-rc4 v5.9-rc1 First, rewinding head to replay your work on top of it... Applying: scsi: ufs: Add checks before setting clk-gating states Applying: scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() Applying: scsi: ufs-qcom: Remove testbus dump in ufs_qcom_dump_dbg_regs Applying: scsi: ufs: Add some debug information to ufshcd_print_host_state() Applying: scsi: ufs: Fix concurrency of error handler and other error recovery paths Applying: scsi: ufs: Recover HBA runtime PM error in error handler Applying: scsi: ufs: Move dumps in IRQ handler to error handler Applying: scsi: ufs: Fix a race condition between error handler and runtime PM ops Applying: scsi: ufs: Properly release resources if a task is aborted successfully Using index info to reconstruct a base tree... M drivers/scsi/ufs/ufshcd.c Falling back to patching base and 3-way merge... Auto-merging drivers/scsi/ufs/ufshcd.c CONFLICT (content): Merge conflict in drivers/scsi/ufs/ufshcd.c error: Failed to merge in the changes. Patch failed at 0009 scsi: ufs: Properly release resources if a task is aborted successfully Use 'git am --show-current-patch' to see the failed patch Resolve all conflicts manually, mark them as resolved with "git add/rm <conflicted_files>", then run "git rebase --continue". You can instead skip this commit: run "git rebase --skip". To abort and get back to the state before "git rebase", run "git rebase --abort". ~/git/scsi-mkp$ git diff diff --cc drivers/scsi/ufs/ufshcd.c index d9386f85c255,efb40b1b95b4..000000000000 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@@ -6640,12 -6636,8 +6640,14 @@@ static int ufshcd_abort(struct scsi_cmn goto out; } ++<<<<<<< HEAD +cleanup: + scsi_dma_unmap(cmd); + ++======= ++>>>>>>> scsi: ufs: Properly release resources if a task is aborted successfully 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: ~/git/scsi-mkp$ git am --show-current-patch | head -25 commit 8bb2dde069d860e7ea379862a7d0e8ee01cec5e9 Author: Can Guo <cang@xxxxxxxxxxxxxx> Date: Sun Aug 9 05:15:55 2020 -0700 scsi: ufs: Properly release resources if a task is aborted successfully In current UFS task abort hook, namely ufshcd_abort(), if one task is aborted successfully, clk_gating.active_reqs held by this task is not decreased, which makes clk_gating.active_reqs stay above zero forever, thus clock gating would never happen. Instead of releasing resources of one task "manually", use the existing func __ufshcd_transfer_req_compl(). This change also eliminates a possible race of scsi_dma_unmap() from the real completion in IRQ handler path. Link: https://lore.kernel.org/r/1596975355-39813-10-git-send-email-cang@xxxxxxxxxxxxxx Fixes: 1ab27c9cf8b6 ("ufs: Add support for clock gating") CC: Stanley Chu <stanley.chu@xxxxxxxxxxxx> Reviewed-by: Stanley Chu <stanley.chu@xxxxxxxxxxxx> Reviewed-by: Asutosh Das <asutoshd@xxxxxxxxxxxxxx> Signed-off-by: Can Guo <cang@xxxxxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>