diff options
author | Pixel Ding <Pixel.Ding@amd.com> | 2018-04-18 04:37:40 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 13:43:30 -0500 |
commit | b5b4ea4d98b42f94442e5d46d5942f392ed8af56 (patch) | |
tree | 6c0b82e8aaf998a17d9925e11112dcd30d560873 /drivers/gpu/drm/scheduler | |
parent | a4b3996aeebbaafd2682f4db06bb5659e1653da7 (diff) | |
download | op-kernel-dev-b5b4ea4d98b42f94442e5d46d5942f392ed8af56.zip op-kernel-dev-b5b4ea4d98b42f94442e5d46d5942f392ed8af56.tar.gz |
drm/scheduler: move last_sched fence updating prior to job popping (v2)
Make sure main thread won't update last_sched fence when entity
is cleanup.
Fix a racing issue which is caused by putting last_sched fence
twice. Running vulkaninfo in tight loop can produce this issue
as seeing wild fence pointer.
v2: squash in build fix (Christian)
Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/scheduler')
-rw-r--r-- | drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index 4968867..088ff2b 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -402,6 +402,9 @@ drm_sched_entity_pop_job(struct drm_sched_entity *entity) if (entity->guilty && atomic_read(entity->guilty)) dma_fence_set_error(&sched_job->s_fence->finished, -ECANCELED); + dma_fence_put(entity->last_scheduled); + entity->last_scheduled = dma_fence_get(&sched_job->s_fence->finished); + spsc_queue_pop(&entity->job_queue); return sched_job; } @@ -715,9 +718,6 @@ static int drm_sched_main(void *param) fence = sched->ops->run_job(sched_job); drm_sched_fence_scheduled(s_fence); - dma_fence_put(entity->last_scheduled); - entity->last_scheduled = dma_fence_get(&s_fence->finished); - if (fence) { s_fence->parent = dma_fence_get(fence); r = dma_fence_add_callback(fence, &s_fence->cb, |