From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v3 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue
Date: Wed, 15 Jul 2026 18:33:41 +0000 [thread overview]
Message-ID: <20260715183341.879F61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715175740.1110404-10-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Shared IRQs are requested before `irq->dw` is initialized, potentially causing a NULL pointer dereference on early interrupts.
--
--- Patch [9]: [PATCH v3 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue ---
commit 61576b5286f799082619f98fb9d5cfc6fa61833f
Author: Koichiro Den <den@valinux.co.jp>
dmaengine: dw-edma: Defer channel IRQ handling to workqueue
This patch modifies the eDMA driver to keep the hard IRQ handler minimal to
prevent performance bottlenecks under multichannel load. It defers per-channel
completion and abort processing to a workqueue, queuing a work item per
channel to allow parallel execution across multiple CPUs.
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 2369b4c4630b9..4ee7f14c3a824 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
[ ... ]
> @@ -1195,10 +1237,21 @@ int dw_edma_probe(struct dw_edma_chip *chip)
> /* Disable eDMA, only to establish the ideal initial conditions */
> dw_edma_core_off(dw);
>
> + /*
> + * Deferred IRQ works are queued from the hard IRQ handlers, so the
> + * workqueue must exist before any IRQ is requested.
> + */
> + dw->wq = alloc_workqueue("dw-edma:%s", WQ_UNBOUND | WQ_HIGHPRI, 0,
> + dev_name(chip->dev));
> + if (!dw->wq)
> + return -ENOMEM;
> +
> /* Request IRQs */
> err = dw_edma_irq_request(dw, &wr_alloc, &rd_alloc);
[Severity: High]
This is a pre-existing issue, but could this lead to a NULL pointer
dereference on early interrupts?
In dw_edma_probe(), we call dw_edma_irq_request() which requests the
shared IRQ:
dw_edma_irq_request() {
...
err = request_irq(irq, dw_edma_interrupt_common, IRQF_SHARED, dw->name, &dw->irq[0]);
...
}
If an interrupt from another device sharing this IRQ line fires immediately,
the handler will be invoked before we've fully initialized the context.
Specifically, dw_edma_interrupt_common() calls down into
dw_edma_core_handle_int(), which dereferences dw_irq->dw:
dw_edma_core_handle_int() {
...
return dw_irq->dw->core->handle_int(dw_irq, dir, done, abort);
}
However, irq->dw is only initialized later in dw_edma_channel_setup():
dw_edma_channel_setup() {
...
for (i = 0; i < ch_cnt; i++) {
...
irq->dw = dw;
}
}
If the shared handler fires before dw_edma_channel_setup() runs, will
dw_irq->dw be NULL here and crash the kernel?
> - if (err)
> + if (err) {
> + destroy_workqueue(dw->wq);
> return err;
> + }
>
> /* Allocate a dedicated virtual IRQ for interrupt-emulation doorbells */
> err = dw_edma_emul_irq_alloc(dw);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175740.1110404-1-den@valinux.co.jp?part=9
next prev parent reply other threads:[~2026-07-15 18:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 17:57 [PATCH v3 0/9] dmaengine: dw-edma: Fixes and interrupt-path groundwork Koichiro Den
2026-07-15 17:57 ` [PATCH v3 1/9] dmaengine: dw-edma: Fix HDMA channel status register access Koichiro Den
2026-07-15 17:57 ` [PATCH v3 2/9] dmaengine: dw-edma: Terminate all descriptors without callbacks Koichiro Den
2026-07-15 18:24 ` sashiko-bot
2026-07-15 18:54 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 3/9] dmaengine: dw-edma: Serialize abort state updates Koichiro Den
2026-07-15 18:15 ` sashiko-bot
2026-07-15 18:55 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 4/9] dmaengine: dw-edma: Complete descriptors before pausing Koichiro Den
2026-07-15 18:15 ` sashiko-bot
2026-07-15 18:56 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 5/9] dmaengine: dw-edma: Serialize channel state checks Koichiro Den
2026-07-15 18:19 ` sashiko-bot
2026-07-15 18:58 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 6/9] dmaengine: dw-edma: Clear stale requests on termination Koichiro Den
2026-07-15 18:19 ` sashiko-bot
2026-07-15 19:00 ` Frank Li
2026-07-15 17:57 ` [PATCH v3 7/9] dmaengine: dw-edma-pcie: Drop redundant pci_free_irq_vectors() Koichiro Den
2026-07-15 17:57 ` [PATCH v3 8/9] dmaengine: dw-edma: Snapshot the v0 interrupt status once per handler pass Koichiro Den
2026-07-15 17:57 ` [PATCH v3 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue Koichiro Den
2026-07-15 18:33 ` sashiko-bot [this message]
2026-07-15 19:02 ` Frank Li
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=20260715183341.879F61F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=den@valinux.co.jp \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox