mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu: fix dma_fence_wait without reference
We need to grab a reference to the fence we wait for. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
32e40ffbce
commit
75e1cafde1
|
@ -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;
|
||||||
|
|
||||||
if (other) {
|
spin_lock(&ctx->ring_lock);
|
||||||
signed long r;
|
idx = centity->sequence & (amdgpu_sched_jobs - 1);
|
||||||
r = dma_fence_wait(other, true);
|
other = dma_fence_get(centity->fences[idx]);
|
||||||
if (r < 0) {
|
spin_unlock(&ctx->ring_lock);
|
||||||
if (r != -ERESTARTSYS)
|
|
||||||
DRM_ERROR("Error (%ld) waiting for fence!\n", r);
|
|
||||||
|
|
||||||
return r;
|
if (!other)
|
||||||
}
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
r = dma_fence_wait(other, true);
|
||||||
|
if (r < 0 && r != -ERESTARTSYS)
|
||||||
|
DRM_ERROR("Error (%ld) waiting for fence!\n", r);
|
||||||
|
|
||||||
|
dma_fence_put(other);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
|
void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr)
|
||||||
|
|
Loading…
Reference in New Issue