Skip to content

Commit b99773e

Browse files
author
Steven Price
committed
drm/panfrost: Fix inbalance of devfreq record_busy/idle()
The calls to panfrost_devfreq_record_busy() and panfrost_devfreq_record_idle() must be balanced to ensure that the devfreq utilisation is correctly reported. But there are two cases where this doesn't work correctly. In panfrost_job_hw_submit() if pm_runtime_get_sync() fails or the WARN_ON() fires then no call to panfrost_devfreq_record_busy() is made, but when the job times out the corresponding _record_idle() call is still made in panfrost_job_timedout(). Move the call up to ensure that it always happens. Secondly panfrost_job_timedout() only makes a single call to panfrost_devfreq_record_idle() even if it is cleaning up multiple jobs. Move the call inside the loop to ensure that the number of _record_idle() calls matches the number of _record_busy() calls. Fixes: 9e62b88 ("drm/panfrost: Simplify devfreq utilisation tracking") Acked-by: Alyssa Rosenzweig <[email protected]> Signed-off-by: Steven Price <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c8fa5b7 commit b99773e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/panfrost/panfrost_job.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
145145
u64 jc_head = job->jc;
146146
int ret;
147147

148+
panfrost_devfreq_record_busy(pfdev);
149+
148150
ret = pm_runtime_get_sync(pfdev->dev);
149151
if (ret < 0)
150152
return;
@@ -155,7 +157,6 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
155157
}
156158

157159
cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu);
158-
panfrost_devfreq_record_busy(pfdev);
159160

160161
job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF);
161162
job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32);
@@ -410,12 +411,12 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
410411
for (i = 0; i < NUM_JOB_SLOTS; i++) {
411412
if (pfdev->jobs[i]) {
412413
pm_runtime_put_noidle(pfdev->dev);
414+
panfrost_devfreq_record_idle(pfdev);
413415
pfdev->jobs[i] = NULL;
414416
}
415417
}
416418
spin_unlock_irqrestore(&pfdev->js->job_lock, flags);
417419

418-
panfrost_devfreq_record_idle(pfdev);
419420
panfrost_device_reset(pfdev);
420421

421422
for (i = 0; i < NUM_JOB_SLOTS; i++)

0 commit comments

Comments
 (0)