From: Mark Brown <broonie@kernel.org>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: Joseph Steel <recv.jo@gmail.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 5/5] spi: dw: use threaded interrupt and optimize the threaded ISR
Date: Tue, 29 Sep 2026 15:19:05 +0100 [thread overview]
Message-ID: <ae2432cd-5dcd-46a4-94e4-195b4ac9235e@sirena.org.uk> (raw)
In-Reply-To: <20260929121817.20896-6-jszhang@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
On Tue, Sep 29, 2026 at 08:18:17PM +0800, Jisheng Zhang wrote:
> To avoid blocking for an excessive amount of time, eventually impacting
> on system responsiveness, hard interrupt handlers should finish
> executing in as little time as possible.
> static irqreturn_t dw_spi_transfer_handler(struct dw_spi *dws)
> {
> u16 irq_status = dw_readl(dws, DW_SPI_ISR);
> @@ -245,7 +296,13 @@ static irqreturn_t dw_spi_transfer_handler(struct dw_spi *dws)
> dw_spi_mask_intr(dws, DW_SPI_INT_TXEI);
> }
>
> - return IRQ_HANDLED;
> + if (spi_controller_is_target(dws->ctlr) || !dws->rx_len || !dws->tx_len ||
> + !spi_get_csgpiod(dws->ctlr->cur_msg->spi, 0)) {
> + return IRQ_HANDLED;
> + } else {
> + dw_spi_mask_intr(dws, 0xff);
> + return IRQ_WAKE_THREAD;
> + }
> }
If we're handing a short transfer in the first interrupt then we will
already have completed the transfer at the point we check have which
would allow another CPU to start another transfer first. If things go
very badly this might mean that the length checks look at the values
from a new transfer and wake the thread. We should probably set a local
flag before we complete the transfer and use that to decide if we wake
the thread.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-09-29 14:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 12:18 [PATCH v4 0/5] spi: dw: use threaded interrupt Jisheng Zhang
2026-09-29 12:18 ` [PATCH v4 1/5] spi: dw: use DW_SPI_ISR directly Jisheng Zhang
2026-09-29 12:18 ` [PATCH v4 2/5] spi: dw: remove useless dws->transfer_handler check Jisheng Zhang
2026-09-29 12:18 ` [PATCH v4 3/5] spi: dw: remove duplicated "!rx_len && !tx_len" handling from dw_spi_irq Jisheng Zhang
2026-09-29 12:18 ` [PATCH v4 4/5] spi: dw: restore previous irq handling behavior when !ctlr->cur_msg Jisheng Zhang
2026-09-29 12:18 ` [PATCH v4 5/5] spi: dw: use threaded interrupt and optimize the threaded ISR Jisheng Zhang
2026-09-29 14:19 ` Mark Brown [this message]
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=ae2432cd-5dcd-46a4-94e4-195b4ac9235e@sirena.org.uk \
--to=broonie@kernel.org \
--cc=jszhang@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=recv.jo@gmail.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®