fix fence is released when pass to **fence sometimes.
add reference for it.
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian K?nig <christian.koenig@amd.com>
sched_job->free_job(sched_job);
mutex_unlock(&sched_job->job_lock);
/* after processing job, free memory */
+ fence_put(&sched_job->s_fence->base);
kfree(sched_job);
}
struct amdgpu_cs_parser *amdgpu_cs_parser_create(struct amdgpu_device *adev,
return r;
}
ibs[num_ibs - 1].sequence = sched_job->s_fence->v_seq;
- *f = &sched_job->s_fence->base;
+ *f = fence_get(&sched_job->s_fence->base);
mutex_unlock(&sched_job->job_lock);
} else {
r = amdgpu_ib_schedule(adev, num_ibs, ibs, owner);
if (r)
return r;
- *f = &ibs[num_ibs - 1].fence->base;
+ *f = fence_get(&ibs[num_ibs - 1].fence->base);
}
return 0;
}
if (fence)
*fence = fence_get(f);
amdgpu_bo_unref(&bo);
-
+ fence_put(f);
if (amdgpu_enable_scheduler)
return 0;
goto err;
if (fence)
*fence = fence_get(f);
+ fence_put(f);
if (amdgpu_enable_scheduler)
return 0;
err:
goto err;
if (fence)
*fence = fence_get(f);
+ fence_put(f);
if (amdgpu_enable_scheduler)
return 0;
err:
&fence);
if (!r)
amdgpu_bo_fence(bo, fence, true);
+ fence_put(fence);
if (amdgpu_enable_scheduler) {
amdgpu_bo_unreserve(bo);
return 0;
if (r)
goto error_free;
amdgpu_bo_fence(pd, fence, true);
+ fence_put(fence);
}
if (!amdgpu_enable_scheduler || ib->length_dw == 0) {
fence_put(*fence);
*fence = fence_get(f);
}
+ fence_put(f);
if (!amdgpu_enable_scheduler) {
amdgpu_ib_free(adev, ib);
kfree(ib);
}
err1:
+ fence_put(f);
amdgpu_ib_free(adev, &ib);
err0:
amdgpu_wb_free(adev, index);
}
err2:
+ fence_put(f);
amdgpu_ib_free(adev, &ib);
err1:
amdgpu_gfx_scratch_free(adev, scratch);
r = -EINVAL;
}
err2:
+ fence_put(f);
amdgpu_ib_free(adev, &ib);
err1:
amdgpu_gfx_scratch_free(adev, scratch);
}
err1:
+ fence_put(f);
amdgpu_ib_free(adev, &ib);
err0:
amdgpu_wb_free(adev, index);
r = -EINVAL;
}
err1:
+ fence_put(f);
amdgpu_ib_free(adev, &ib);
err0:
amdgpu_wb_free(adev, index);
kfree(job);
return -EINVAL;
}
+ fence_get(&(*fence)->base);
job->s_fence = *fence;
while (kfifo_in_spinlocked(&c_entity->job_queue, &job, sizeof(void *),
&c_entity->queue_lock) != sizeof(void *)) {