Hi Andrey Where is your first patch (1/2)? I only saw the 2/2
BR Monk -----Original Message----- From: amd-gfx [mailto:[email protected]] On Behalf Of Andrey Grodzovsky Sent: 2017年10月7日 2:20 To: [email protected] Cc: Grodzovsky, Andrey <[email protected]>; Koenig, Christian <[email protected]> Subject: [PATCH 2/2] dmr/amdgpu: Move old fence waiting before reservation lock is aquired. From: Andrey Grodzovsky <[email protected]> This allows to avoid deadlock during GPU reset. Change-Id: I817e351b02e653f078063c57cec8a0d94062de12 Signed-off-by: Andrey Grodzovsky <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 15 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 ++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 0fa1bc7..79fefc8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -931,6 +931,9 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, { int i, j; int r, ce_preempt = 0, de_preempt = 0; + struct amdgpu_ctx_ring *cring; + unsigned idx = 0; + struct dma_fence *other = NULL; for (i = 0, j = 0; i < parser->nchunks && j < parser->job->num_ibs; i++) { struct amdgpu_cs_chunk *chunk; @@ -983,6 +986,18 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, parser->job->ring->funcs->type == AMDGPU_RING_TYPE_VCE)) return -EINVAL; + cring = &parser->ctx->rings[parser->job->ring->idx]; + idx = cring->sequence & (amdgpu_sched_jobs - 1); + other = cring->fences[idx]; + if (other) { + signed long r; + r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT); + if (r < 0) { + DRM_ERROR("Error (%ld) waiting for fence!\n", r); + return r; + } + } + return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index c073a68..758b643 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -260,12 +260,8 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, idx = seq & (amdgpu_sched_jobs - 1); other = cring->fences[idx]; - if (other) { - signed long r; - r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT); - if (r < 0) - DRM_ERROR("Error (%ld) waiting for fence!\n", r); - } + if (other) + BUG_ON(!dma_fence_is_signaled(other)); dma_fence_get(fence); -- 2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
