drm/msm/gpu: Fix idle_work time
Subsystems (4)
PATCH v2 1/3 drm/msm/gpu: Fix idle_work time
From: Rob Clark <[email protected]>
This was supposed to be a relative timer, not absolute.
--- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gpu_devfreq.c +1 -1
@@ -228,5 +228,5 @@ void msm_devfreq_idle(struct msm_gpu *gpu)struct msm_gpu_devfreq *df = &gpu->devfreq;msm_hrtimer_queue_work (&df->idle_work,ms_to_ktime (1 ), -HRTIMER_MODE_ABS ); +HRTIMER_MODE_REL ); }
Signature · 1 line
2.33.1
PATCH v2 2/3 drm/msm/gpu: Fix check for devices without devfreq
From: Rob Clark <[email protected]>
Looks like 658f4c829688 ("drm/msm/devfreq: Add 1ms delay before clamping freq") was badly rebased on top of efb8a170a367 ("drm/msm:
Fix devfreq NULL pointer dereference on a3xx") and ended up with the NULL check in the wrong place.
--- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/msm_gpu_devfreq.c +3 -3
@@ -203,9 +203,6 @@ static void msm_devfreq_idle_work(struct kthread_work *work) struct msm_gpu *gpu = container_of(df, struct msm_gpu, devfreq);unsigned long idle_freq, target_freq =0 ; -if (!df->devfreq) -return ; -/* * Hold devfreq lock to synchronize with get_dev_status()/ * target() callbacks
@@ -227,6 +224,9 @@ void msm_devfreq_idle(struct msm_gpu *gpu) {struct msm_gpu_devfreq *df = &gpu->devfreq; +if (!df->devfreq) +return ; +msm_hrtimer_queue_work (&df->idle_work,ms_to_ktime (1 ),HRTIMER_MODE_REL ); }
Signature · 1 line
2.33.1
PATCH v2 3/3 drm/msm/gpu: Respect PM QoS constraints
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
Re-work the boost and idle clamping to use PM QoS requests instead, so they get aggreggated with other requests (such as cooling device).
This does have the minor side-effect that devfreq sysfs min_freq/ max_freq files now reflect the boost and idle clamping, as they show (despite what they are documented to show) the aggregated min/max freq. Fixing that in devfreq does not look straightforward after considering that OPPs can be dynamically added/removed. However writes to the sysfs files still behave as expected.
v2: Use 64b math to avoid potential 32b overflow
--- drivers/gpu/drm/msm/msm_gpu.h | 33 +++++++--- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 87 +++++++++++++++------------ 2 files changed, 71 insertions(+), 49 deletions(-)
drivers/gpu/drm/msm/msm_gpu.h +23 -10
@@ -87,6 +87,21 @@ struct msm_gpu_devfreq {/** devfreq: devfreq instance */ struct devfreq *devfreq; +/** +* idle_constraint: +* +* A PM QoS constraint to limit max freq while the GPU is idle. +*/ +struct dev_pm_qos_request idle_freq; + +/** +* boost_constraint: +* +* A PM QoS constraint to boost min freq for a period of time +* until the boost expires. +*/ +struct dev_pm_qos_request boost_freq; +/** * busy_cycles: *
@@ -103,22 +118,19 @@ struct msm_gpu_devfreq {ktime_t idle_time;/** -* idle_freq: +* idle_work: * -* Shadow frequency used while the GPU is idle. From the PoV of -* the devfreq governor, we are continuing to sample busyness and -* adjust frequency while the GPU is idle, but we use this shadow -* value as the GPU is actually clamped to minimum frequency while -* it is inactive. +* Used to delay clamping to idle freq on active->idle transition. */ -unsigned long idle_freq; +struct msm_hrtimer_work idle_work;/** -* idle_work: +* boost_work: * -* Used to delay clamping to idle freq on active->idle transition. +* Used to reset the boost_constraint after the boost period has +* elapsed */ -struct msm_hrtimer_work idle_work; +struct msm_hrtimer_work boost_work; };struct msm_gpu {
@@ -498,6 +510,7 @@ void msm_devfreq_init(struct msm_gpu *gpu);void msm_devfreq_cleanup (struct msm_gpu *gpu);void msm_devfreq_resume (struct msm_gpu *gpu);void msm_devfreq_suspend (struct msm_gpu *gpu); +void msm_devfreq_boost (struct msm_gpu *gpu,unsigned factor);void msm_devfreq_active (struct msm_gpu *gpu);void msm_devfreq_idle (struct msm_gpu *gpu);
drivers/gpu/drm/msm/msm_gpu_devfreq.c +48 -39
170 lines not on this page · raw message
Signature · 1 line
2.33.1