FAILED: patch "[PATCH] scsi: ufs: core: Decouple CQ sweep from request iterator in" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 469fa055664bfd8717b087a80d59c03055789c17
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026101229-boots-shortcut-fa1c@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 469fa055664bfd8717b087a80d59c03055789c17 Mon Sep 17 00:00:00 2001
From: Stanley Jhu <[email protected]>
Date: Mon, 28 Sep 2026 11:58:16 +0800
Subject: [PATCH] scsi: ufs: core: Decouple CQ sweep from request iterator in
MCQ
In MCQ mode, ufshcd_mcq_compl_pending_transfer() uses blk_mq_tagset_busy_iter() to iterate over busy requests during error recovery and host reset. However, both iterator callbacks perform whole-queue operations redundantly for each visited request:
- force_compl == true: ufshcd_mcq_force_compl_one() calls ufshcd_mcq_compl_all_cqes_lock() on every busy request, sweeping the entire completion ring (hwq->max_entries slots) once per active request under spin_lock_irqsave even though the first sweep already cleared all completion entries.
- force_compl == false: ufshcd_mcq_compl_one() acquires cq_lock and polls CQTPy over MMIO via ufshcd_mcq_poll_cqe_lock() for every busy request without doing any per-request work.
Sweep or poll each hardware queue (hba->uhq[i]) once at the start of ufshcd_mcq_compl_pending_transfer(). When force_compl is true, run blk_mq_tagset_busy_iter() afterward to complete residual in-flight requests with DID_REQUEUE, and remove the now-unused ufshcd_mcq_compl_one() callback.
drivers/ufs/core/ufshcd.c +12 -19
@@ -6044,8 +6044,6 @@ static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv)if (blk_mq_is_reserved_rq (rq) || !hwq)return true; -ufshcd_mcq_compl_all_cqes_lock (hba, hwq); -/* * For those cmds of which the cqes are not present in the cq, complete * them explicitly.
@@ -6061,19 +6059,6 @@ static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv)return true; } -static bool ufshcd_mcq_compl_one (struct request *rq,void *priv) -{ -struct scsi_device *sdev = rq->q->queuedata; -struct Scsi_Host *shost = sdev->host; -struct ufs_hba *hba =shost_priv (shost); -struct ufs_hw_queue *hwq =ufshcd_mcq_req_to_hwq (hba, rq); - -if (!blk_mq_is_reserved_rq (rq) && hwq) -ufshcd_mcq_poll_cqe_lock (hba, hwq); - -return true; -} -/** * ufshcd_mcq_compl_pending_transfer - MCQ mode function. It is * invoked from the error handler context or ufshcd_host_reset_and_restore()
@@ -6088,10 +6073,18 @@ static bool ufshcd_mcq_compl_one(struct request *rq, void *priv)static void ufshcd_mcq_compl_pending_transfer (struct ufs_hba *hba,bool force_compl) { -blk_mq_tagset_busy_iter (&hba->host->tag_set, - force_compl ? ufshcd_mcq_force_compl_one : - ufshcd_mcq_compl_one, -NULL ); +int i; + +for (i =0 ; i < hba->nr_hw_queues; i++) { +if (force_compl) +ufshcd_mcq_compl_all_cqes_lock (hba, &hba->uhq[i]); +else +ufshcd_mcq_poll_cqe_lock (hba, &hba->uhq[i]); + } + +if (force_compl) +blk_mq_tagset_busy_iter (&hba->host->tag_set, + ufshcd_mcq_force_compl_one,NULL ); }/**
Sasha Levin
maintainerPATCH 1/1 scsi: ufs: core: Decouple CQ sweep from request iterator in MCQ
From: Stanley Jhu <[email protected]>
[ Upstream commit 469fa055664bfd8717b087a80d59c03055789c17 ]
In MCQ mode, ufshcd_mcq_compl_pending_transfer() uses blk_mq_tagset_busy_iter() to iterate over busy requests during error recovery and host reset. However, both iterator callbacks perform whole-queue operations redundantly for each visited request:
- force_compl == true: ufshcd_mcq_force_compl_one() calls ufshcd_mcq_compl_all_cqes_lock() on every busy request, sweeping the entire completion ring (hwq->max_entries slots) once per active request under spin_lock_irqsave even though the first sweep already cleared all completion entries.
- force_compl == false: ufshcd_mcq_compl_one() acquires cq_lock and polls CQTPy over MMIO via ufshcd_mcq_poll_cqe_lock() for every busy request without doing any per-request work.
Sweep or poll each hardware queue (hba->uhq[i]) once at the start of ufshcd_mcq_compl_pending_transfer(). When force_compl is true, run blk_mq_tagset_busy_iter() afterward to complete residual in-flight requests with DID_REQUEUE, and remove the now-unused ufshcd_mcq_compl_one() callback.
--- drivers/ufs/core/ufshcd.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/ufs/core/ufshcd.c +21 -16
@@ -5685,7 +5685,17 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,struct ufshcd_lrb *lrbp;struct scsi_cmnd *cmd;unsigned long flags; -int tag; +int tag, i; + +for (i =0 ; i < hba->nr_hw_queues; i++) { +if (force_compl) +ufshcd_mcq_compl_all_cqes_lock (hba, &hba->uhq[i]); +else +ufshcd_mcq_poll_cqe_lock (hba, &hba->uhq[i]); + } + +if (!force_compl) +return ;for (tag =0 ; tag < hba->nutrs; tag++) { lrbp = &hba->lrb[tag];
@@ -5698,22 +5708,17 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,if (!hwq)continue ; -if (force_compl) { -ufshcd_mcq_compl_all_cqes_lock (hba, hwq); -/* -* For those cmds of which the cqes are not present -* in the cq, complete them explicitly. -*/ -spin_lock_irqsave (&hwq->cq_lock, flags); -if (cmd && !test_bit (SCMD_STATE_COMPLETE , &cmd->state)) { -set_host_byte (cmd,DID_REQUEUE ); -ufshcd_release_scsi_cmd (hba, lrbp); -scsi_done (cmd); - } -spin_unlock_irqrestore (&hwq->cq_lock, flags); - }else { -ufshcd_mcq_poll_cqe_lock (hba, hwq); +/* +* For those cmds of which the cqes are not present +* in the cq, complete them explicitly. +*/ +spin_lock_irqsave (&hwq->cq_lock, flags); +if (cmd && !test_bit (SCMD_STATE_COMPLETE , &cmd->state)) { +set_host_byte (cmd,DID_REQUEUE ); +ufshcd_release_scsi_cmd (hba, lrbp); +scsi_done (cmd); } +spin_unlock_irqrestore (&hwq->cq_lock, flags); } }
Signature · 1 line
2.53.0