drm/amdgpu: free the job immediately after dispatching it
authorChristian König <christian.koenig@amd.com>
Tue, 18 Aug 2015 13:30:26 +0000 (15:30 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 20 Aug 2015 21:05:01 +0000 (17:05 -0400)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c

index 5b1ae18f5e8d953424978eca2d949f1653f9f4fc..06d7bf51db9a07b9971217ffb0a3ab9322a4f005 100644 (file)
@@ -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);