Skip to content

Commit 61ee19d

Browse files
committed
drm/etnaviv: Protect the scheduler's pending list with its lock
Commit 704d3d6 ("drm/etnaviv: don't block scheduler when GPU is still active") ensured that active jobs are returned to the pending list when extending the timeout. However, it didn't use the pending list's lock to manipulate the list, which causes a race condition as the scheduler's workqueues are running. Hold the lock while manipulating the scheduler's pending list to prevent a race. Cc: [email protected] Fixes: 704d3d6 ("drm/etnaviv: don't block scheduler when GPU is still active") Reported-by: Philipp Stanner <[email protected]> Closes: https://lore.kernel.org/dri-devel/[email protected]/ Reviewed-by: Lucas Stach <[email protected]> Reviewed-by: Philipp Stanner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maíra Canal <[email protected]>
1 parent e1bc3a1 commit 61ee19d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/etnaviv/etnaviv_sched.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
3535
*sched_job)
3636
{
3737
struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
38+
struct drm_gpu_scheduler *sched = sched_job->sched;
3839
struct etnaviv_gpu *gpu = submit->gpu;
3940
u32 dma_addr, primid = 0;
4041
int change;
@@ -89,7 +90,9 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job
8990
return DRM_GPU_SCHED_STAT_NOMINAL;
9091

9192
out_no_timeout:
92-
list_add(&sched_job->list, &sched_job->sched->pending_list);
93+
spin_lock(&sched->job_list_lock);
94+
list_add(&sched_job->list, &sched->pending_list);
95+
spin_unlock(&sched->job_list_lock);
9396
return DRM_GPU_SCHED_STAT_NOMINAL;
9497
}
9598

0 commit comments

Comments
 (0)