[PATCH] drm/amdgpu/scheduler: job ibs should also be freed

Jim Qu Jim.Qu at amd.com
Tue Oct 24 11:31:17 UTC 2017


Change-Id: I93bb283cfebfe203f777bb7bae390c9b9a7b5fd0
Signed-off-by: Jim Qu <Jim.Qu at amd.com>
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 9cbeade..0bcc737 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -222,18 +222,20 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
 					amd_sched_entity_is_idle(entity));
 	amd_sched_entity_set_rq(entity, NULL);
 	if (r) {
-		struct amd_sched_job *job;
+		struct amd_sched_job *s_job;
 
 		/* Park the kernel for a moment to make sure it isn't processing
 		 * our enity.
 		 */
 		kthread_park(sched->thread);
 		kthread_unpark(sched->thread);
-		while ((job = to_amd_sched_job(spsc_queue_pop(&entity->job_queue)))) {
-			struct amd_sched_fence *s_fence = job->s_fence;
+		while ((s_job = to_amd_sched_job(spsc_queue_pop(&entity->job_queue)))) {
+			struct amd_sched_fence *s_fence = s_job->s_fence;
+			struct amdgpu_job *job = to_amdgpu_job(s_job);
 
 			amd_sched_fence_scheduled(s_fence);
 			dma_fence_set_error(&s_fence->finished, -ESRCH);
+			amdgpu_job_free_resources(job);
 			amd_sched_fence_finished(s_fence);
 		}
 	}
-- 
1.9.1



More information about the amd-gfx mailing list