All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steev Klimaszewski <steev@kali.org>
To: Caleb Connolly <caleb.connolly@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: qcom: bam_dma: fix runtime PM underflow
Date: Sat, 11 Jun 2022 13:19:27 -0500	[thread overview]
Message-ID: <03923830-c3ae-6ef8-890a-361341c18e95@kali.org> (raw)
In-Reply-To: <20220609195043.1544625-1-caleb.connolly@linaro.org>

Hi Caleb,

On 6/9/22 2:50 PM, Caleb Connolly wrote:
> When PM runtime is disabled, pm_runtime_get() isn't called, but
> pm_runtime_put() still is. Fix this by creating a matching wrapper
> on pm_runtime_put_autosuspend().
>
> Fixes: dbad41e7bb5f ("dmaengine: qcom: bam_dma: check if the runtime pm enabled")
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>   drivers/dma/qcom/bam_dma.c | 18 +++++++++++++-----
>   1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
> index 87f6ca1541cf..a36dedee262e 100644
> --- a/drivers/dma/qcom/bam_dma.c
> +++ b/drivers/dma/qcom/bam_dma.c
> @@ -566,6 +566,14 @@ static int bam_pm_runtime_get_sync(struct device *dev)
>   	return 0;
>   }
>   
> +static int bam_pm_runtime_put_autosuspend(struct device *dev)
> +{
> +	if (pm_runtime_enabled(dev))
> +		return pm_runtime_put_autosuspend(dev);
> +
> +	return 0;
> +}
> +
>   /**
>    * bam_free_chan - Frees dma resources associated with specific channel
>    * @chan: specified channel
> @@ -617,7 +625,7 @@ static void bam_free_chan(struct dma_chan *chan)
>   
>   err:
>   	pm_runtime_mark_last_busy(bdev->dev);
> -	pm_runtime_put_autosuspend(bdev->dev);
> +	bam_pm_runtime_put_autosuspend(bdev->dev);
>   }
>   
>   /**
> @@ -793,7 +801,7 @@ static int bam_pause(struct dma_chan *chan)
>   	bchan->paused = 1;
>   	spin_unlock_irqrestore(&bchan->vc.lock, flag);
>   	pm_runtime_mark_last_busy(bdev->dev);
> -	pm_runtime_put_autosuspend(bdev->dev);
> +	bam_pm_runtime_put_autosuspend(bdev->dev);
>   
>   	return 0;
>   }
> @@ -819,7 +827,7 @@ static int bam_resume(struct dma_chan *chan)
>   	bchan->paused = 0;
>   	spin_unlock_irqrestore(&bchan->vc.lock, flag);
>   	pm_runtime_mark_last_busy(bdev->dev);
> -	pm_runtime_put_autosuspend(bdev->dev);
> +	bam_pm_runtime_put_autosuspend(bdev->dev);
>   
>   	return 0;
>   }
> @@ -936,7 +944,7 @@ static irqreturn_t bam_dma_irq(int irq, void *data)
>   	}
>   
>   	pm_runtime_mark_last_busy(bdev->dev);
> -	pm_runtime_put_autosuspend(bdev->dev);
> +	bam_pm_runtime_put_autosuspend(bdev->dev);
>   
>   	return IRQ_HANDLED;
>   }
> @@ -1111,7 +1119,7 @@ static void bam_start_dma(struct bam_chan *bchan)
>   			bam_addr(bdev, bchan->id, BAM_P_EVNT_REG));
>   
>   	pm_runtime_mark_last_busy(bdev->dev);
> -	pm_runtime_put_autosuspend(bdev->dev);
> +	bam_pm_runtime_put_autosuspend(bdev->dev);
>   }
>   
>   /**

I've tested this patch here and no longer see the logs filling up with 
messages about Runtime PM underflows.  Tested on the Lenovo Yoga C630.


Tested-by: Steev Klimaszewski <steev@kali.org>


  reply	other threads:[~2022-06-11 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 19:50 [PATCH] dmaengine: qcom: bam_dma: fix runtime PM underflow Caleb Connolly
2022-06-11 18:19 ` Steev Klimaszewski [this message]
2022-06-16 14:00 ` Vinod Koul
2022-06-28 12:08   ` Caleb Connolly
2022-07-02  8:48 ` Yassine Oudjana

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=03923830-c3ae-6ef8-890a-361341c18e95@kali.org \
    --to=steev@kali.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=caleb.connolly@linaro.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.