Devicetree
 help / color / mirror / Atom feed
From: "Golla, Nagendra" <Nagendra.Golla@amd.com>
To: sashiko-reviews@lists.linux.dev
Cc: vkoul@kernel.org, Frank.Li@kernel.org, robh@kernel.org,
	dmaengine@vger.kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH V2 3/3] dmaengine: zynqmp_dma: Guard IRQ handler against spurious interrupts
Date: Fri, 26 Jun 2026 16:08:20 +0530	[thread overview]
Message-ID: <6670dd3d-94b9-4e0b-ab51-91b146265d49@amd.com> (raw)
In-Reply-To: <20260618072615.5D3401F000E9@smtp.kernel.org>



On 6/18/2026 12:56 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> 
> New issues:
> - [High] The interrupt handler drops valid interrupts when CONFIG_PM is disabled.
> 
> Pre-existing issues:
> - [High] Memory and runtime PM reference leaks on error paths in zynqmp_dma_alloc_chan_resources().
> - [High] Missing synchronize_irq() before tasklet_kill() allows the tasklet to run after channel resources and PM references are freed.
> --
> 
> commit 62db01b8d81ad56c8fb04b0d8f2adecdae634703
> Author: Golla Nagendra <nagendra.golla@amd.com>
> 
> dmaengine: zynqmp_dma: Guard IRQ handler against spurious interrupts
> 
> This commit adds a pm_runtime_get_if_active() check in the
> zynqmp_dma_irq_handler() to safely handle spurious interrupts. It
> returns IRQ_NONE immediately if the device is not runtime-active,
> preventing potential synchronous external aborts.
> 
>> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
>> index a9dfec3c0ca3d..ce9163138be74 100644
>> --- a/drivers/dma/xilinx/zynqmp_dma.c
>> +++ b/drivers/dma/xilinx/zynqmp_dma.c
>> @@ -730,6 +730,9 @@ static irqreturn_t zynqmp_dma_irq_handler(int irq, void *data)
>>   	u32 isr, imr, status;
>>   	irqreturn_t ret = IRQ_NONE;
>>   
>> +	if (pm_runtime_get_if_active(chan->dev) <= 0)
>> +		return IRQ_NONE;
> 
> [Severity: High]
> When CONFIG_PM is disabled, the pm_runtime_get_if_active() inline stub
> automatically returns -EINVAL. Does this check unconditionally drop valid
> interrupts in non-PM configurations?
> 
> Because -EINVAL is less than or equal to 0, the handler might always return
> IRQ_NONE. This could potentially lead to an unacknowledged interrupt storm
> or the kernel permanently disabling the IRQ line.
> 
> [ ... ]
> 
> [Severity: High]
> This isn't a bug introduced by this patch, but do the error paths in
> zynqmp_dma_alloc_chan_resources() leak the runtime PM reference?
> 
> drivers/dma/xilinx/zynqmp_dma.c:zynqmp_dma_alloc_chan_resources() {
>      ...
>      chan->sw_desc_pool = kzalloc_objs(*desc, ZYNQMP_DMA_NUM_DESCS);
>      if (!chan->sw_desc_pool)
>          return -ENOMEM;
>      ...
>      if (!chan->desc_pool_v)
>          return -ENOMEM;
>      ...
> }
> 
> If pm_runtime_resume_and_get() is called earlier, returning directly
> on memory allocation failures without calling pm_runtime_put() will
> leak the PM reference and previously allocated memory.
> 
> 
> [Severity: High]
> This is a pre-existing issue, but does zynqmp_dma_synchronize() miss
> a required IRQ serialization step?
> 
> drivers/dma/xilinx/zynqmp_dma.c:zynqmp_dma_synchronize() {
>          struct zynqmp_dma_chan *chan = to_chan(dchan);
> 
>          tasklet_kill(&chan->tasklet);
> }
> 
> If zynqmp_dma_irq_handler() is executing concurrently and gets preempted
> just before calling tasklet_schedule(), tasklet_kill() might see no
> scheduled tasklet and return immediately.
> 
> When the IRQ handler resumes and schedules the tasklet, could it execute
> asynchronously after channel resources and PM references are freed,
> potentially causing a synchronous external abort?
> 
> Would calling synchronize_irq() first resolve this?

Hi,

Thanks for catching, agreed and will fix in v3 along with other RCs from 
the maintainers.

Thanks,
Nagendra>


  reply	other threads:[~2026-06-26 10:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  7:10 [PATCH V2 0/3] dmaengine: zynqmp_dma: Add per-channel reset support Golla Nagendra
2026-06-18  7:10 ` [PATCH V2 1/3] dt-bindings: dma: xilinx: Add optional resets property for ZDMA Golla Nagendra
2026-06-22 11:02   ` Krzysztof Kozlowski
2026-06-18  7:10 ` [PATCH V2 2/3] dmaengine: zynqmp_dma: Add per-channel reset support Golla Nagendra
2026-06-18  7:22   ` sashiko-bot
2026-06-18 18:52   ` Frank Li
2026-06-18  7:10 ` [PATCH V2 3/3] dmaengine: zynqmp_dma: Guard IRQ handler against spurious interrupts Golla Nagendra
2026-06-18  7:26   ` sashiko-bot
2026-06-26 10:38     ` Golla, Nagendra [this message]
2026-06-18 19:15   ` 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=6670dd3d-94b9-4e0b-ab51-91b146265d49@amd.com \
    --to=nagendra.golla@amd.com \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=robh@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