diff options
author | Christian König <christian.koenig@amd.com> | 2016-05-19 03:54:15 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-07 14:50:54 -0400 |
commit | c5f74f7802775b9ccdb0a4fd90e0c7d0b03da9fa (patch) | |
tree | 3db2ce910290e8005a5d562c2a107d32f9c0f363 /drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | |
parent | f42d20a94284149bc6815a66ddb0b449f9f2fe74 (diff) |
drm/amdgpu: fix and cleanup job destruction
Remove the job reference counting and just properly destroy it from a
work item which blocks on any potential running timeout handler.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk.Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_job.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 32132f2e236d..34cd971a9afa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | |||
@@ -28,12 +28,6 @@ | |||
28 | #include "amdgpu.h" | 28 | #include "amdgpu.h" |
29 | #include "amdgpu_trace.h" | 29 | #include "amdgpu_trace.h" |
30 | 30 | ||
31 | static void amdgpu_job_free_handler(struct work_struct *ws) | ||
32 | { | ||
33 | struct amdgpu_job *job = container_of(ws, struct amdgpu_job, base.work_free_job); | ||
34 | amd_sched_job_put(&job->base); | ||
35 | } | ||
36 | |||
37 | static void amdgpu_job_timedout(struct amd_sched_job *s_job) | 31 | static void amdgpu_job_timedout(struct amd_sched_job *s_job) |
38 | { | 32 | { |
39 | struct amdgpu_job *job = container_of(s_job, struct amdgpu_job, base); | 33 | struct amdgpu_job *job = container_of(s_job, struct amdgpu_job, base); |
@@ -42,8 +36,6 @@ static void amdgpu_job_timedout(struct amd_sched_job *s_job) | |||
42 | job->base.sched->name, | 36 | job->base.sched->name, |
43 | atomic_read(&job->ring->fence_drv.last_seq), | 37 | atomic_read(&job->ring->fence_drv.last_seq), |
44 | job->ring->fence_drv.sync_seq); | 38 | job->ring->fence_drv.sync_seq); |
45 | |||
46 | amd_sched_job_put(&job->base); | ||
47 | } | 39 | } |
48 | 40 | ||
49 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, | 41 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, |
@@ -64,7 +56,6 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, | |||
64 | (*job)->vm = vm; | 56 | (*job)->vm = vm; |
65 | (*job)->ibs = (void *)&(*job)[1]; | 57 | (*job)->ibs = (void *)&(*job)[1]; |
66 | (*job)->num_ibs = num_ibs; | 58 | (*job)->num_ibs = num_ibs; |
67 | INIT_WORK(&(*job)->base.work_free_job, amdgpu_job_free_handler); | ||
68 | 59 | ||
69 | amdgpu_sync_create(&(*job)->sync); | 60 | amdgpu_sync_create(&(*job)->sync); |
70 | 61 | ||
@@ -103,9 +94,10 @@ static void amdgpu_job_free_resources(struct amdgpu_job *job) | |||
103 | amdgpu_sync_free(&job->sync); | 94 | amdgpu_sync_free(&job->sync); |
104 | } | 95 | } |
105 | 96 | ||
106 | void amdgpu_job_free_func(struct kref *refcount) | 97 | void amdgpu_job_free_cb(struct amd_sched_job *s_job) |
107 | { | 98 | { |
108 | struct amdgpu_job *job = container_of(refcount, struct amdgpu_job, base.refcount); | 99 | struct amdgpu_job *job = container_of(s_job, struct amdgpu_job, base); |
100 | |||
109 | kfree(job); | 101 | kfree(job); |
110 | } | 102 | } |
111 | 103 | ||
@@ -126,8 +118,7 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring, | |||
126 | if (!f) | 118 | if (!f) |
127 | return -EINVAL; | 119 | return -EINVAL; |
128 | 120 | ||
129 | r = amd_sched_job_init(&job->base, &ring->sched, | 121 | r = amd_sched_job_init(&job->base, &ring->sched, entity, owner, &fence); |
130 | entity, amdgpu_job_free_func, owner, &fence); | ||
131 | if (r) | 122 | if (r) |
132 | return r; | 123 | return r; |
133 | 124 | ||
@@ -198,4 +189,5 @@ const struct amd_sched_backend_ops amdgpu_sched_ops = { | |||
198 | .dependency = amdgpu_job_dependency, | 189 | .dependency = amdgpu_job_dependency, |
199 | .run_job = amdgpu_job_run, | 190 | .run_job = amdgpu_job_run, |
200 | .timedout_job = amdgpu_job_timedout, | 191 | .timedout_job = amdgpu_job_timedout, |
192 | .free_job = amdgpu_job_free_cb | ||
201 | }; | 193 | }; |