* [PATCH] drm/amdkfd: Add checkpoint handler for mqd 12.1
@ 2026-11-25 14:15 David Francis
2026-11-25 14:33 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: David Francis @ 2026-11-25 14:15 UTC (permalink / raw)
To: amd-gfx; +Cc: David Francis, Harish Kasiviswanathan
For CRIU checkpoint, we need a checkpoint function in the
mqd manager.
Add one for gfx 12.1; no different from the ones for any other
mqd manager
Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
index e34103067fa0..305d1d3a0e01 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
@@ -671,6 +671,15 @@ static int debugfs_show_mqd_sdma(struct seq_file *m, void *data)
#endif
+static void checkpoint_mqd_v12_1(struct mqd_manager *mm, void *mqd, void *mqd_dst, void *ctl_stack_dst)
+{
+ struct v12_1_compute_mqd *m;
+
+ m = get_mqd(mqd);
+
+ memcpy(mqd_dst, m, sizeof(struct v12_1_compute_mqd));
+}
+
static void restore_mqd_v12_1(struct mqd_manager *mm, void **mqd,
struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
struct queue_properties *qp, const void *mqd_src,
@@ -766,6 +775,7 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type,
mqd->mqd_size = sizeof(struct v12_1_compute_mqd);
mqd->get_wave_state = get_wave_state_v12_1;
mqd->mqd_stride = kfd_mqd_stride;
+ mqd->checkpoint_mqd = checkpoint_mqd_v12_1;
mqd->restore_mqd = restore_mqd_v12_1;
#if defined(CONFIG_DEBUG_FS)
mqd->debugfs_show_mqd = debugfs_show_mqd;
@@ -813,6 +823,7 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type,
mqd->is_occupied = kfd_is_occupied_sdma;
mqd->mqd_size = sizeof(struct v12_1_sdma_mqd);
mqd->mqd_stride = kfd_mqd_stride;
+ mqd->checkpoint_mqd = checkpoint_mqd_v12_1;
mqd->restore_mqd = restore_mqd_sdma_v12_1;
#if defined(CONFIG_DEBUG_FS)
mqd->debugfs_show_mqd = debugfs_show_mqd_sdma;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdkfd: Add checkpoint handler for mqd 12.1
2026-11-25 14:15 [PATCH] drm/amdkfd: Add checkpoint handler for mqd 12.1 David Francis
@ 2026-11-25 14:33 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-25 14:33 UTC (permalink / raw)
To: David Francis, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/amdkfd: heap buffer overflow in checkpoint_mqd_v12_1() on
SDMA queues
- [Medium] drm/amdkfd: missing multi-XCC iteration in
checkpoint_mqd_v12_1()
--
commit b939ab2a38bf0604406a6b6f7f0e390220c671fb
Author: David Francis <David.Francis@amd.com>
drm/amdkfd: Add checkpoint handler for mqd 12.1
This commit adds a CRIU checkpoint callback for GFX 12.1 and wires it to
compute and SDMA MQD managers in mqd_manager_init_v12_1().
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> index 0c116fc8bb532..1a3b3c7103c1f 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> @@ -671,6 +671,15 @@ static int debugfs_show_mqd_sdma(struct seq_file *m, void *data)
>
> #endif
>
> +static void checkpoint_mqd_v12_1(struct mqd_manager *mm, void *mqd, void *mqd_dst, void *ctl_stack_dst)
> +{
> + struct v12_1_compute_mqd *m;
> +
> + m = get_mqd(mqd);
> +
> + memcpy(mqd_dst, m, sizeof(struct v12_1_compute_mqd));
> +}
[Severity: Medium]
Does checkpoint_mqd_v12_1() need to iterate over NUM_XCC(mm->dev->xcc_mask)
at m->cp_mqd_stride_size stride, like checkpoint_mqd_v9_4_3()?
get_queue_checkpoint_info() sizes the checkpoint buffer for
mqd_mgr->mqd_size * NUM_XCC(mqd_mgr->dev->xcc_mask) bytes, and
criu_checkpoint_queues_device() expects mqd[xcc0], mqd[xcc1], ... in
mqd_dst. Copying only a single struct v12_1_compute_mqd leaves the
remaining XCC slots zeroed when checkpointing a compute queue on a
multi-XCC GFX 12.1 partition.
[ ... ]
> @@ -813,6 +823,7 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type,
> mqd->is_occupied = kfd_is_occupied_sdma;
> mqd->mqd_size = sizeof(struct v12_1_sdma_mqd);
> mqd->mqd_stride = kfd_mqd_stride;
> + mqd->checkpoint_mqd = checkpoint_mqd_v12_1;
> mqd->restore_mqd = restore_mqd_sdma_v12_1;
> #if defined(CONFIG_DEBUG_FS)
> mqd->debugfs_show_mqd = debugfs_show_mqd_sdma;
[Severity: High]
Can wiring checkpoint_mqd_v12_1() to KFD_MQD_TYPE_SDMA overflow the
q_private_data heap buffer in criu_checkpoint_queues_device()?
For SDMA queues, mqd->mqd_size is sizeof(struct v12_1_sdma_mqd) (512
bytes), so criu_checkpoint_queues_device() allocates 512 * NUM_XCC bytes
for mqd_dst, whereas checkpoint_mqd_v12_1() copies
sizeof(struct v12_1_compute_mqd) (4096 bytes). Should KFD_MQD_TYPE_SDMA
use a dedicated checkpoint_mqd_sdma_v12_1() callback that copies
sizeof(struct v12_1_sdma_mqd) via get_sdma_mqd(), matching
restore_mqd_sdma_v12_1()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125141554.2195270-1-David.Francis@amd.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 14:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 14:15 [PATCH] drm/amdkfd: Add checkpoint handler for mqd 12.1 David Francis
2026-11-25 14:33 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox