Skip to contentSkip to conversation

drm/amdgpu: always initialize job->base.sched

PATCH In review Christian König 3 participants 4 messages Jul 17, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: always initialize job->base.sched

Otherwise we can't clean up the job if we run into an error before it is pushed to the scheduler.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -0
index 024efb7ea6d6..42a4764d728e 100644
@@ -54,6 +54,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 	if (!*job)
 		return -ENOMEM;
 
+	/*
+	 * Initialize the scheduler to at least some ring so that we always
+	 * have a pointer to adev.
+	 */
+	(*job)->base.sched = &adev->rings[0]->sched;
 	(*job)->vm = vm;
 	(*job)->ibs = (void *)&(*job)[1];
 	(*job)->num_ibs = num_ibs;
Signature · 6 lines
2.14.1

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

A message that is not in the archive (sent off-list or not yet received): 20180717070504.2470-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

Acked-by Chunming Zhou
#2 lore raw

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Tuesday, July 17, 2018 3:05 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: always initialize job->base.sched

Otherwise we can't clean up the job if we run into an error before it is pushed to the scheduler.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -0
index 024efb7ea6d6..42a4764d728e 100644
@@ -54,6 +54,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 	if (!*job)
 		return -ENOMEM;
 
+	/*
+	 * Initialize the scheduler to at least some ring so that we always
+	 * have a pointer to adev.
+	 */
+	(*job)->base.sched = &adev->rings[0]->sched;
 	(*job)->vm = vm;
 	(*job)->ibs = (void *)&(*job)[1];
 	(*job)->num_ibs = num_ibs;

--
2.14.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

A message that is not in the archive (sent off-list or not yet received): BY1PR12MB050253AA5BB29EAAF8AB0D00B45C0-PicGAnIBOobrCwm+z9iKNgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw

Am 17.07.2018 um 09:16 schrieb Zhou, David(ChunMing):

Quoted 1 line

Yeah, I didn't thought about the possibility that we need to free the job before it is submitted (in other words before the scheduler is determined).

Alternatively we could provide the adev manually to amdgpu_job_free() and amdgpu_job_free_resources().

Regards,
Christian.

Quoted 34 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Tuesday, July 17, 2018 3:05 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: always initialize job->base.sched

Otherwise we can't clean up the job if we run into an error before it is pushed to the scheduler.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -1
index 024efb7ea6d6..42a4764d728e 100644
@@ -54,6 +54,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
  	if (!*job)
  		return -ENOMEM;
 
+	/*
+	 * Initialize the scheduler to at least some ring so that we always
+	 * have a pointer to adev.
+	 */
+	(*job)->base.sched = &adev->rings[0]->sched;
  	(*job)->vm = vm;
  	(*job)->ibs = (void *)&(*job)[1];
  	(*job)->num_ibs = num_ibs;
--

2.14.1

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): ed7daa0e-8a81-1059-6460-812a9d49c486-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#6 lore raw
Quoted 6 lines · Christian König

Am 17.07.2018 um 09:16 schrieb Zhou, David(ChunMing):

Quoted 1 line

Yeah, I didn't thought about the possibility that we need to free the job before it is submitted (in other words before the scheduler is determined).

Alternatively we could provide the adev manually to amdgpu_job_free() and amdgpu_job_free_resources().

not a big deal, you can still go ahead with this patch.

David

Quoted 38 lines

Regards,
Christian.

Quoted 34 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Tuesday, July 17, 2018 3:05 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: always initialize job->base.sched

Otherwise we can't clean up the job if we run into an error before it is pushed to the scheduler.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index 024efb7ea6d6..42a4764d728e 100644
@@ -54,6 +54,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, 
 unsigned num_ibs,
       if (!*job)
           return -ENOMEM;

  +    /*
+     * Initialize the scheduler to at least some ring so that we always +     * have a pointer to adev.
+     */
+    (*job)->base.sched = &adev->rings[0]->sched;
      (*job)->vm = vm;
      (*job)->ibs = (void *)&(*job)[1];
      (*job)->num_ibs = num_ibs;

Signature · 1 line
2.14.1
Quoted 5 lines
Quoted 4 lines

_______________________________________________
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