linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/msm/devfreq: Fix OPP refcnt leak
@ 2021-11-04 22:28 Rob Clark
  2021-11-05  0:11 ` Doug Anderson
  2021-11-05  4:32 ` Steev Klimaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Clark @ 2021-11-04 22:28 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, freedreno, Rob Clark, Douglas Anderson, Rob Clark,
	Sean Paul, David Airlie, Daniel Vetter, open list

From: Rob Clark <robdclark@chromium.org>

Reported-by: Douglas Anderson <dianders@chromium.org>
Fixes: 9bc95570175a ("drm/msm: Devfreq tuning")
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/msm/msm_gpu_devfreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index d32b729b4616..9bf8600b6eea 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -20,8 +20,6 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
 	struct msm_gpu *gpu = dev_to_gpu(dev);
 	struct dev_pm_opp *opp;
 
-	opp = devfreq_recommended_opp(dev, freq, flags);
-
 	/*
 	 * If the GPU is idle, devfreq is not aware, so just ignore
 	 * it's requests
@@ -31,6 +29,8 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
 		return 0;
 	}
 
+	opp = devfreq_recommended_opp(dev, freq, flags);
+
 	if (IS_ERR(opp))
 		return PTR_ERR(opp);
 
-- 
2.31.1


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

* Re: [PATCH] drm/msm/devfreq: Fix OPP refcnt leak
  2021-11-04 22:28 [PATCH] drm/msm/devfreq: Fix OPP refcnt leak Rob Clark
@ 2021-11-05  0:11 ` Doug Anderson
  2021-11-05  4:32 ` Steev Klimaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2021-11-05  0:11 UTC (permalink / raw)
  To: Rob Clark
  Cc: dri-devel, linux-arm-msm, freedreno, Rob Clark, Sean Paul,
	David Airlie, Daniel Vetter, open list

Hi,

On Thu, Nov 4, 2021 at 3:23 PM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 9bc95570175a ("drm/msm: Devfreq tuning")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
>  drivers/gpu/drm/msm/msm_gpu_devfreq.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

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

* Re: [PATCH] drm/msm/devfreq: Fix OPP refcnt leak
  2021-11-04 22:28 [PATCH] drm/msm/devfreq: Fix OPP refcnt leak Rob Clark
  2021-11-05  0:11 ` Doug Anderson
@ 2021-11-05  4:32 ` Steev Klimaszewski
  2021-11-05 15:29   ` Doug Anderson
  1 sibling, 1 reply; 4+ messages in thread
From: Steev Klimaszewski @ 2021-11-05  4:32 UTC (permalink / raw)
  To: Rob Clark, dri-devel
  Cc: linux-arm-msm, freedreno, Rob Clark, Douglas Anderson, Sean Paul,
	David Airlie, Daniel Vetter, open list


On 11/4/21 5:28 PM, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 9bc95570175a ("drm/msm: Devfreq tuning")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
>   drivers/gpu/drm/msm/msm_gpu_devfreq.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> index d32b729b4616..9bf8600b6eea 100644
> --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> @@ -20,8 +20,6 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
>   	struct msm_gpu *gpu = dev_to_gpu(dev);
>   	struct dev_pm_opp *opp;
>   
> -	opp = devfreq_recommended_opp(dev, freq, flags);
> -
>   	/*
>   	 * If the GPU is idle, devfreq is not aware, so just ignore
>   	 * it's requests
> @@ -31,6 +29,8 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
>   		return 0;
>   	}
>   
> +	opp = devfreq_recommended_opp(dev, freq, flags);
> +
>   	if (IS_ERR(opp))
>   		return PTR_ERR(opp);
>   

Testing this here on the Lenovo Yoga C630, and I'm starting to see in my 
dmesg output

[   36.337061] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[   36.388122] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[   36.810941] wcd934x-codec wcd934x-codec.3.auto: Port Closed RX port 
1, value 4
[   36.811914] wcd934x-codec wcd934x-codec.3.auto: Port Closed RX port 
2, value 4
[  198.794946] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  198.845698] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  502.285421] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  502.339427] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  503.361469] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  503.412757] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  503.871480] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  503.922712] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  503.974474] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  504.025501] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  505.923563] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  505.974513] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  510.313052] usb 3-1.3: USB disconnect, device number 4
[  519.677148] usb 3-1.3: new high-speed USB device number 5 using xhci-hcd
[  519.793394] usb 3-1.3: New USB device found, idVendor=5986, 
idProduct=2115, bcdDevice=54.20
[  519.793441] usb 3-1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[  519.793472] usb 3-1.3: Product: Integrated Camera
[  519.793495] usb 3-1.3: Manufacturer: SunplusIT Inc
[  519.861020] usb 3-1.3: Found UVC 1.00 device Integrated Camera 
(5986:2115)
[  519.892879] input: Integrated Camera: Integrated C as 
/devices/platform/soc@0/a8f8800.usb/a800000.dwc3/xhci-hcd.1.auto/usb3/3-1/3-1.3/3-1.3:1.0/input/input27
[  520.283839] devfreq 5000000.gpu: Couldn't update frequency transition 
information.
[  520.335854] devfreq 5000000.gpu: Couldn't update frequency transition 
information.


Is this intended?


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

* Re: [PATCH] drm/msm/devfreq: Fix OPP refcnt leak
  2021-11-05  4:32 ` Steev Klimaszewski
@ 2021-11-05 15:29   ` Doug Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2021-11-05 15:29 UTC (permalink / raw)
  To: Steev Klimaszewski
  Cc: Rob Clark, dri-devel, linux-arm-msm, freedreno, Rob Clark,
	Sean Paul, David Airlie, Daniel Vetter, open list

Hi,

On Thu, Nov 4, 2021 at 9:32 PM Steev Klimaszewski <steev@kali.org> wrote:
>
>
> On 11/4/21 5:28 PM, Rob Clark wrote:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Reported-by: Douglas Anderson <dianders@chromium.org>
> > Fixes: 9bc95570175a ("drm/msm: Devfreq tuning")
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> >   drivers/gpu/drm/msm/msm_gpu_devfreq.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> > index d32b729b4616..9bf8600b6eea 100644
> > --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> > +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
> > @@ -20,8 +20,6 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
> >       struct msm_gpu *gpu = dev_to_gpu(dev);
> >       struct dev_pm_opp *opp;
> >
> > -     opp = devfreq_recommended_opp(dev, freq, flags);
> > -
> >       /*
> >        * If the GPU is idle, devfreq is not aware, so just ignore
> >        * it's requests
> > @@ -31,6 +29,8 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
> >               return 0;
> >       }
> >
> > +     opp = devfreq_recommended_opp(dev, freq, flags);
> > +
> >       if (IS_ERR(opp))
> >               return PTR_ERR(opp);
> >
>
> Testing this here on the Lenovo Yoga C630, and I'm starting to see in my
> dmesg output
>
> [   36.337061] devfreq 5000000.gpu: Couldn't update frequency transition
> information.
> [   36.388122] devfreq 5000000.gpu: Couldn't update frequency transition
> information.

Ah, I think this makes sense. We're now storing a frequency which
might not match an actual "opp" and I suppose that we must return it
in some cases.

I guess a simple fix is to still call devfreq_recommended_opp() in the
idle case but just call dev_pm_opp_put() to fix the leak.

-Doug

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

end of thread, other threads:[~2021-11-05 15:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 22:28 [PATCH] drm/msm/devfreq: Fix OPP refcnt leak Rob Clark
2021-11-05  0:11 ` Doug Anderson
2021-11-05  4:32 ` Steev Klimaszewski
2021-11-05 15:29   ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).