Skip to contentSkip to conversation

drm/amdgpu/mes: Fix hung_queue_db_array loop limit for multi-XCC

PATCH In review Geoffrey McRae 2 participants 2 messages Jun 28 – Jun 29

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

PATCH 1/1 drm/amdgpu/mes: Fix hung_queue_db_array loop limit for multi-XCC

The loop iterated only AMDGPU_MAX_MES_PIPES times, leaving entries uninitialized for multi-XCC GPUs. This causes null pointer dereferences when accessing arrays indexed by XCC ID >= 2. Extend the loop to cover all XCCs (AMDGPU_MAX_MES_PIPES * num_xcc), matching other per-XCC arrays.

Fixes 723b3bc87afb ("drm/amdgpu: Fixup boost mes detect hang array size")
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Amber Lin <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -1
index 6c0dde3786e3..6ec4f1d537d2 100644
@@ -237,7 +237,7 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
 	}
 
 	if (adev->mes.hung_queue_db_array_size) {
-		for (i = 0; i < AMDGPU_MAX_MES_PIPES; i++) {
+		for (i = 0; i < AMDGPU_MAX_MES_PIPES * num_xcc; i++) {
 			r = amdgpu_bo_create_kernel(adev,
 						    adev->mes.hung_queue_db_array_size * sizeof(u32),
 						    PAGE_SIZE,
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Geoffrey McRae

The loop iterated only AMDGPU_MAX_MES_PIPES times, leaving entries uninitialized for multi-XCC GPUs. This causes null pointer dereferences when accessing arrays indexed by XCC ID >= 2. Extend the loop to cover all XCCs (AMDGPU_MAX_MES_PIPES * num_xcc), matching other per-XCC arrays.

Fixes 723b3bc87afb ("drm/amdgpu: Fixup boost mes detect hang array size")
Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc Amber Lin <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +1 -1
index 6c0dde3786e3..6ec4f1d537d2 100644
@@ -237,7 +237,7 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
  	}
 
  	if (adev->mes.hung_queue_db_array_size) {
-		for (i = 0; i < AMDGPU_MAX_MES_PIPES; i++) {
+		for (i = 0; i < AMDGPU_MAX_MES_PIPES * num_xcc; i++) {
  			r = amdgpu_bo_create_kernel(adev,
  						    adev->mes.hung_queue_db_array_size * sizeof(u32),
  						    PAGE_SIZE,