[PATCH 1/2] drm/msm/devfreq: Add some locking asserts

From: Rob Clark
Date: Wed Nov 03 2021 - 16:59:10 EST


From: Rob Clark <robdclark@xxxxxxxxxxxx>

Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx>
---
drivers/gpu/drm/msm/msm_gpu_devfreq.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index 47b3cf2df230..b24e5475cafb 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -20,6 +20,8 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
struct msm_gpu *gpu = dev_to_gpu(dev);
struct dev_pm_opp *opp;

+ WARN_ON(!mutex_is_locked(&gpu->devfreq.devfreq->lock));
+
opp = devfreq_recommended_opp(dev, freq, flags);

/*
@@ -63,6 +65,8 @@ static int msm_devfreq_get_dev_status(struct device *dev,
struct msm_gpu *gpu = dev_to_gpu(dev);
ktime_t time;

+ WARN_ON(!mutex_is_locked(&gpu->devfreq.devfreq->lock));
+
status->current_frequency = get_freq(gpu);
status->busy_time = gpu->funcs->gpu_busy(gpu);

@@ -75,7 +79,11 @@ static int msm_devfreq_get_dev_status(struct device *dev,

static int msm_devfreq_get_cur_freq(struct device *dev, unsigned long *freq)
{
- *freq = get_freq(dev_to_gpu(dev));
+ struct msm_gpu *gpu = dev_to_gpu(dev);
+
+ WARN_ON(!mutex_is_locked(&gpu->devfreq.devfreq->lock));
+
+ *freq = get_freq(gpu);

return 0;
}
--
2.31.1