public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
	tomm.merciai@gmail.com
Cc: linux-renesas-soc@vger.kernel.org, biju.das.jz@bp.renesas.com,
	"Vinod Koul" <vkoul@kernel.org>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Fabrizio Castro" <fabrizio.castro.jz@renesas.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] dmaengine: sh: rz-dmac: Refactor runtime PM handling
Date: Mon, 12 Jan 2026 11:30:35 +0200	[thread overview]
Message-ID: <2ad40570-102e-448b-bf40-06af8ecdfca2@tuxon.dev> (raw)
In-Reply-To: <20250905144427.1840684-4-tommaso.merciai.xr@bp.renesas.com>

Hi, Tommaso,

On 9/5/25 17:44, Tommaso Merciai wrote:
> Refactor runtime PM handling to ensure correct power management and prevent
> resource leaks.  Invoke pm_runtime_get_sync() when allocating DMA channel
> resources and pm_runtime_put() when freeing them.  Add pm_runtime_put() in
> rz_dmac_probe() to balance the usage count during device initialization,
> and remove the unnecessary pm_runtime_put() from rz_dmac_remove() to avoid
> PM inconsistencies.
> 
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
>   drivers/dma/sh/rz-dmac.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index 0bc11a6038383..4ab6076f5499e 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -455,7 +455,7 @@ static int rz_dmac_alloc_chan_resources(struct dma_chan *chan)
>   	if (!channel->descs_allocated)
>   		return -ENOMEM;
>   
> -	return channel->descs_allocated;
> +	return pm_runtime_get_sync(chan->device->dev);

This looks wrong to me as, rz_dmac_alloc_chan_resources() could be 
called from the following path:

dma_request_chan() ->
   find_candidate() ->
     dma_chan_get() ->
       rz_dmac_alloc_chan_resources()

With this, the runtime PM reference counter is incremented on 
dma_request_chan() calls, when DMA consumers request DMA channels, and 
remains different than zero until the DMA channel is put. But, on 
suspend path, the runtime PM reference counter is not touched even when 
there are DMA channels requested.

Am I missing something?

Thank you,
Claudiu

  parent reply	other threads:[~2026-01-12  9:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 14:44 [PATCH 0/4] dmaengine: sh: rz-dmac: Add system sleep PM support Tommaso Merciai
2025-09-05 14:44 ` [PATCH 1/4] dmaengine: sh: rz-dmac: Use devm_pm_runtime_enable() Tommaso Merciai
2025-09-05 14:44 ` [PATCH 2/4] dmaengine: sh: rz-dmac: Use devm_add_action_or_reset() Tommaso Merciai
2025-09-05 14:53   ` Philipp Zabel
2025-09-05 15:22     ` Tommaso Merciai
2025-09-05 15:30       ` Philipp Zabel
2025-09-05 14:44 ` [PATCH 3/4] dmaengine: sh: rz-dmac: Refactor runtime PM handling Tommaso Merciai
2025-09-05 16:17   ` Biju Das
2026-01-12  9:30   ` Claudiu Beznea [this message]
2025-09-05 14:44 ` [PATCH 4/4] dmaengine: sh: rz-dmac: Add system sleep power management Tommaso Merciai
2025-09-05 15:36 ` [PATCH 0/4] dmaengine: sh: rz-dmac: Add system sleep PM support Tommaso Merciai

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=2ad40570-102e-448b-bf40-06af8ecdfca2@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=tomm.merciai@gmail.com \
    --cc=tommaso.merciai.xr@bp.renesas.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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