Skip to contentSkip to conversation

drm/amdgpu: fix ring timeout issue in gfx10 sr-iov environment

PATCH In review Lin.Cao 4 participants 4 messages Jan 14, 2025 – Jan 20, 2025

Subsystems (2)
lore
Share & tools
lore

Lin.Cao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix ring timeout issue in gfx10 sr-iov environment

'commit 6e66dc05b54f ("drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare")' set job->vm as NULL if there is no fence. It will cause emit switch buffer be skippen if job->vm set as NULL.

Check job rather than vm could solve this problem.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
index e0bc37557d2c..2ea98ec60220 100644
@@ -297,7 +297,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
 	amdgpu_ring_patch_cond_exec(ring, cond_exec);
 
 	ring->current_ctx = fence_ctx;
-	if (vm && ring->funcs->emit_switch_buffer)
+	if (job && ring->funcs->emit_switch_buffer)
 		amdgpu_ring_emit_switch_buffer(ring);
 
 	if (ring->funcs->emit_wave_limit &&
Signature · 1 line
2.46.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Lin.Cao <[email protected]>
Sent: Tuesday, January 14, 2025 6:06 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; cao, lin <[email protected]>
Subject: [PATCH] drm/amdgpu: fix ring timeout issue in gfx10 sr-iov environment

'commit 6e66dc05b54f ("drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare")' set job->vm as NULL if there is no fence. It will cause emit switch buffer be skippen if job->vm set as NULL.

Check job rather than vm could solve this problem.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
index e0bc37557d2c..2ea98ec60220 100644
@@ -297,7 +297,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
        amdgpu_ring_patch_cond_exec(ring, cond_exec);
 
        ring->current_ctx = fence_ctx;
-       if (vm && ring->funcs->emit_switch_buffer)
+       if (job && ring->funcs->emit_switch_buffer)
                amdgpu_ring_emit_switch_buffer(ring);
 
        if (ring->funcs->emit_wave_limit &&

--
2.46.1

maintainer
#2 lore raw

Am 17.01.25 um 07:05 schrieb cao, lin:

Quoted 9 lines

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Lin.Cao <[email protected]>
Sent: Tuesday, January 14, 2025 6:06 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; cao, lin <[email protected]>
Subject: [PATCH] drm/amdgpu: fix ring timeout issue in gfx10 sr-iov environment

Quoted 3 lines

'commit 6e66dc05b54f ("drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare")' set job->vm as NULL if there is no fence. It will cause emit switch buffer be skippen if job->vm set as NULL.

Check job rather than vm could solve this problem.

Good catch.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
index e0bc37557d2c..2ea98ec60220 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs, · line 300

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
@@ -297,7 +297,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
         amdgpu_ring_patch_cond_exec(ring, cond_exec);
 
         ring->current_ctx = fence_ctx;
-       if (vm && ring->funcs->emit_switch_buffer)
+       if (job && ring->funcs->emit_switch_buffer)

Maybe better to use "job && job->vmid &&"... here.

You should also remove the vm variable and see if there is anything else using it.

Regards,
Christian.

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -1
                 amdgpu_ring_emit_switch_buffer(ring);
 
         if (ring->funcs->emit_wave_limit &&
--

2.46.1

Reviewed-by on v1 1/1
#3 lore raw
In reply to Lin.Cao
Quoted 8 lines · Lin.Cao

'commit 6e66dc05b54f ("drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare")' set job->vm as NULL if there is no fence. It will cause emit switch buffer be skippen if job->vm set as NULL.

Check job rather than vm could solve this problem.

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -2
index e0bc37557d2c..2ea98ec60220 100644
@@ -297,7 +297,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
        amdgpu_ring_patch_cond_exec(ring, cond_exec);
 
        ring->current_ctx = fence_ctx;
-       if (vm && ring->funcs->emit_switch_buffer)
+       if (job && ring->funcs->emit_switch_buffer)
                amdgpu_ring_emit_switch_buffer(ring);
 
        if (ring->funcs->emit_wave_limit &&
--

2.46.1