Commit 75e1cafd authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: fix dma_fence_wait without reference

We need to grab a reference to the fence we wait for.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 32e40ffb
...@@ -541,21 +541,24 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, ...@@ -541,21 +541,24 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx,
struct drm_sched_entity *entity) struct drm_sched_entity *entity)
{ {
struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity); struct amdgpu_ctx_entity *centity = to_amdgpu_ctx_entity(entity);
unsigned idx = centity->sequence & (amdgpu_sched_jobs - 1); struct dma_fence *other;
struct dma_fence *other = centity->fences[idx]; unsigned idx;
long r;
spin_lock(&ctx->ring_lock);
idx = centity->sequence & (amdgpu_sched_jobs - 1);
other = dma_fence_get(centity->fences[idx]);
spin_unlock(&ctx->ring_lock);
if (!other)
return 0;
if (other) {
signed long r;
r = dma_fence_wait(other, true); r = dma_fence_wait(other, true);
if (r < 0) { if (r < 0 && r != -ERESTARTSYS)
if (r != -ERESTARTSYS)
DRM_ERROR("Error (%ld) waiting for fence!\n", r); DRM_ERROR("Error (%ld) waiting for fence!\n", r);
dma_fence_put(other);
return r; return r;
}
}
return 0;
} }
void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment