From: sashiko-bot@kernel.org
To: "David Francis" <David.Francis@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: Add checkpoint handler for mqd 12.1
Date: Wed, 25 Nov 2026 14:33:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-233568@kernel.org> (raw)
In-Reply-To: <20261125141554.2195270-1-David.Francis@amd.com>
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
prev parent reply other threads:[~2026-11-25 14:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-233568@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=David.Francis@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox