From: Christian König Date: Tue, 18 Aug 2015 13:30:26 +0000 (+0200) Subject: drm/amdgpu: free the job immediately after dispatching it X-Git-Tag: v5.15~15142^2~14^2~35 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=bf7ebaeed4dca7c0a7f9d9a44efbd9f74cf22c5d;p=mirror_ubuntu-kernels.git drm/amdgpu: free the job immediately after dispatching it Fixes a whole bunch of lockdep warnings. Signed-off-by: Christian König Reviewed-by: Chunming Zhou --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index 5b1ae18f5e8d..06d7bf51db9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c @@ -49,6 +49,9 @@ static struct fence *amdgpu_sched_run_job(struct amd_gpu_scheduler *sched, goto err; 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); return &fence->base; @@ -69,10 +72,6 @@ static void amdgpu_sched_process_job(struct amd_gpu_scheduler *sched, return; } 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 */ fence_put(&sched_job->base.s_fence->base); kfree(sched_job);