Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Basavaraj Natikar <bnatikar@amd.com>
To: Lee Jones <lee@kernel.org>,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	Raju Rangoju <Raju.Rangoju@amd.com>,
	Philipp Stanner <pstanner@redhat.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH v2 02/11] dmaengine: ae4dma: Let the pending work exit before cancelling it
Date: Thu, 19 Nov 2026 11:03:57 +0530	[thread overview]
Message-ID: <625f0edf-a02c-4edd-b87c-59de9152c78e@amd.com> (raw)
In-Reply-To: <20261117163809.622249-3-lee@kernel.org>


On 11/17/2026 10:07 PM, Lee Jones wrote:
> ae4_pending_work() loops forever waiting for interrupts, so it never
> returns once it has started running, which it does 100us after probe.
> ae4_destroy_work() calls cancel_delayed_work_sync() on it, which waits
> for the running work to finish and therefore blocks indefinitely,
> hanging device removal and, once the work has started, the probe error
> path in ae4_core_init().
>
> Add a per-queue stop flag that ae4_destroy_work() sets, then wake the
> queue's wait queue so that the work leaves its loop before it is
> cancelled and its workqueue destroyed.
>
> Fixes: 90a30e268d9b ("dmaengine: ae4dma: Add AMD ae4dma controller driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
>
> v1 => v2: New patch, so that ae4_destroy_work() can no longer hang
>
>   drivers/dma/amd/ae4dma/ae4dma-dev.c | 8 ++++++++
>   drivers/dma/amd/ae4dma/ae4dma.h     | 1 +
>   2 files changed, 9 insertions(+)
>
> diff --git a/drivers/dma/amd/ae4dma/ae4dma-dev.c b/drivers/dma/amd/ae4dma/ae4dma-dev.c
> index 8de3bef41b58..be86188da16c 100644
> --- a/drivers/dma/amd/ae4dma/ae4dma-dev.c
> +++ b/drivers/dma/amd/ae4dma/ae4dma-dev.c
> @@ -23,9 +23,13 @@ static void ae4_pending_work(struct work_struct *work)
>   
>   	for (;;) {
>   		wait_event_interruptible(ae4cmd_q->q_w,
> +					 READ_ONCE(ae4cmd_q->stop) ||
>   					 ((atomic64_read(&ae4cmd_q->done_cnt)) <
>   					   atomic64_read(&ae4cmd_q->intr_cnt)));
>   
> +		if (READ_ONCE(ae4cmd_q->stop))
> +			break;
> +
>   		atomic64_inc(&ae4cmd_q->done_cnt);
>   
>   		mutex_lock(&ae4cmd_q->cmd_lock);
> @@ -81,6 +85,10 @@ void ae4_destroy_work(struct ae4_device *ae4)
>   		if (!ae4cmd_q->pws)
>   			break;
>   
> +		/* Make ae4_pending_work() leave its loop so that it can be cancelled */
> +		WRITE_ONCE(ae4cmd_q->stop, true);
> +		wake_up(&ae4cmd_q->q_w);
> +
>   		cancel_delayed_work_sync(&ae4cmd_q->p_work);
>   		destroy_workqueue(ae4cmd_q->pws);
>   	}
> diff --git a/drivers/dma/amd/ae4dma/ae4dma.h b/drivers/dma/amd/ae4dma/ae4dma.h
> index 57f6048726bb..affb1d7d9d7d 100644
> --- a/drivers/dma/amd/ae4dma/ae4dma.h
> +++ b/drivers/dma/amd/ae4dma/ae4dma.h
> @@ -60,6 +60,7 @@ struct ae4_cmd_queue {
>   	u32 dridx;
>   	u32 tail_wi;
>   	u32 id;
> +	bool stop;
>   };
>   
>   union dwou {

Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>

Thanks,
--
Basavaraj



  parent reply	other threads:[~2026-11-19  5:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261117163809.622249-1-lee@kernel.org>
2026-11-17 16:37 ` [PATCH v2 01/11] dmaengine: pl08x: Defer OF DMA controller registration until slave setup Lee Jones
2026-11-17 18:44   ` Linus Walleij
2026-11-17 19:37   ` Frank Li
2026-11-17 16:37 ` [PATCH v2 02/11] dmaengine: ae4dma: Let the pending work exit before cancelling it Lee Jones
2026-11-17 19:38   ` Frank Li
2026-11-19  5:33   ` Basavaraj Natikar [this message]
2026-11-17 16:37 ` [PATCH v2 03/11] dmaengine: ae4dma: Unregister DMA engine in ae4_pci_remove() Lee Jones
2026-11-17 19:40   ` Frank Li
2026-11-19  5:36   ` Basavaraj Natikar
2026-11-17 16:37 ` [PATCH v2 04/11] dmaengine: ptdma: Unmap descriptor in pt_do_cleanup() Lee Jones
2026-11-17 19:41   ` Frank Li
2026-11-19  5:38   ` Basavaraj Natikar
2026-11-17 16:37 ` [PATCH v2 05/11] dmaengine: ptdma: Remove completed descriptor under vc.lock in pt_cmd_callback_work() Lee Jones
2026-11-17 19:42   ` Frank Li
2026-11-19  5:41   ` Basavaraj Natikar
2026-11-17 16:37 ` [PATCH v2 06/11] dmaengine: amlogic: Destroy free_wq after devres DMA device unregistration Lee Jones
2026-11-17 19:43   ` Frank Li
2026-11-17 16:37 ` [PATCH v2 07/11] dmaengine: arm-dma350: Query dma_cookie_status() under vc.lock in d350_tx_status() Lee Jones
2026-11-17 19:44   ` Frank Li
2026-11-17 16:37 ` [PATCH v2 08/11] dmaengine: bestcomm: Defer publishing bcom_eng until initialisation completes Lee Jones
2026-11-17 19:48   ` Frank Li
2026-11-17 16:37 ` [PATCH v2 09/11] dmaengine: bestcomm: Check rh_create() return value in bcom_sram_init() Lee Jones
2026-11-17 19:49   ` Frank Li
2026-11-17 16:37 ` [PATCH v2 10/11] dmaengine: jz4780: Fix descriptor cleanup on hwdesc setup failure Lee Jones
2026-11-17 19:50   ` Frank Li
2026-11-17 19:54   ` Paul Cercueil
2026-11-17 16:37 ` [PATCH v2 11/11] dmaengine: dmatest: Avoid unsigned underflow in min_odd() Lee Jones
2026-11-17 19:51   ` 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=625f0edf-a02c-4edd-b87c-59de9152c78e@amd.com \
    --to=bnatikar@amd.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Frank.Li@kernel.org \
    --cc=Raju.Rangoju@amd.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pstanner@redhat.com \
    --cc=stable@vger.kernel.org \
    --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