From: Jon Hunter <jonathanh@nvidia.com>
To: Vishwaroop A <va@nvidia.com>,
Thierry Reding <thierry.reding@kernel.org>,
Mark Brown <broonie@kernel.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
Sowjanya Komatineni <skomatineni@nvidia.com>,
Breno Leitao <leitao@debian.org>,
Suresh Mangipudi <smangipudi@nvidia.com>,
Krishna Yarlagadda <kyarlagadda@nvidia.com>,
linux-tegra@vger.kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] spi: tegra210-quad: Convert to hard IRQ with high-priority workqueue
Date: Tue, 19 May 2026 10:15:24 +0100 [thread overview]
Message-ID: <d058322b-1239-4429-97eb-ab49002881d7@nvidia.com> (raw)
In-Reply-To: <20260518160739.3286438-2-va@nvidia.com>
On 18/05/2026 17:07, Vishwaroop A wrote:
> Threaded IRQ handlers suffer from scheduler latency on heavily loaded
> systems, causing false transfer timeouts. Convert to hard IRQ handler
> that schedules work on a high-priority unbound workqueue.
>
> The hard IRQ handler verifies the interrupt, caches FIFO status,
> clears and masks interrupts, then schedules bottom-half processing.
> The workqueue handler runs in process context (can sleep for DMA)
> and can execute on any CPU, avoiding CPU0 bottlenecks.
>
> Signed-off-by: Vishwaroop A <va@nvidia.com>
> ---
> drivers/spi/spi-tegra210-quad.c | 120 ++++++++++++++++++++++----------
> 1 file changed, 83 insertions(+), 37 deletions(-)
...
> static struct tegra_qspi_soc_data tegra210_qspi_soc_data = {
> @@ -1793,12 +1826,21 @@ static int tegra_qspi_probe(struct platform_device *pdev)
>
> pm_runtime_put_autosuspend(&pdev->dev);
>
> - ret = request_threaded_irq(tqspi->irq, NULL,
> - tegra_qspi_isr_thread, IRQF_ONESHOT,
> - dev_name(&pdev->dev), tqspi);
> + tqspi->wq = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND, 0,
> + dev_name(&pdev->dev));
Why not used devm_alloc_workqueue() here?
> + if (!tqspi->wq) {
> + dev_err(&pdev->dev, "failed to allocate workqueue\n");
> + ret = -ENOMEM;
> + goto exit_pm_disable;
> + }
> +
> + INIT_WORK(&tqspi->irq_work, tegra_qspi_work_handler);
> +
> + ret = request_irq(tqspi->irq, tegra_qspi_isr, IRQF_SHARED,
> + dev_name(&pdev->dev), tqspi);
And use devm_request_irq() here?
> if (ret < 0) {
> dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n", tqspi->irq, ret);
> - goto exit_pm_disable;
> + goto exit_destroy_wq;
> }
>
> ret = spi_register_controller(host);
> @@ -1810,7 +1852,9 @@ static int tegra_qspi_probe(struct platform_device *pdev)
> return 0;
>
> exit_free_irq:
> - free_irq(qspi_irq, tqspi);
> + free_irq(tqspi->irq, tqspi);
> +exit_destroy_wq:
> + destroy_workqueue(tqspi->wq);
> exit_pm_disable:
> pm_runtime_dont_use_autosuspend(&pdev->dev);
> pm_runtime_force_suspend(&pdev->dev);
> @@ -1825,6 +1869,8 @@ static void tegra_qspi_remove(struct platform_device *pdev)
>
> spi_unregister_controller(host);
> free_irq(tqspi->irq, tqspi);
> + flush_workqueue(tqspi->wq);
> + destroy_workqueue(tqspi->wq);
> pm_runtime_dont_use_autosuspend(&pdev->dev);
> pm_runtime_force_suspend(&pdev->dev);
> tegra_qspi_deinit_dma(tqspi);
Jon
--
nvpublic
next prev parent reply other threads:[~2026-05-19 9:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 16:07 [PATCH 0/3] spi: tegra210-quad: Improve interrupt handling for loaded systems Vishwaroop A
2026-05-18 16:07 ` [PATCH 1/3] spi: tegra210-quad: Convert to hard IRQ with high-priority workqueue Vishwaroop A
2026-05-19 9:15 ` Jon Hunter [this message]
2026-05-18 16:07 ` [PATCH 2/3] spi: tegra210-quad: Cache TRANS_STATUS in ISR for timeout handler Vishwaroop A
2026-05-19 9:27 ` Jon Hunter
2026-05-18 16:07 ` [PATCH 3/3] spi: tegra210-quad: Process small PIO transfers in hard IRQ context Vishwaroop A
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=d058322b-1239-4429-97eb-ab49002881d7@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=broonie@kernel.org \
--cc=kyarlagadda@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=skomatineni@nvidia.com \
--cc=smangipudi@nvidia.com \
--cc=thierry.reding@kernel.org \
--cc=va@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®