Re: [PATCH RFC v2 2/2] ufs: core: delegate the interrupt service routine to a threaded irq handler

From: Bart Van Assche
Date: Fri Mar 28 2025 - 13:20:22 EST


On 3/26/25 1:36 AM, Neil Armstrong wrote:
+static irqreturn_t ufshcd_intr(int irq, void *__hba)
+{
+ struct ufs_hba *hba = __hba;
+
+ /*
+ * Move interrupt handling to thread when MCQ is not supported
+ * or when Interrupt Aggregation is not supported, leading to
+ * potentially longer interrupt handling.
+ */
+ if (!is_mcq_supported(hba) || !ufshcd_is_intr_aggr_allowed(hba))
+ return IRQ_WAKE_THREAD;
+
+ /* Directly handle interrupts since MCQ handlers does the hard job */
+ return ufshcd_sl_intr(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS) &
+ ufshcd_readl(hba, REG_INTERRUPT_ENABLE));
+}

Calling ufshcd_is_intr_aggr_allowed() from the above interrupt handler
seems wrong to me. I think you want to check whether or not ESI has been
disabled since only if ESI is disabled all I/O completions are handled
by a single interrupt if MCQ is enabled.

Thanks,

Bart.