diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2017-04-27 03:13:52 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-28 17:33:14 -0400 |
commit | 10e709cb296c98424c03408d23e3addeddcd4088 (patch) | |
tree | 7d8da7f73eb37953ee163ccfd1412fd47e6ce4f7 | |
parent | 44eb8c1b33619abc35cba0266ff497c843bd108d (diff) |
drm/amdgpu: fix deadlock of reservation between cs and gpu reset v2
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index ec71b9320561..4e6b9501ab0a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -1074,6 +1074,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, | |||
1074 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, p->fence); | 1074 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, p->fence); |
1075 | job->uf_sequence = cs->out.handle; | 1075 | job->uf_sequence = cs->out.handle; |
1076 | amdgpu_job_free_resources(job); | 1076 | amdgpu_job_free_resources(job); |
1077 | amdgpu_cs_parser_fini(p, 0, true); | ||
1077 | 1078 | ||
1078 | trace_amdgpu_cs_ioctl(job); | 1079 | trace_amdgpu_cs_ioctl(job); |
1079 | amd_sched_entity_push_job(&job->base); | 1080 | amd_sched_entity_push_job(&job->base); |
@@ -1129,7 +1130,10 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
1129 | goto out; | 1130 | goto out; |
1130 | 1131 | ||
1131 | r = amdgpu_cs_submit(&parser, cs); | 1132 | r = amdgpu_cs_submit(&parser, cs); |
1133 | if (r) | ||
1134 | goto out; | ||
1132 | 1135 | ||
1136 | return 0; | ||
1133 | out: | 1137 | out: |
1134 | amdgpu_cs_parser_fini(&parser, r, reserved_buffers); | 1138 | amdgpu_cs_parser_fini(&parser, r, reserved_buffers); |
1135 | return r; | 1139 | return r; |