* [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2)
@ 2022-03-08 18:48 Rob Clark
2022-03-08 18:52 ` Fabio Estevam
2022-03-08 21:03 ` Dmitry Baryshkov
0 siblings, 2 replies; 4+ messages in thread
From: Rob Clark @ 2022-03-08 18:48 UTC (permalink / raw)
To: dri-devel
Cc: freedreno, linux-arm-msm, Rob Clark,
Linux Kernel Functional Testing, Anders Roxell, Rob Clark,
Sean Paul, Abhinav Kumar, David Airlie, Daniel Vetter, open list
From: Rob Clark <robdclark@chromium.org>
Avoid going down devfreq paths on devices where devfreq is not
initialized.
v2: Change has_devfreq() logic [Dmitry]
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
drivers/gpu/drm/msm/msm_gpu_devfreq.c | 30 ++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index 9bf319be11f6..12641616acd3 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -83,6 +83,12 @@ static struct devfreq_dev_profile msm_devfreq_profile = {
static void msm_devfreq_boost_work(struct kthread_work *work);
static void msm_devfreq_idle_work(struct kthread_work *work);
+static bool has_devfreq(struct msm_gpu *gpu)
+{
+ struct msm_gpu_devfreq *df = &gpu->devfreq;
+ return !!df->devfreq;
+}
+
void msm_devfreq_init(struct msm_gpu *gpu)
{
struct msm_gpu_devfreq *df = &gpu->devfreq;
@@ -149,6 +155,9 @@ void msm_devfreq_cleanup(struct msm_gpu *gpu)
{
struct msm_gpu_devfreq *df = &gpu->devfreq;
+ if (!has_devfreq(gpu))
+ return;
+
devfreq_cooling_unregister(gpu->cooling);
dev_pm_qos_remove_request(&df->boost_freq);
dev_pm_qos_remove_request(&df->idle_freq);
@@ -156,16 +165,24 @@ void msm_devfreq_cleanup(struct msm_gpu *gpu)
void msm_devfreq_resume(struct msm_gpu *gpu)
{
- gpu->devfreq.busy_cycles = 0;
- gpu->devfreq.time = ktime_get();
+ struct msm_gpu_devfreq *df = &gpu->devfreq;
- devfreq_resume_device(gpu->devfreq.devfreq);
+ if (!has_devfreq(gpu))
+ return;
+
+ df->busy_cycles = 0;
+ df->time = ktime_get();
+
+ devfreq_resume_device(df->devfreq);
}
void msm_devfreq_suspend(struct msm_gpu *gpu)
{
struct msm_gpu_devfreq *df = &gpu->devfreq;
+ if (!has_devfreq(gpu))
+ return;
+
devfreq_suspend_device(df->devfreq);
cancel_idle_work(df);
@@ -185,6 +202,9 @@ void msm_devfreq_boost(struct msm_gpu *gpu, unsigned factor)
struct msm_gpu_devfreq *df = &gpu->devfreq;
uint64_t freq;
+ if (!has_devfreq(gpu))
+ return;
+
freq = get_freq(gpu);
freq *= factor;
@@ -207,7 +227,7 @@ void msm_devfreq_active(struct msm_gpu *gpu)
struct devfreq_dev_status status;
unsigned int idle_time;
- if (!df->devfreq)
+ if (!has_devfreq(gpu))
return;
/*
@@ -253,7 +273,7 @@ void msm_devfreq_idle(struct msm_gpu *gpu)
{
struct msm_gpu_devfreq *df = &gpu->devfreq;
- if (!df->devfreq)
+ if (!has_devfreq(gpu))
return;
msm_hrtimer_queue_work(&df->idle_work, ms_to_ktime(1),
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2)
2022-03-08 18:48 [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2) Rob Clark
@ 2022-03-08 18:52 ` Fabio Estevam
2022-03-08 19:00 ` Rob Clark
2022-03-08 21:03 ` Dmitry Baryshkov
1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2022-03-08 18:52 UTC (permalink / raw)
To: Rob Clark
Cc: DRI mailing list, Rob Clark, Anders Roxell, David Airlie,
linux-arm-msm, Abhinav Kumar, open list, Sean Paul,
Linux Kernel Functional Testing,
open list:DRM DRIVER FOR MSM ADRENO GPU
On Tue, Mar 8, 2022 at 3:48 PM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> Avoid going down devfreq paths on devices where devfreq is not
> initialized.
>
> v2: Change has_devfreq() logic [Dmitry]
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Reported-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Does this need a Fixes tag?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2)
2022-03-08 18:52 ` Fabio Estevam
@ 2022-03-08 19:00 ` Rob Clark
0 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2022-03-08 19:00 UTC (permalink / raw)
To: Fabio Estevam
Cc: DRI mailing list, Rob Clark, Anders Roxell, David Airlie,
linux-arm-msm, Abhinav Kumar, open list, Sean Paul,
Linux Kernel Functional Testing,
open list:DRM DRIVER FOR MSM ADRENO GPU
On Tue, Mar 8, 2022 at 10:53 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> On Tue, Mar 8, 2022 at 3:48 PM Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Avoid going down devfreq paths on devices where devfreq is not
> > initialized.
> >
> > v2: Change has_devfreq() logic [Dmitry]
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > Reported-by: Anders Roxell <anders.roxell@linaro.org>
Fixes: 6aa89ae1fb04 ("drm/msm/gpu: Cancel idle/boost work on suspend")
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
>
> Does this need a Fixes tag?
Yes, sorry, patchwork had picked up the fixes tag from previous
version but I'd forgot to add it locally
BR,
-R
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2)
2022-03-08 18:48 [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2) Rob Clark
2022-03-08 18:52 ` Fabio Estevam
@ 2022-03-08 21:03 ` Dmitry Baryshkov
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2022-03-08 21:03 UTC (permalink / raw)
To: Rob Clark
Cc: dri-devel, freedreno, linux-arm-msm, Rob Clark,
Linux Kernel Functional Testing, Anders Roxell, Sean Paul,
Abhinav Kumar, David Airlie, Daniel Vetter, open list
On Tue, 8 Mar 2022 at 21:48, Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> Avoid going down devfreq paths on devices where devfreq is not
> initialized.
>
> v2: Change has_devfreq() logic [Dmitry]
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> Reported-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/msm_gpu_devfreq.c | 30 ++++++++++++++++++++++-----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-08 21:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-08 18:48 [PATCH] drm/msm/gpu: Fix crash on devices without devfreq support (v2) Rob Clark
2022-03-08 18:52 ` Fabio Estevam
2022-03-08 19:00 ` Rob Clark
2022-03-08 21:03 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox