From: sashiko-bot@kernel.org
To: "Yongqiang Sun" <Yongqiang.Sun@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: refuse XNACK for a secondary context
Date: Fri, 27 Nov 2026 22:07:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-238320@kernel.org> (raw)
In-Reply-To: <20261127214544.1058794-1-Yongqiang.Sun@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdkfd: missing primary context check in
criu_restore_process()
--
commit 03c779d2c6f68cc91d9f9a720f82e6527cf327df
Author: Yongqiang Sun <Yongqiang.Sun@amd.com>
drm/amdkfd: refuse XNACK for a secondary context
This commit disables XNACK by default for non-primary KFD contexts,
rejects enabling XNACK via AMDKFD_IOC_SET_XNACK_MODE on them, and drops
retry page faults arriving for non-primary contexts in
svm_range_restore_pages().
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 5a7f4f0cd0ce7..1aa2b8480bffc 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -1775,7 +1775,9 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep,
> if (p->xnack_enabled == args->xnack_enabled)
> goto out_unlock;
>
> - if (args->xnack_enabled && !kfd_process_xnack_mode(p, true)) {
> + if (args->xnack_enabled &&
> + (p->context_id != KFD_CONTEXT_ID_PRIMARY ||
> + !kfd_process_xnack_mode(p, true))) {
> r = -EPERM;
> goto out_unlock;
> }
[Severity: Medium]
Should criu_restore_process() also reject enabling XNACK when
p->context_id != KFD_CONTEXT_ID_PRIMARY (or should that check live in
kfd_process_xnack_mode())?
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:criu_restore_process() {
...
if (process_priv.xnack_mode && !kfd_process_xnack_mode(p, true)) {
pr_err("xnack mode cannot be set\n");
ret = -EPERM;
goto exit;
} else {
pr_debug("set xnack mode: %d\n", process_priv.xnack_mode);
p->xnack_enabled = process_priv.xnack_mode;
}
...
}
Invoking AMDKFD_IOC_CRIU_OP (KFD_CRIU_OP_RESTORE) with
process_priv.xnack_mode != 0 on a secondary context still sets
p->xnack_enabled = true. On per-process XNACK GPUs, update_qpd_v9() and
update_qpd_v12_1() then program the secondary context with hardware page-
fault retry enabled while svm_range_restore_pages() rejects its retry
faults with -EFAULT.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127214544.1058794-1-Yongqiang.Sun@amd.com?part=1
next prev parent reply other threads:[~2026-11-27 22:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 21:45 [PATCH] drm/amdkfd: refuse XNACK for a secondary context Yongqiang Sun
2026-11-27 22:07 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-28 1:13 Yongqiang Sun
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-238320@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Yongqiang.Sun@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