From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org,
"Bart Van Assche" <bvanassche@acm.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"孙魁 (Kui Sun)" <kui.sun@unisoc.com>,
"André Draszik" <andre.draszik@linaro.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>
Subject: Re: [PATCH] ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler"
Date: Thu, 16 Jul 2026 13:37:17 +0200 [thread overview]
Message-ID: <87se5j5fo2.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <b70eb60a01f971bed68c42c5b555929db5f835df.1784135511.git.bvanassche@acm.org>
Hello Bart,
> There have been multiple reports of performance regressions caused by
> commit 3c7ac40d7322. Hence this revert.
>
> This patch reverts most of the following commits:
> * 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to
> a threaded IRQ handler")
> * 6475cfb81fc4 ("scsi: ufs: core: Avoid IRQ thread wakeup during active UIC
> command")
>
> This patch preserves the following commits:
> * 034d319c8899 ("scsi: ufs: core: Fix interrupt handling for MCQ Mode")
> * eabcac808ca3 ("scsi: ufs: core: Fix IRQ lock inversion for the SCSI host
> lock")
>
> Neil, please check whether this patch series fixes the stalls that you
> reported: [f2fs-dev] [PATCH 0/4] Reduce the time spent in interrupt context
> (https://sourceforge.net/p/linux-f2fs/mailman/linux-f2fs-devel/thread/4b337c7f-2fbd-47b6-9c8c-587e7b5513f1%40kernel.org/#msg59345049).
>
This patch appears to be a good solution to fix the issue I reported
with PREEMPT_TR enabled. I don't currently have the hardware available
to test it, but as soon as I do, I will test this patch.
Thanks,
Gregory
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: 孙魁 (Kui Sun) <kui.sun@unisoc.com>
> Cc: André Draszik <andre.draszik@linaro.org>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Fixes: 3c7ac40d7322 ("scsi: ufs: core: Delegate the interrupt service routine to a threaded IRQ handler")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/ufs/core/ufshcd.c | 39 +++------------------------------------
> 1 file changed, 3 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 79331c2bd38d..56c96a3b10e2 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -7356,7 +7356,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
> }
>
> /**
> - * ufshcd_threaded_intr - Threaded interrupt service routine
> + * ufshcd_intr - Main interrupt service routine
> * @irq: irq number
> * @__hba: pointer to adapter instance
> *
> @@ -7364,7 +7364,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
> * IRQ_HANDLED - If interrupt is valid
> * IRQ_NONE - If invalid interrupt
> */
> -static irqreturn_t ufshcd_threaded_intr(int irq, void *__hba)
> +static irqreturn_t ufshcd_intr(int irq, void *__hba)
> {
> u32 last_intr_status, intr_status, enabled_intr_status = 0;
> irqreturn_t retval = IRQ_NONE;
> @@ -7403,38 +7403,6 @@ static irqreturn_t ufshcd_threaded_intr(int irq, void *__hba)
> return retval;
> }
>
> -/**
> - * ufshcd_intr - Main interrupt service routine
> - * @irq: irq number
> - * @__hba: pointer to adapter instance
> - *
> - * Return:
> - * IRQ_HANDLED - If interrupt is valid
> - * IRQ_WAKE_THREAD - If handling is moved to threaded handled
> - * IRQ_NONE - If invalid interrupt
> - */
> -static irqreturn_t ufshcd_intr(int irq, void *__hba)
> -{
> - struct ufs_hba *hba = __hba;
> - u32 intr_status, enabled_intr_status;
> -
> - /*
> - * 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);
> - enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
> -
> - ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS);
> -
> - /* Directly handle interrupts since MCQ ESI handlers does the hard job */
> - return ufshcd_sl_intr(hba, enabled_intr_status);
> -}
> -
> static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag)
> {
> int err = 0;
> @@ -11233,8 +11201,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
> ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
>
> /* IRQ registration */
> - err = devm_request_threaded_irq(dev, irq, ufshcd_intr, ufshcd_threaded_intr,
> - IRQF_ONESHOT | IRQF_SHARED, UFSHCD, hba);
> + err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba);
> if (err) {
> dev_err(hba->dev, "request irq failed\n");
> goto out_disable;
--
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-07-16 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 17:12 [PATCH] ufs: core: Revert "Delegate the interrupt service routine to a threaded IRQ handler" Bart Van Assche
2026-07-16 11:37 ` Gregory CLEMENT [this message]
2026-07-16 12:41 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87se5j5fo2.fsf@BLaptop.bootlin.com \
--to=gregory.clement@bootlin.com \
--cc=andre.draszik@linaro.org \
--cc=bigeasy@linutronix.de \
--cc=bvanassche@acm.org \
--cc=kui.sun@unisoc.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=neil.armstrong@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.