Commit 1e24e31f authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: remove use_shed hack in job cleanup

Remembering the code path in a variable to cleanup
differently is usually not a good idea at all.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarMonk.Liu <monk.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1ab0d211
...@@ -86,7 +86,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size, ...@@ -86,7 +86,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size,
return r; return r;
} }
void amdgpu_job_free(struct amdgpu_job *job) static void amdgpu_job_free_resources(struct amdgpu_job *job)
{ {
struct fence *f; struct fence *f;
unsigned i; unsigned i;
...@@ -100,9 +100,6 @@ void amdgpu_job_free(struct amdgpu_job *job) ...@@ -100,9 +100,6 @@ void amdgpu_job_free(struct amdgpu_job *job)
amdgpu_bo_unref(&job->uf_bo); amdgpu_bo_unref(&job->uf_bo);
amdgpu_sync_free(&job->sync); amdgpu_sync_free(&job->sync);
if (!job->base.use_sched)
kfree(job);
} }
void amdgpu_job_free_func(struct kref *refcount) void amdgpu_job_free_func(struct kref *refcount)
...@@ -111,6 +108,12 @@ void amdgpu_job_free_func(struct kref *refcount) ...@@ -111,6 +108,12 @@ void amdgpu_job_free_func(struct kref *refcount)
kfree(job); kfree(job);
} }
void amdgpu_job_free(struct amdgpu_job *job)
{
amdgpu_job_free_resources(job);
kfree(job);
}
int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring, int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring,
struct amd_sched_entity *entity, void *owner, struct amd_sched_entity *entity, void *owner,
struct fence **f) struct fence **f)
...@@ -187,7 +190,7 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job) ...@@ -187,7 +190,7 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job)
err: err:
job->fence = fence; job->fence = fence;
amdgpu_job_free(job); amdgpu_job_free_resources(job);
return fence; return fence;
} }
......
...@@ -373,7 +373,6 @@ void amd_sched_entity_push_job(struct amd_sched_job *sched_job) ...@@ -373,7 +373,6 @@ void amd_sched_entity_push_job(struct amd_sched_job *sched_job)
{ {
struct amd_sched_entity *entity = sched_job->s_entity; struct amd_sched_entity *entity = sched_job->s_entity;
sched_job->use_sched = 1;
fence_add_callback(&sched_job->s_fence->base, fence_add_callback(&sched_job->s_fence->base,
&sched_job->cb_free_job, amd_sched_free_job); &sched_job->cb_free_job, amd_sched_free_job);
trace_amd_sched_job(sched_job); trace_amd_sched_job(sched_job);
......
...@@ -82,7 +82,6 @@ struct amd_sched_job { ...@@ -82,7 +82,6 @@ struct amd_sched_job {
struct amd_gpu_scheduler *sched; struct amd_gpu_scheduler *sched;
struct amd_sched_entity *s_entity; struct amd_sched_entity *s_entity;
struct amd_sched_fence *s_fence; struct amd_sched_fence *s_fence;
bool use_sched; /* true if the job goes to scheduler */
struct fence_cb cb_free_job; struct fence_cb cb_free_job;
struct work_struct work_free_job; struct work_struct work_free_job;
struct list_head node; struct list_head node;
......
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