Skip to content

Commit 514447a

Browse files
committed
drm/xe: Stop accumulating LRC timestamp on job_free
The exec queue timestamp is only really useful when it's being queried through the fdinfo. There's no need to update it so often, on every job_free. Tracing a simple app like vkcube running shows an update rate of ~ 120Hz. In case of discrete, the BO is on vram, creating a lot of pcie transactions. The update on job_free() is used to cover a gap: if exec queue is created and destroyed rapidly, before a new query, the timestamp still needs to be accumulated and accounted for in the xef. Initial implementation in commit 6109f24 ("drm/xe: Add helper to accumulate exec queue runtime") couldn't do it on the exec_queue_fini since the xef could be gone at that point. However since commit ce8c161 ("drm/xe: Add ref counting for xe_file") the xef is refcounted and the exec queue always holds a reference, making this safe now. Improve the fix in commit 2149ded ("drm/xe: Fix use after free when client stats are captured") by reducing the frequency in which the update is needed. Fixes: 2149ded ("drm/xe: Fix use after free when client stats are captured") Reviewed-by: Nirmoy Das <[email protected]> Reviewed-by: Jonathan Cavitt <[email protected]> Reviewed-by: Umesh Nerlige Ramappa <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]> (cherry picked from commit 83db047) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent a353c78 commit 514447a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/gpu/drm/xe/xe_exec_queue.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,14 @@ void xe_exec_queue_fini(struct xe_exec_queue *q)
260260
{
261261
int i;
262262

263+
/*
264+
* Before releasing our ref to lrc and xef, accumulate our run ticks
265+
*/
266+
xe_exec_queue_update_run_ticks(q);
267+
263268
for (i = 0; i < q->width; ++i)
264269
xe_lrc_put(q->lrc[i]);
270+
265271
__xe_exec_queue_free(q);
266272
}
267273

drivers/gpu/drm/xe/xe_guc_submit.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,6 @@ static void guc_exec_queue_free_job(struct drm_sched_job *drm_job)
745745
{
746746
struct xe_sched_job *job = to_xe_sched_job(drm_job);
747747

748-
xe_exec_queue_update_run_ticks(job->q);
749-
750748
trace_xe_sched_job_free(job);
751749
xe_sched_job_put(job);
752750
}

0 commit comments

Comments
 (0)