The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] dmaengine: pl330: fix autosuspend cleanup during removal
@ 2026-08-08  9:44 Guangshuo Li
  2026-08-18  8:35 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Guangshuo Li @ 2026-08-08  9:44 UTC (permalink / raw)
  To: Vinod Koul, Frank Li, Russell King, Ulf Hansson,
	Krzysztof Kozlowski, dmaengine, linux-kernel
  Cc: Guangshuo Li, stable

pl330_probe() calls pm_runtime_use_autosuspend(), but pl330_remove()
does not call the matching pm_runtime_dont_use_autosuspend() when
removing the device.

If the autosuspend delay is set to a negative value while autosuspend
is enabled, the runtime PM core increments usage_count to prevent
runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
during teardown, this reference is not dropped and usage_count remains
unbalanced.

Add the missing pm_runtime_dont_use_autosuspend() call before restoring
the runtime PM usage reference in the remove path.

This issue was found by manual code inspection.

Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/dma/pl330.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 25ba84b18704..8baadd104719 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -3204,6 +3204,7 @@ static void pl330_remove(struct amba_device *adev)
 	struct dma_pl330_chan *pch, *_p;
 	int i, irq;
 
+	pm_runtime_dont_use_autosuspend(&adev->dev);
 	pm_runtime_get_noresume(pl330->ddma.dev);
 
 	if (adev->dev.of_node)
-- 
2.43.0


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

* Re: [PATCH] dmaengine: pl330: fix autosuspend cleanup during removal
  2026-08-08  9:44 [PATCH] dmaengine: pl330: fix autosuspend cleanup during removal Guangshuo Li
@ 2026-08-18  8:35 ` Johan Hovold
  2026-08-18  8:42   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2026-08-18  8:35 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Vinod Koul, Frank Li, Russell King, Ulf Hansson,
	Krzysztof Kozlowski, dmaengine, linux-kernel, stable

On Sat, Aug 08, 2026 at 05:44:52PM +0800, Guangshuo Li wrote:
> pl330_probe() calls pm_runtime_use_autosuspend(), but pl330_remove()
> does not call the matching pm_runtime_dont_use_autosuspend() when
> removing the device.
> 
> If the autosuspend delay is set to a negative value while autosuspend
> is enabled, the runtime PM core increments usage_count to prevent
> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
> during teardown, this reference is not dropped and usage_count remains
> unbalanced.

As I've explained elsewhere, this is just misleading. There is no usage
count leak here as the count is balanced whenever the user re-enables
autosuspend through sysfs (by writing a non-negative timeout).

Drivers should clean up after themselves and disable autosuspend, but
this is more of a clean up than a fix and should not be backported.

You've sent upwards of 60 of these in the matter of a just a few days,
some which have even been picked up. Please send follow-ups (replies or
v2s) as soon as possible to prevent further of these from getting
merged.

> Add the missing pm_runtime_dont_use_autosuspend() call before restoring
> the runtime PM usage reference in the remove path.
> 
> This issue was found by manual code inspection.
> 
> Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>

Johan

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

* Re: [PATCH] dmaengine: pl330: fix autosuspend cleanup during removal
  2026-08-18  8:35 ` Johan Hovold
@ 2026-08-18  8:42   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-18  8:42 UTC (permalink / raw)
  To: Johan Hovold, Guangshuo Li
  Cc: Vinod Koul, Frank Li, Russell King, Ulf Hansson, dmaengine,
	linux-kernel, stable

On 18/08/2026 10:35, Johan Hovold wrote:
> On Sat, Aug 08, 2026 at 05:44:52PM +0800, Guangshuo Li wrote:
>> pl330_probe() calls pm_runtime_use_autosuspend(), but pl330_remove()
>> does not call the matching pm_runtime_dont_use_autosuspend() when
>> removing the device.
>>
>> If the autosuspend delay is set to a negative value while autosuspend
>> is enabled, the runtime PM core increments usage_count to prevent
>> runtime suspend. Without calling pm_runtime_dont_use_autosuspend()
>> during teardown, this reference is not dropped and usage_count remains
>> unbalanced.
> 
> As I've explained elsewhere, this is just misleading. There is no usage
> count leak here as the count is balanced whenever the user re-enables
> autosuspend through sysfs (by writing a non-negative timeout).
> 
> Drivers should clean up after themselves and disable autosuspend, but
> this is more of a clean up than a fix and should not be backported.
> 
> You've sent upwards of 60 of these in the matter of a just a few days,
> some which have even been picked up. Please send follow-ups (replies or
> v2s) as soon as possible to prevent further of these from getting
> merged.
> 
>> Add the missing pm_runtime_dont_use_autosuspend() call before restoring
>> the runtime PM usage reference in the remove path.
>>
>> This issue was found by manual code inspection.
>>
>> Fixes: ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>


So EVERY patch was sent separately, even when targeting the same subsystem:
https://lore.kernel.org/all/?q=f%3Algs201920130244%40gmail.com

making it IMPOSSIBLE to respond in efficient way. This is just unacceptable.

Best regards,
Krzysztof

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

end of thread, other threads:[~2026-08-18  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08  9:44 [PATCH] dmaengine: pl330: fix autosuspend cleanup during removal Guangshuo Li
2026-08-18  8:35 ` Johan Hovold
2026-08-18  8:42   ` Krzysztof Kozlowski

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