Skip to contentSkip to conversation

scsi: ufs: mcq: delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort

PATCH Applied ping.gao 5 participants 5 messages May 16, 2025 – May 28, 2025 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20250516083723epcas5p216a21ffb81631d35f0a12f7a583ea248@epcas5p2.samsung.com

ping.gao

author
#1 lore raw

PATCH 1/1 scsi: ufs: mcq: delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort

after ufs UFS_ABORT_TASK process successfully , host will generate mcq irq for abort tag with response OCS_ABORTED ufshcd_compl_one_cqe ->
ufshcd_release_scsi_cmd

But in ufshcd_mcq_abort already do ufshcd_release_scsi_cmd, this means
__ufshcd_release will be done twice.

This means hba->clk_gating.active_reqs also will be decrease twice, it will be negtive, so delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort function.

static void __ufshcd_release(struct ufs_hba *hba)

{
    if (!ufshcd_is_clkgating_allowed(hba))
        return;

    hba->clk_gating.active_reqs--;

    if (hba->clk_gating.active_reqs < 0) {
        panic("ufs abnormal active_reqs!!!!!!");
    }

    ...
}
---
 drivers/ufs/core/ufs-mcq.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/ufs/core/ufs-mcq.c +0 -5
index f1294c29f484..2106c63db5ca 100644
@@ -713,10 +713,5 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
 		return FAILED;
 	}
 
-	spin_lock_irqsave(&hwq->cq_lock, flags);
-	if (ufshcd_cmd_inflight(lrbp->cmd))
-		ufshcd_release_scsi_cmd(hba, lrbp);
-	spin_unlock_irqrestore(&hwq->cq_lock, flags);
-
 	return SUCCESS;
 }
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#2 lore raw
Quoted 54 lines · ping.gao

External email : Please do not click links or open attachments until you have verified the sender or the content.

after ufs UFS_ABORT_TASK process successfully , host will generate mcq irq for abort tag with response OCS_ABORTED ufshcd_compl_one_cqe ->
    ufshcd_release_scsi_cmd

But in ufshcd_mcq_abort already do ufshcd_release_scsi_cmd, this means
 __ufshcd_release will be done twice.

This means hba->clk_gating.active_reqs also will be decrease twice, it
will be negtive, so delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort
function.

static void __ufshcd_release(struct ufs_hba *hba)
{
    if (!ufshcd_is_clkgating_allowed(hba))
        return;

    hba->clk_gating.active_reqs--;

    if (hba->clk_gating.active_reqs < 0) {
        panic("ufs abnormal active_reqs!!!!!!");
    }

    ...
}

---
 drivers/ufs/core/ufs-mcq.c | 5 -----

 1 file changed, 5 deletions(-)
drivers/ufs/core/ufs-mcq.c +0 -6
index f1294c29f484..2106c63db5ca 100644
@@ -713,10 +713,5 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
                 return FAILED;
         }
 
-       spin_lock_irqsave(&hwq->cq_lock, flags);
-       if (ufshcd_cmd_inflight(lrbp->cmd))
-               ufshcd_release_scsi_cmd(hba, lrbp);
-       spin_unlock_irqrestore(&hwq->cq_lock, flags);
-
         return SUCCESS;
  }
--
Quoted 2 lines

2.25.1

#3 lore raw
In reply to ping.gao
Quoted 25 lines · ping.gao

after ufs UFS_ABORT_TASK process successfully , host will generate mcq irq for abort tag with response OCS_ABORTED ufshcd_compl_one_cqe ->
ufshcd_release_scsi_cmd

But in ufshcd_mcq_abort already do ufshcd_release_scsi_cmd, this means
__ufshcd_release will be done twice.

This means hba->clk_gating.active_reqs also will be decrease twice, it will be negtive, so delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort function.

static void __ufshcd_release(struct ufs_hba *hba)

{
     if (!ufshcd_is_clkgating_allowed(hba))
         return;

     hba->clk_gating.active_reqs--;

     if (hba->clk_gating.active_reqs < 0) {
         panic("ufs abnormal active_reqs!!!!!!");
     }

     ...
}
Quoted 1 line

A blank line is required between a patch description and a Signed-off-by tag. Additionally, please add a Fixes: tag to the patch description.

Thanks,

Bart.

#4 lore raw
In reply to ping.gao
kernel test robot noticed the following build warnings:

Hi ping.gao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.15-rc6 next-20250516] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/ping-gao/scsi-ufs-mcq-delete-ufshcd_release_scsi_cmd-in-ufshcd_mcq_abort/20250516-163807
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20250516083812.3894396-1-ping.gao%40samsung.com
patch subject: [PATCH] scsi: ufs: mcq: delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort
config: arm-randconfig-004-20250517 (https://download.01.org/0day-ci/archive/20250517/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250517/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/ufs/core/ufs-mcq.c:677:16: warning: unused variable 'flags' [-Wunused-variable]
     677 |         unsigned long flags;
         |                       ^~~~~

1 warning generated.

vim +/flags +677 drivers/ufs/core/ufs-mcq.c

f1304d4420777f Bao D. Nguyen   2023-05-29  663  
f1304d4420777f Bao D. Nguyen   2023-05-29  664  /**
f1304d4420777f Bao D. Nguyen   2023-05-29  665   * ufshcd_mcq_abort - Abort the command in MCQ.
317a38045ab763 Yang Li         2023-07-12  666   * @cmd: The command to be aborted.
f1304d4420777f Bao D. Nguyen   2023-05-29  667   *
3a17fefe0f1960 Bart Van Assche 2023-07-27  668   * Return: SUCCESS or FAILED error codes
f1304d4420777f Bao D. Nguyen   2023-05-29  669   */
f1304d4420777f Bao D. Nguyen   2023-05-29  670  int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
f1304d4420777f Bao D. Nguyen   2023-05-29  671  {
f1304d4420777f Bao D. Nguyen   2023-05-29  672  	struct Scsi_Host *host = cmd->device->host;
f1304d4420777f Bao D. Nguyen   2023-05-29  673  	struct ufs_hba *hba = shost_priv(host);
f1304d4420777f Bao D. Nguyen   2023-05-29  674  	int tag = scsi_cmd_to_rq(cmd)->tag;
f1304d4420777f Bao D. Nguyen   2023-05-29  675  	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
f1304d4420777f Bao D. Nguyen   2023-05-29  676  	struct ufs_hw_queue *hwq;

27900d7119c464 Peter Wang 2023-11-06 @677 unsigned long flags;

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw
In reply to ping.gao
Quoted 9 lines · ping.gao

after ufs UFS_ABORT_TASK process successfully , host will generate mcq irq for abort tag with response OCS_ABORTED ufshcd_compl_one_cqe ->
ufshcd_release_scsi_cmd

But in ufshcd_mcq_abort already do ufshcd_release_scsi_cmd, this means
__ufshcd_release will be done twice.

[...]

Applied to 6.16/scsi-queue, thanks!

[1/1] scsi: ufs: mcq: delete ufshcd_release_scsi_cmd in ufshcd_mcq_abort

      https://git.kernel.org/mkp/scsi/c/53755903b935
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering