Skip to contentSkip to conversation

drm/amdgpu/scheduler: job ibs should also be freed

PATCH In review Jim Qu 2 participants 3 messages Oct 24, 2017 – Oct 25, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Jim Qu

author
#0 lore raw

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

Change-Id I93bb283cfebfe203f777bb7bae390c9b9a7b5fd0
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +5 -3
index 9cbeade..0bcc737 100644
@@ -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);
 		}
 	}
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw
In reply to a message not in the archive

I don't see why we need this, can you explain more about it ?
the " amdgpu_job_free_resources(job);" should already invoked before the job pushed to scheduler, so after " amd_sched_fence_finished(s_fence);" the IB SABO would be released

BR Monk

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Jim Qu
Sent: 2017年10月24日 19:31
To: [email protected]
Cc: Qu, Jim <[email protected]>
Subject: [PATCH] drm/amdgpu/scheduler: job ibs should also be freed

Change-Id I93bb283cfebfe203f777bb7bae390c9b9a7b5fd0
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +5 -3
index 9cbeade..0bcc737 100644
@@ -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);
 		}
 	}
Signature · 10 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw
In reply to a message not in the archive

Yeah, I saw that code.

There is a issue that will get calltrace in "ib_get" blocked by waiting_fence on RHEL6.9. I make a misunderstand to add amdgpu_job_free_resources(job). Actually, the key point is kthread_park() which is not implemented on RHEL6.9 kernel(2.6.32).

Please ignore this patch.

Thanks
JimQu

________________________________________
发件人: Liu, Monk
发送时间: 2017年10月25日 11:14
收件人: Qu, Jim; [email protected]
抄送: Qu, Jim
主题: RE: [PATCH] drm/amdgpu/scheduler: job ibs should also be freed

I don't see why we need this, can you explain more about it ?
the " amdgpu_job_free_resources(job);" should already invoked before the job pushed to scheduler, so after " amd_sched_fence_finished(s_fence);" the IB SABO would be released

BR Monk

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Jim Qu
Sent: 2017年10月24日 19:31
To: [email protected]
Cc: Qu, Jim <[email protected]>
Subject: [PATCH] drm/amdgpu/scheduler: job ibs should also be freed

Change-Id I93bb283cfebfe203f777bb7bae390c9b9a7b5fd0
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +5 -3
index 9cbeade..0bcc737 100644
@@ -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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx