diff options
author | Monk Liu <Monk.Liu@amd.com> | 2016-03-03 14:00:50 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-05-02 22:17:41 +0300 |
commit | e472d2588eef38c2f16f71d6160e58fb5948e84f (patch) | |
tree | a2459eecb00bb9772dca675e87127706f97a3058 /drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | |
parent | 01c02a8b193d63d77e0b45886efa71c9983af446 (diff) | |
download | linux-e472d2588eef38c2f16f71d6160e58fb5948e84f.tar.xz |
drm/amdgpu: delay job free to when it's finished (v2)
for those jobs submitted through scheduler, do not
free it immediately after scheduled, instead free it
in global workqueue by its sched fence signaling
callback function.
v2:
call uf's bo_undef after job_run()
call job's sync free after job_run()
no static inline __amdgpu_job_free() anymore, just use
kfree(job) to replace it.
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler/gpu_scheduler.c')
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index b9d5822bece8..8d49ea2e4134 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -319,6 +319,11 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job) return added; } +static void amd_sched_free_job(struct fence *f, struct fence_cb *cb) { + struct amd_sched_job *job = container_of(cb, struct amd_sched_job, cb_free_job); + schedule_work(&job->work_free_job); +} + /** * Submit a job to the job queue * @@ -330,6 +335,9 @@ void amd_sched_entity_push_job(struct amd_sched_job *sched_job) { struct amd_sched_entity *entity = sched_job->s_entity; + sched_job->use_sched = 1; + fence_add_callback(&sched_job->s_fence->base, + &sched_job->cb_free_job, amd_sched_free_job); trace_amd_sched_job(sched_job); wait_event(entity->sched->job_scheduled, amd_sched_entity_in(sched_job)); |