Skip to content

Commit

Permalink
drm/amdgpu: fix deadlock of reservation between cs and gpu reset v2
Browse files Browse the repository at this point in the history
the case could happen when gpu reset:
1. when gpu reset, cs can be continue until sw queue is full, then push job will wait with holding pd reservation.
2. gpu_reset routine will also need pd reservation to restore page table from their shadow.
3. cs is waiting for gpu_reset complete, but gpu reset is waiting for cs releases reservation.

v2: handle amdgpu_cs_submit error path.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Chunming Zhou authored and Alex Deucher committed Apr 28, 2017
1 parent 44eb8c1 commit 10e709c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, p->fence);
job->uf_sequence = cs->out.handle;
amdgpu_job_free_resources(job);
amdgpu_cs_parser_fini(p, 0, true);

trace_amdgpu_cs_ioctl(job);
amd_sched_entity_push_job(&job->base);
Expand Down Expand Up @@ -1129,7 +1130,10 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
goto out;

r = amdgpu_cs_submit(&parser, cs);
if (r)
goto out;

return 0;
out:
amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
return r;
Expand Down

0 comments on commit 10e709c

Please sign in to comment.