Skip to contentSkip to conversation

drm/amdgpu: fix deadlock of reservation between cs and gpu reset

PATCH In review Chunming Zhou 1 participant 2 messages Apr 27, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix deadlock of reservation between cs and gpu reset

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.

Change-Id I0f66d04b2bef3433035109623c8a5c5992c84202
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
index 9edb1a4..8c6d036 100644
@@ -1076,7 +1076,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
 	amdgpu_job_free_resources(job);
 
 	trace_amdgpu_cs_ioctl(job);
-	amd_sched_entity_push_job(&job->base);
 
 	return 0;
 }
@@ -1132,6 +1131,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 
 out:
 	amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
+	if (!r)
+		amd_sched_entity_push_job(&parser.job->base);
 	return r;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1493277617-14966-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

pls ignore this one, will send another new one.

Quoted 24 lines · Chunming Zhou

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.

Change-Id I0f66d04b2bef3433035109623c8a5c5992c84202
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -1
index 9edb1a4..8c6d036 100644
@@ -1076,7 +1076,6 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
  	amdgpu_job_free_resources(job);
 
  	trace_amdgpu_cs_ioctl(job);
-	amd_sched_entity_push_job(&job->base);
 
  	return 0;
  }

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · line 1138

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -0
@@ -1132,6 +1131,8 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 
  out:
  	amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
+	if (!r)
+		amd_sched_entity_push_job(&parser.job->base);
  	return r;
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx