]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: ufs: core: Avoid IRQ thread wakeup during active UIC command
authorPeter Wang <peter.wang@mediatek.com>
Fri, 6 Mar 2026 05:43:02 +0000 (13:43 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 7 Mar 2026 16:06:46 +0000 (11:06 -0500)
Only return IRQ_WAKE_THREAD when MCQ and ESI are not enabled and no UIC
command is active. The default UIC command timeout is 500ms, Using threaded
IRQs during an active UIC command increases the risk of timeout due to
possible preemption by other system IRQs.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260306054419.3816557-1-peter.wang@mediatek.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 8658e6dc86349a7284b5dccc134092e5ae3b4afe..0eb4f4af231ef7348bfbc1fccf86ec922dc1dacd 100644 (file)
@@ -7221,8 +7221,12 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
        struct ufs_hba *hba = __hba;
        u32 intr_status, enabled_intr_status;
 
-       /* Move interrupt handling to thread when MCQ & ESI are not enabled */
-       if (!hba->mcq_enabled || !hba->mcq_esi_enabled)
+       /*
+        * Handle interrupt in thread if MCQ or ESI is disabled,
+        * and no active UIC command.
+        */
+       if ((!hba->mcq_enabled || !hba->mcq_esi_enabled) &&
+           !hba->active_uic_cmd)
                return IRQ_WAKE_THREAD;
 
        intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);