]> git.baikalelectronics.ru Git - kernel.git/commit
drm/scheduler: fix timeout worker setup for out of order job completions
authorLucas Stach <l.stach@pengutronix.de>
Mon, 6 Aug 2018 13:12:48 +0000 (15:12 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 6 Aug 2018 20:58:00 +0000 (15:58 -0500)
commit568ccd46d983957497cf82bd8fcc717ce6725cfd
treebd7d771afeaf06390077524e0f983fea50abc8f3
parent9d9bff9e66167f75c13916f451a09537779a15b4
drm/scheduler: fix timeout worker setup for out of order job completions

drm_sched_job_finish() is a work item scheduled for each finished job on
a unbound system workqueue. This means the workers can execute out of order
with regard to the real hardware job completions.

If this happens queueing a timeout worker for the first job on the ring
mirror list is wrong, as this may be a job which has already finished
executing. Fix this by reorganizing the code to always queue the worker
for the next job on the list, if this job hasn't finished yet. This is
robust against a potential reordering of the finish workers.

Also move out the timeout worker cancelling, so that we don't need to
take the job list lock twice. As a small optimization list_del is used
to remove the job from the ring mirror list, as there is no need to
reinit the list head in the job we are about to free.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/scheduler/gpu_scheduler.c