Nice catch

Patch is
Reviewed-by: David Francis <[email protected]>

________________________________________
From: amd-gfx <[email protected]> on behalf of Yongqiang 
Sun <[email protected]>
Sent: Thursday, June 25, 2026 2:51 PM
To: [email protected]
Cc: Sun, Yongqiang
Subject: [PATCH] drm/amdkfd: use node XCC count for v9 CRIU control stack 
restore

set_queue_properties_from_criu() divided the checkpointed control stack
size by NUM_XCC(adev->gfx.xcc_mask) (whole GPU), while the checkpoint
size was recorded, the MQD buffer allocated, and the control stack
restored using the per-node mask NUM_XCC(mm->dev->xcc_mask). On spatially
partitioned GFX9.4.3 (CPX/QPX) these differ, so the per-XCC control stack
size used for the restore memcpy could exceed the region sized for the
MQD allocation, writing past the BO into adjacent kernel memory; it also
broke legitimate restore on partitioned parts. Divide by the per-node XCC
count so allocation and copy agree, leaving kfd_queue_acquire_buffers()
to bound the size against the node's advertised control stack size.

Signed-off-by: Yongqiang Sun <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 071f956f183c..0a7276eadf79 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -1040,7 +1040,7 @@ int kfd_criu_restore_queue(struct kfd_process *p,
        ctl_stack = mqd + q_data->mqd_size;

        memset(&qp, 0, sizeof(qp));
-       set_queue_properties_from_criu(&qp, q_data, 
NUM_XCC(pdd->dev->adev->gfx.xcc_mask));
+       set_queue_properties_from_criu(&qp, q_data, 
NUM_XCC(pdd->dev->xcc_mask));

        ret = kfd_queue_acquire_buffers(pdd, &qp);
        if (ret) {
--
2.43.0

Reply via email to