Skip to contentSkip to conversation

drm/amdgpu: handle gang submit before VMID

PATCH In review Christian König 4 participants 6 messages Nov 18, 2022 – Nov 21, 2022

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

PATCH 1/1 drm/amdgpu: handle gang submit before VMID

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 -3
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence *amdgpu_job_dependency(struct drm_sched_job *sched_job,
 			DRM_ERROR("Error adding fence (%d)\n", r);
 	}
 
+	if (!fence && job->gang_submit)
+		fence = amdgpu_device_switch_gang(ring->adev, job->gang_submit);
+
 	while (fence == NULL && vm && !job->vmid) {
 		r = amdgpu_vmid_grab(vm, ring, &job->sync,
 				     &job->base.s_fence->finished,
@@ -264,9 +267,6 @@ static struct dma_fence *amdgpu_job_dependency(struct drm_sched_job *sched_job,
 		fence = amdgpu_sync_get_fence(&job->sync);
 	}
 
-	if (!fence && job->gang_submit)
-		fence = amdgpu_device_switch_gang(ring->adev, job->gang_submit);
-
 	return fence;
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Christian König

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")
Quoted 31 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 -4
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                        DRM_ERROR("Error adding fence (%d)\n", r);
        }
 
+       if (!fence && job->gang_submit)
+               fence = amdgpu_device_switch_gang(ring->adev, job->gang_submit);
+
        while (fence == NULL && vm && !job->vmid) {
                r = amdgpu_vmid_grab(vm, ring, &job->sync,
                                     &job->base.s_fence->finished,
@@ -264,9 +267,6 @@ static struct dma_fence *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                fence = amdgpu_sync_get_fence(&job->sync);
        }
 
-       if (!fence && job->gang_submit)
-               fence = amdgpu_device_switch_gang(ring->adev, job->gang_submit);
-
        return fence;
 }
 
--

2.25.1

#2 lore raw
In reply to Christian König

Can you guys please push this into the next 6.1 RC? This solves a significant issue with gang submit.

Quoted 40 lines · Christian König

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")

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

 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                         DRM_ERROR("Error adding fence (%d)\n", r);
         }


+       if (!fence && job->gang_submit)
+               fence = amdgpu_device_switch_gang(ring->adev, job-

Quoted 1 line

gang_submit);

+
        while (fence == NULL && vm && !job->vmid) {
                r = amdgpu_vmid_grab(vm, ring, &job->sync, &job->base.s_fence->finished,

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
@@ -264,9 +267,6 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                 fence = amdgpu_sync_get_fence(&job->sync);
         }


-       if (!fence && job->gang_submit)
-               fence = amdgpu_device_switch_gang(ring->adev, job-

Quoted 1 line

gang_submit);

-
        return fence;
 }

author Applied
#3 lore raw

Pushed to drm-misc-fixes, should be picked up for the next rc.

Let me know if you run into any more problems with that.

Thanks,
Christian.

Am 18.11.22 um 16:36 schrieb Timur Kristóf:

Quoted 44 lines

Can you guys please push this into the next 6.1 RC? This solves a significant issue with gang submit.

Quoted 40 lines · Christian König

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +3 -0
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                         DRM_ERROR("Error adding fence (%d)\n", r);
         }
 
+       if (!fence && job->gang_submit)
+               fence = amdgpu_device_switch_gang(ring->adev, job-
 > gang_submit);
+
         while (fence == NULL && vm && !job->vmid) {

                r = amdgpu_vmid_grab(vm, ring, &job->sync, &job->base.s_fence->finished,

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -3
@@ -264,9 +267,6 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                 fence = amdgpu_sync_get_fence(&job->sync);
         }
 
-       if (!fence && job->gang_submit)
-               fence = amdgpu_device_switch_gang(ring->adev, job-
 > gang_submit);
-
         return fence;

 }

#4 lore raw

The patch did not make it into rc6 after all.
Can you please make sure it goes into rc7?

Thanks,
Timur

Quoted 57 lines · Christian König

Pushed to drm-misc-fixes, should be picked up for the next rc.

Let me know if you run into any more problems with that.

Thanks,
Christian.

Am 18.11.22 um 16:36 schrieb Timur Kristóf:

Quoted 48 lines

Can you guys please push this into the next 6.1 RC? This solves a significant issue with gang submit.

Quoted 44 lines · Christian König

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")

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

  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                          DRM_ERROR("Error adding fence (%d)\n",
 r);
          }


+       if (!fence && job->gang_submit)
+               fence = amdgpu_device_switch_gang(ring->adev, job-

Quoted 1 line

gang_submit);

+
         while (fence == NULL && vm && !job->vmid) { r = amdgpu_vmid_grab(vm, ring, &job->sync, &job->base.s_fence-

Quoted 1 line

finished,

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -0
@@ -264,9 +267,6 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                  fence = amdgpu_sync_get_fence(&job->sync);
          }


-       if (!fence && job->gang_submit)
-               fence = amdgpu_device_switch_gang(ring->adev, job-

Quoted 1 line

gang_submit);

-
         return fence;
  }

#5 lore raw

[AMD Official Use Only - General]

Yes, it has already landed in drm-misc-fixes:
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-fixes&id=b09d6acba1d9a23963fedf96b4191502a4fec25d

Alex
________________________________
From: Timur Kristóf <[email protected]>
Sent: Monday, November 21, 2022 11:36 AM
To: Christian König <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: handle gang submit before VMID

The patch did not make it into rc6 after all.
Can you please make sure it goes into rc7?

Thanks,
Timur

Quoted 57 lines · Christian König

Pushed to drm-misc-fixes, should be picked up for the next rc.

Let me know if you run into any more problems with that.

Thanks,
Christian.

Am 18.11.22 um 16:36 schrieb Timur Kristóf:

Quoted 48 lines

Can you guys please push this into the next 6.1 RC? This solves a significant issue with gang submit.

Quoted 44 lines · Christian König

Otherwise it can happen that not all gang members can get a VMID assigned and we deadlock.

Fixes 68ce8b242242 ("drm/amdgpu: add gang submit backend v2")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +2 -0
index cd968e781077..abb99cff8b4b 100644
@@ -254,6 +254,9 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                         DRM_ERROR("Error adding fence (%d)\n",
 r);
         }
 
+       if (!fence && job->gang_submit)
+               fence = amdgpu_device_switch_gang(ring->adev,

job-

Quoted 1 line

gang_submit);

+

         while (fence == NULL && vm && !job->vmid) {
                 r = amdgpu_vmid_grab(vm, ring, &job->sync,
                                      &job->base.s_fence-
Quoted 1 line

finished,

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +0 -2
@@ -264,9 +267,6 @@ static struct dma_fence
 *amdgpu_job_dependency(struct drm_sched_job *sched_job,
                 fence = amdgpu_sync_get_fence(&job->sync);
         }
 
-       if (!fence && job->gang_submit)
-               fence = amdgpu_device_switch_gang(ring->adev,

job-

Quoted 1 line

gang_submit);

-

         return fence;

}