mes_v11_0_hw_init() queries the MES context array sizes on every
hardware init, including after a GPU reset or a resume, and
amdgpu_mes_rs64mem_setup_bitmaps() then allocates new, empty process
and gang context slot bitmaps. The old bitmaps leak, and with them the
record of which slots live processes and queues still hold, so the next
allocation can hand out a slot that is in use, and two processes or
queues end up sharing a MES context.
Keep the existing bitmaps when MES is re-initialized. The array sizes
come from the firmware and don't change.
Fixes: 4ae2e536c643 ("drm/amdgpu/mes11: get MES process/gang contex size")
Signed-off-by: Prike Liang <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index 99b803f95c56..b917e6d0cff8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -1076,6 +1076,10 @@ int amdgpu_mes_rs64mem_setup_bitmaps(struct amdgpu_mes
*mes)
if (!mes->use_rs64mem || !mes->ctx_array_size_cpu_ptr)
return 0;
+ /* Keep the slots live processes and queues hold across MES re-init. */
+ if (mes->proc_ctx_bitmap && mes->gang_ctx_bitmap)
+ return 0;
+
/*
* MES FW wrote the sizes to the GPU buffer:
* ctx_array_size_cpu_ptr[0] = proc_ctx_array_size (N)
--
2.34.1