Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal
@ 2026-06-30  6:48 Golla Nagendra
  2026-06-30  6:48 ` [PATCH 1/2] " Golla Nagendra
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Golla Nagendra @ 2026-06-30  6:48 UTC (permalink / raw)
  To: vkoul, Frank.Li, michal.simek, nagendra.golla, abin.joseph, kees,
	ptsm, sakari.ailus, radhey.shyam.pandey, u.kleine-koenig
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel

This patch series addresses two issues in the zynqmp_dma_remove() function:
 
1. Fix the race condition between runtime PM and device removal where
   pm_runtime_disable() was called after the power state check, leaving
   a window for the runtime PM framework to change state unexpectedly.
 
2. Update the stale kernel doc comment that still references a return
   value after the function was converted to return void.



Golla Nagendra (2):
  dmaengine: zynqmp_dma: fix race between runtime PM and device removal
  dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove()

 drivers/dma/xilinx/zynqmp_dma.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.49.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal
  2026-06-30  6:48 [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Golla Nagendra
@ 2026-06-30  6:48 ` Golla Nagendra
  2026-06-30  7:21   ` Pandey, Radhey Shyam
  2026-06-30  6:48 ` [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove() Golla Nagendra
  2026-07-02 16:03 ` [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Vinod Koul
  2 siblings, 1 reply; 6+ messages in thread
From: Golla Nagendra @ 2026-06-30  6:48 UTC (permalink / raw)
  To: vkoul, Frank.Li, michal.simek, nagendra.golla, abin.joseph, kees,
	ptsm, sakari.ailus, radhey.shyam.pandey, u.kleine-koenig
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel

In zynqmp_dma_remove(), runtime PM was disabled only after checking
state and doing a manual suspend. This can race with runtime PM in the
remove/unbind (rmmod) path.

Disable runtime PM first, then suspend only if the device is not already
suspended. To prevent any further runtime PM transitions.

Fixes: 72dd8b2914b5 ("dmaengine: zynqmp_dma: Add shutdown operation support")
Co-developed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
 drivers/dma/xilinx/zynqmp_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 1402331f7ef5..26f097db593d 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -1188,9 +1188,9 @@ static void zynqmp_dma_remove(struct platform_device *pdev)
 	dma_async_device_unregister(&zdev->common);
 
 	zynqmp_dma_chan_remove(zdev->chan);
-	if (pm_runtime_active(zdev->dev))
-		zynqmp_dma_runtime_suspend(zdev->dev);
 	pm_runtime_disable(zdev->dev);
+	if (!pm_runtime_status_suspended(zdev->dev))
+		zynqmp_dma_runtime_suspend(zdev->dev);
 }
 
 static const struct of_device_id zynqmp_dma_of_match[] = {
-- 
2.49.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove()
  2026-06-30  6:48 [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Golla Nagendra
  2026-06-30  6:48 ` [PATCH 1/2] " Golla Nagendra
@ 2026-06-30  6:48 ` Golla Nagendra
  2026-06-30  7:28   ` Pandey, Radhey Shyam
  2026-07-02 16:03 ` [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Vinod Koul
  2 siblings, 1 reply; 6+ messages in thread
From: Golla Nagendra @ 2026-06-30  6:48 UTC (permalink / raw)
  To: vkoul, Frank.Li, michal.simek, nagendra.golla, abin.joseph, kees,
	ptsm, sakari.ailus, radhey.shyam.pandey, u.kleine-koenig
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel

The zynqmp_dma_remove() function was converted from returning int to
void, but the kernel doc comment was not updated to reflect this change.
Remove the stale "Return: Always '0'" documentation that no longer
applies to the void function.

Fixes: b1c50ac25425 ("dmaengine: xilinx: zynqmp_dma: Convert to platform remove callback returning void")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
---
 drivers/dma/xilinx/zynqmp_dma.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 26f097db593d..ba6604dd7153 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -1177,8 +1177,6 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
 /**
  * zynqmp_dma_remove - Driver remove function
  * @pdev: Pointer to the platform_device structure
- *
- * Return: Always '0'
  */
 static void zynqmp_dma_remove(struct platform_device *pdev)
 {
-- 
2.49.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal
  2026-06-30  6:48 ` [PATCH 1/2] " Golla Nagendra
@ 2026-06-30  7:21   ` Pandey, Radhey Shyam
  0 siblings, 0 replies; 6+ messages in thread
From: Pandey, Radhey Shyam @ 2026-06-30  7:21 UTC (permalink / raw)
  To: Golla Nagendra, vkoul, Frank.Li, michal.simek, abin.joseph, kees,
	ptsm, sakari.ailus, radhey.shyam.pandey, u.kleine-koenig
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel

> In zynqmp_dma_remove(), runtime PM was disabled only after checking
> state and doing a manual suspend. This can race with runtime PM in the
> remove/unbind (rmmod) path.
> 
> Disable runtime PM first, then suspend only if the device is not already
> suspended. To prevent any further runtime PM transitions.
> 
> Fixes: 72dd8b2914b5 ("dmaengine: zynqmp_dma: Add shutdown operation support")
> Co-developed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!
> ---
>   drivers/dma/xilinx/zynqmp_dma.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 1402331f7ef5..26f097db593d 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -1188,9 +1188,9 @@ static void zynqmp_dma_remove(struct platform_device *pdev)
>   	dma_async_device_unregister(&zdev->common);
>   
>   	zynqmp_dma_chan_remove(zdev->chan);
> -	if (pm_runtime_active(zdev->dev))
> -		zynqmp_dma_runtime_suspend(zdev->dev);
>   	pm_runtime_disable(zdev->dev);
> +	if (!pm_runtime_status_suspended(zdev->dev))
> +		zynqmp_dma_runtime_suspend(zdev->dev);
>   }
>   
>   static const struct of_device_id zynqmp_dma_of_match[] = {



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove()
  2026-06-30  6:48 ` [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove() Golla Nagendra
@ 2026-06-30  7:28   ` Pandey, Radhey Shyam
  0 siblings, 0 replies; 6+ messages in thread
From: Pandey, Radhey Shyam @ 2026-06-30  7:28 UTC (permalink / raw)
  To: Golla Nagendra, vkoul, Frank.Li, michal.simek, abin.joseph, kees,
	ptsm, sakari.ailus, radhey.shyam.pandey, u.kleine-koenig
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel

On 6/30/2026 12:18 PM, Golla Nagendra wrote:
> The zynqmp_dma_remove() function was converted from returning int to
> void, but the kernel doc comment was not updated to reflect this change.
> Remove the stale "Return: Always '0'" documentation that no longer
> applies to the void function.
> 
> Fixes: b1c50ac25425 ("dmaengine: xilinx: zynqmp_dma: Convert to platform remove callback returning void")
> Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
> ---

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!

>   drivers/dma/xilinx/zynqmp_dma.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index 26f097db593d..ba6604dd7153 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -1177,8 +1177,6 @@ static int zynqmp_dma_probe(struct platform_device *pdev)
>   /**
>    * zynqmp_dma_remove - Driver remove function
>    * @pdev: Pointer to the platform_device structure
> - *
> - * Return: Always '0'
>    */
>   static void zynqmp_dma_remove(struct platform_device *pdev)
>   {



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal
  2026-06-30  6:48 [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Golla Nagendra
  2026-06-30  6:48 ` [PATCH 1/2] " Golla Nagendra
  2026-06-30  6:48 ` [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove() Golla Nagendra
@ 2026-07-02 16:03 ` Vinod Koul
  2 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2026-07-02 16:03 UTC (permalink / raw)
  To: Frank.Li, michal.simek, abin.joseph, kees, ptsm, sakari.ailus,
	radhey.shyam.pandey, u.kleine-koenig, Golla Nagendra
  Cc: git, dmaengine, linux-arm-kernel, linux-kernel


On Tue, 30 Jun 2026 12:18:42 +0530, Golla Nagendra wrote:
> This patch series addresses two issues in the zynqmp_dma_remove() function:
> 
> 1. Fix the race condition between runtime PM and device removal where
>    pm_runtime_disable() was called after the power state check, leaving
>    a window for the runtime PM framework to change state unexpectedly.
> 
> 2. Update the stale kernel doc comment that still references a return
>    value after the function was converted to return void.
> 
> [...]

Applied, thanks!

[1/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal
      commit: 516ba2d8b7aac4238f9fcbd58579c43c71b9b695
[2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove()
      commit: f7e89cba18a1ca6462712ae459a88dd40537b693

Best regards,
-- 
~Vinod




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-02 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  6:48 [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Golla Nagendra
2026-06-30  6:48 ` [PATCH 1/2] " Golla Nagendra
2026-06-30  7:21   ` Pandey, Radhey Shyam
2026-06-30  6:48 ` [PATCH 2/2] dmaengine: zynqmp_dma: fix kernel doc for zynqmp_dma_remove() Golla Nagendra
2026-06-30  7:28   ` Pandey, Radhey Shyam
2026-07-02 16:03 ` [PATCH 0/2] dmaengine: zynqmp_dma: fix race between runtime PM and device removal Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox