diff options
author | Monk Liu <Monk.Liu@amd.com> | 2017-09-15 01:40:31 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-09-26 15:14:13 -0400 |
commit | eb01abc7c4fd1faa26d0787f410894d9c704eb60 (patch) | |
tree | 645e1a8f4c2cae1784f9363e0c9bab99d9147c45 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
parent | f840cc5f8447db7efff447a25bcddbf084bd3e2e (diff) |
drm/amdgpu:make ctx_add_fence interruptible(v2)
otherwise a gpu hang will make application couldn't be killed
under timedout=0 mode
v2:
Fix memoryleak job/job->s_fence issue
unlock mn
remove the ERROR msg after waiting being interrupted
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index a11e44340b23..75c933b1a432 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -246,8 +246,8 @@ int amdgpu_ctx_put(struct amdgpu_ctx *ctx) | |||
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, | 249 | int amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, |
250 | struct dma_fence *fence) | 250 | struct dma_fence *fence, uint64_t* handler) |
251 | { | 251 | { |
252 | struct amdgpu_ctx_ring *cring = & ctx->rings[ring->idx]; | 252 | struct amdgpu_ctx_ring *cring = & ctx->rings[ring->idx]; |
253 | uint64_t seq = cring->sequence; | 253 | uint64_t seq = cring->sequence; |
@@ -258,9 +258,9 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, | |||
258 | other = cring->fences[idx]; | 258 | other = cring->fences[idx]; |
259 | if (other) { | 259 | if (other) { |
260 | signed long r; | 260 | signed long r; |
261 | r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT); | 261 | r = dma_fence_wait_timeout(other, true, MAX_SCHEDULE_TIMEOUT); |
262 | if (r < 0) | 262 | if (r < 0) |
263 | DRM_ERROR("Error (%ld) waiting for fence!\n", r); | 263 | return r; |
264 | } | 264 | } |
265 | 265 | ||
266 | dma_fence_get(fence); | 266 | dma_fence_get(fence); |
@@ -271,8 +271,10 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, | |||
271 | spin_unlock(&ctx->ring_lock); | 271 | spin_unlock(&ctx->ring_lock); |
272 | 272 | ||
273 | dma_fence_put(other); | 273 | dma_fence_put(other); |
274 | if (handler) | ||
275 | *handler = seq; | ||
274 | 276 | ||
275 | return seq; | 277 | return 0; |
276 | } | 278 | } |
277 | 279 | ||
278 | struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, | 280 | struct dma_fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, |