drm/amdgpu/mes: refine for maximum packet execution
Subsystems (2)
PATCH 1/1 drm/amdgpu/mes: refine for maximum packet execution
Only allow API_NUMBER_OF_COMMAND_MAX packet in mes ring buffer, refine the code for maximum packet execution.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
@@ -212,6 +212,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,*/ if (ring->funcs->type ==AMDGPU_RING_TYPE_KIQ ) sched_hw_submission =max (sched_hw_submission,256 ); +else if (ring->funcs->type ==AMDGPU_RING_TYPE_MES ) + sched_hw_submission =32 ;else if (ring == &adev->sdma.instance[0 ].page) sched_hw_submission =256 ;
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1 -1
@@ -198,7 +198,7 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r <1 ) goto error_undo;
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -1
@@ -184,7 +184,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r <1 ) goto error_undo;
Signature · 1 line
2.41.0
Am 23.07.24 um 10:27 schrieb Jack Xiao:
Quoted 15 lines
Only allow
API_NUMBER_OF_COMMAND_MAXpacket in mes ring buffer, refine the code for maximum packet execution.Signed-off-by Jack Xiao <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, · line 216
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-0@@ -212,6 +212,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,*/ if (ring->funcs->type ==AMDGPU_RING_TYPE_KIQ ) sched_hw_submission =max (sched_hw_submission,256 ); +else if (ring->funcs->type ==AMDGPU_RING_TYPE_MES ) + sched_hw_submission =32 ;
Yeah that looks like it makes sense.
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, · line 201
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0else if (ring == &adev->sdma.instance[0 ].page) sched_hw_submission =256 ;drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-1@@ -198,7 +198,7 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r = amdgpu_fence_wait_polling(ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX/2 - 1),
This looks a bit questionable. amdgpu_fence_wait_polling() doesn't apply the fence mask to the polled value.
So what happens if that overruns?
Additional to that we should really keep that logic in amdgpu_fence_emit_polling() and not each individual MES generation.
Regards,
Christian.
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +0
-0timeout);if (r <1 ) goto error_undo;drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-1@@ -184,7 +184,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r <1 ) goto error_undo;
Deucher, Alexander
maintainer[Public]
Quoted 8 lines
-----Original Message-----
From: Xiao, Jack <[email protected]>
Sent: Tuesday, July 23, 2024 4:28 AM
To: [email protected]; Deucher, Alexander <[email protected]>; [email protected]
Cc: Xiao, Jack <[email protected]>
Subject: [PATCH] drm/amdgpu/mes: refine for maximum packet execution
Quoted 4 lines
Only allow
API_NUMBER_OF_COMMAND_MAXpacket in mes ring buffer, refine the code for maximum packet execution.Signed-off-by Jack Xiao <[email protected]>
Any updates on this patch?
Alex
Quoted 55 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-0@@ -212,6 +212,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev,struct amdgpu_ring *ring, */ if (ring->funcs->type ==AMDGPU_RING_TYPE_KIQ ) sched_hw_submission =max (sched_hw_submission,256 ); +else if (ring->funcs->type ==AMDGPU_RING_TYPE_MES ) + sched_hw_submission =32 ;else if (ring == &adev->sdma.instance[0 ].page) sched_hw_submission =256 ;drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-1@@ -198,7 +198,7 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r < 1) goto error_undo;drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-1@@ -184,7 +184,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r < 1) goto error_undo;--
2.41.0
[Public]
The maximum sched_hw_submission value will be set to 8. The value will result that the maximum number of packet execution which is not greater than firmware allowed.
Regards,
Jack
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Tuesday, August 6, 2024 10:34 PM
To: Xiao, Jack <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH] drm/amdgpu/mes: refine for maximum packet execution
[Public]
Quoted 8 lines
-----Original Message-----
From: Xiao, Jack <[email protected]>
Sent: Tuesday, July 23, 2024 4:28 AM
To: [email protected]; Deucher, Alexander <[email protected]>; [email protected]
Cc: Xiao, Jack <[email protected]>
Subject: [PATCH] drm/amdgpu/mes: refine for maximum packet execution
Quoted 4 lines
Only allow
API_NUMBER_OF_COMMAND_MAXpacket in mes ring buffer, refine the code for maximum packet execution.Signed-off-by Jack Xiao <[email protected]>
Any updates on this patch?
Alex
Quoted 55 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2
-0@@ -212,6 +212,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev,struct amdgpu_ring *ring, */ if (ring->funcs->type ==AMDGPU_RING_TYPE_KIQ ) sched_hw_submission =max (sched_hw_submission,256 ); +else if (ring->funcs->type ==AMDGPU_RING_TYPE_MES ) + sched_hw_submission =32 ;else if (ring == &adev->sdma.instance[0 ].page) sched_hw_submission =256 ;drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-1@@ -198,7 +198,7 @@ static int mes_v11_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r < 1) goto error_undo;drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-1@@ -184,7 +184,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, seq = ++ring->fence_drv.sync_seq; r =amdgpu_fence_wait_polling (ring, - seq - ring->fence_drv.num_fences_mask, + seq - (API_NUMBER_OF_COMMAND_MAX /2 -1 ), timeout);if (r < 1) goto error_undo;--
2.41.0