[PATCH v2] ufs: core: fix ufshcd_abort_all racing issue

Peter Wang (王信友) peter.wang at mediatek.com
Thu Jun 27 20:13:02 PDT 2024


>   struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
>    struct request *req)
>   {
> -u32 utag = blk_mq_unique_tag(req);
> -u32 hwq = blk_mq_unique_tag_to_hwq(utag);
> +struct blk_mq_hw_ctx *hctx = READ_ONCE(rq->mq_hctx);
> 
> -return &hba->uhq[hwq];
> +return hctx ? &hba->uhq[hctx->queue_num] : NULL;
>   }
> 

Hi Bart,

Yes, it could be work, thanks.

>   /**
> @@ -547,6 +546,8 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba,
> int 
> task_tag)
>   if (!cmd)
>   return -EINVAL;
>   hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
> +if (!hwq)
> +return -EINVAL;
> 

Should retrun 0, beacuse hwq null means tag is done by ISR.
We don't need cleanup sq now.


Thanks.
Peter



>   } else {
>   hwq = hba->dev_cmd_queue;
>   }
> 


More information about the Linux-mediatek mailing list