From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v4 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue
Date: Thu, 16 Jul 2026 15:53:37 +0000 [thread overview]
Message-ID: <20260716155337.C57CE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260716152503.1747922-10-den@valinux.co.jp>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Interrupts are requested before critical channel structures are fully initialized, leading to possible NULL pointer dereferences or uninitialized lock acquisitions on early or shared interrupts.
--
--- Patch [9]: [PATCH v4 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue ---
commit 9d2ebede7ce8b472f3d4f1a246b418b61a57de7a
Author: Koichiro Den <den@valinux.co.jp>
dmaengine: dw-edma: Defer channel IRQ handling to workqueue
This commit shifts channel IRQ handling from hard IRQ context to workqueues.
It keeps the hard IRQ handler minimal to clear status and dispatch channel
events, while deferring per-channel processing to work items to improve
concurrency.
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
[ ... ]
> @@ -1190,10 +1232,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 requesting interrupts here before critical
channel structures are initialized can lead to a NULL pointer dereference.
Since dw_edma_irq_request() uses IRQF_SHARED, an interrupt from another
device sharing the line could fire immediately.
If that happens before dw_edma_channel_setup() completes, the handler
(like dw_edma_interrupt_emulated()) will unconditionally dereference the
uninitialized dw_irq->dw pointer.
Additionally, the deferred work items might attempt to acquire chan->vc.lock
before vchan_init() has been called in dw_edma_channel_setup().
Does the initialization order need to be adjusted so that structures are fully
setup before interrupts are requested?
> - 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/20260716152503.1747922-1-den@valinux.co.jp?part=9
prev parent reply other threads:[~2026-07-16 15:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 15:24 [PATCH v4 0/9] dmaengine: dw-edma: Fixes and interrupt-path groundwork Koichiro Den
2026-07-16 15:24 ` [PATCH v4 1/9] dmaengine: dw-edma: Fix HDMA channel status register access Koichiro Den
2026-07-16 15:24 ` [PATCH v4 2/9] dmaengine: dw-edma: Terminate all descriptors without callbacks Koichiro Den
2026-07-16 15:42 ` sashiko-bot
2026-07-16 16:30 ` Frank Li
2026-07-16 15:24 ` [PATCH v4 3/9] dmaengine: dw-edma: Serialize abort state updates Koichiro Den
2026-07-16 15:42 ` sashiko-bot
2026-07-16 15:24 ` [PATCH v4 4/9] dmaengine: dw-edma: Complete descriptors before pausing Koichiro Den
2026-07-16 15:45 ` sashiko-bot
2026-07-16 15:24 ` [PATCH v4 5/9] dmaengine: dw-edma: Serialize channel state checks Koichiro Den
2026-07-16 15:25 ` [PATCH v4 6/9] dmaengine: dw-edma: Clear stale requests on termination Koichiro Den
2026-07-16 15:25 ` [PATCH v4 7/9] dmaengine: dw-edma-pcie: Drop redundant pci_free_irq_vectors() Koichiro Den
2026-07-16 15:25 ` [PATCH v4 8/9] dmaengine: dw-edma: Snapshot the v0 interrupt status once per handler pass Koichiro Den
2026-07-16 15:25 ` [PATCH v4 9/9] dmaengine: dw-edma: Defer channel IRQ handling to workqueue Koichiro Den
2026-07-16 15:53 ` sashiko-bot [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=20260716155337.C57CE1F000E9@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