drm/amdgpu: free the job immediately after dispatching it

Fixes a whole bunch of lockdep warnings.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
This commit is contained in:
Christian König 2015-08-18 15:30:26 +02:00 committed by Alex Deucher
parent 2b184d8dbc
commit bf7ebaeed4
1 changed files with 3 additions and 4 deletions

View File

@ -49,6 +49,9 @@ static struct fence *amdgpu_sched_run_job(struct amd_gpu_scheduler *sched,
goto err; goto err;
fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence); fence = amdgpu_fence_ref(sched_job->ibs[sched_job->num_ibs - 1].fence);
if (sched_job->free_job)
sched_job->free_job(sched_job);
mutex_unlock(&sched_job->job_lock); mutex_unlock(&sched_job->job_lock);
return &fence->base; return &fence->base;
@ -69,10 +72,6 @@ static void amdgpu_sched_process_job(struct amd_gpu_scheduler *sched,
return; return;
} }
sched_job = (struct amdgpu_job *)job; sched_job = (struct amdgpu_job *)job;
mutex_lock(&sched_job->job_lock);
if (sched_job->free_job)
sched_job->free_job(sched_job);
mutex_unlock(&sched_job->job_lock);
/* after processing job, free memory */ /* after processing job, free memory */
fence_put(&sched_job->base.s_fence->base); fence_put(&sched_job->base.s_fence->base);
kfree(sched_job); kfree(sched_job);