From: sashiko-bot@kernel.org
To: "Alex Deucher" <alexander.deucher@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/11] drm/amdgpu/userq/mes: implement set gang submit
Date: Wed, 18 Nov 2026 22:44:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-222122@kernel.org> (raw)
In-Reply-To: <20261118223712.2518580-7-alexander.deucher@amd.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/amdgpu: gang context array index leak in mes_userq_map()
[1]
--
commit d0ceeae2277f6c5db3f1b3901e53f85f8174b593
Author: Alex Deucher <alexander.deucher@amd.com>
drm/amdgpu/userq/mes: implement set gang submit
This commit implements the .set_gang callback in userq_mes_funcs to support
gang submission for MES usermode queues.
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index 7abb9d95ef59a..68c10a8adcd20 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -649,6 +649,36 @@ static int mes_userq_restore(struct amdgpu_usermode_queue *queue)
> return r;
> }
>
> +static int mes_set_gang(struct amdgpu_usermode_queue *primary_queue,
> + struct amdgpu_usermode_queue *secondary_queue)
> +{
> + struct amdgpu_userq_obj *primary_ctx = &primary_queue->fw_obj;
> + struct amdgpu_userq_obj *secondary_ctx = &secondary_queue->fw_obj;
> + struct amdgpu_userq_mgr *uq_mgr = primary_queue->userq_mgr;
> + struct amdgpu_device *adev = uq_mgr->adev;
> + struct mes_set_gang_submit_input input;
> + struct amdgpu_mes *mes = &adev->mes;
> + int r;
> +
> + memset(&input, 0x0, sizeof(struct mes_set_gang_submit_input));
> +
> + input.primary_gang_context_addr = primary_ctx->gpu_addr;
> + input.secondary_gang_context_addr = secondary_ctx->gpu_addr;
> + if (mes->use_rs64mem) {
> + input.primary_gang_context_array_idx =
> + primary_queue->gang_ctx_array_index;
> + input.secondary_gang_context_array_idx =
> + secondary_queue->gang_ctx_array_index;
> + }
[Severity: High]
This problem wasn't introduced by this patch, but does mes_userq_map() leak
queue->gang_ctx_array_index [1] when add_hw_queue() fails?
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c:mes_userq_map() {
...
if (mes->use_rs64mem) {
...
r = amdgpu_mes_alloc_gang_ctx_index(mes, &queue->gang_ctx_array_index);
if (r) {
DRM_ERROR("Failed to allocate userq gang index err:%d\n", r);
return r;
}
queue_input.process_context_array_index = uq_mgr->proc_ctx_array_index;
queue_input.gang_context_array_index = queue->gang_ctx_array_index;
}
amdgpu_mes_lock(&adev->mes);
r = adev->mes.funcs->add_hw_queue(&adev->mes, &queue_input);
amdgpu_mes_unlock(&adev->mes);
if (r) {
DRM_ERROR("Failed to map queue in HW, err (%d)\n", r);
return r;
}
...
}
When add_hw_queue() fails during amdgpu_userq_create(), mes_userq_map()
returns without calling amdgpu_mes_free_gang_ctx_index(), and the caller's
error cleanup does not call mes_userq_unmap(). Repeated mapping failures
can exhaust the gang context bitmap and prevent creating new MES user
queues.
[1] https://sashiko.dev/#/bug/linux-70b9dde6-e881-480d-9c56-534a231e5249
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118223712.2518580-1-alexander.deucher@amd.com?part=7
next prev parent reply other threads:[~2026-11-18 22:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 22:37 [PATCH 01/11] drm/amdgpu/userq: Add INFO IOCTL query for doorbell ranges Alex Deucher
2026-11-18 22:37 ` [PATCH 02/11] drm/amdgpu/mes11: add API for gang submit Alex Deucher
2026-11-18 22:37 ` [PATCH 03/11] drm/amdgpu/mes: add callback " Alex Deucher
2026-11-18 22:37 ` [PATCH 04/11] drm/amdgpu/mes11: add support for setting " Alex Deucher
2026-11-18 22:37 ` [PATCH 05/11] drm/amdgpu/mes12: " Alex Deucher
2026-11-18 22:37 ` [PATCH 06/11] drm/amdgpu/userq: add callback for gang setup Alex Deucher
2026-11-18 22:37 ` [PATCH 07/11] drm/amdgpu/userq/mes: implement set gang submit Alex Deucher
2026-11-18 22:44 ` sashiko-bot [this message]
2026-11-18 22:37 ` [PATCH 08/11] drm/amdgpu/userq: add handling for set_gang Alex Deucher
2026-11-18 22:54 ` sashiko-bot
2026-11-18 22:37 ` [PATCH 09/11] drm/amdgpu: add UAPI to create user queue gangs Alex Deucher
2026-11-18 22:37 ` [PATCH 10/11] drm/amdgpu/userq: enable support for creating gangs Alex Deucher
2026-11-18 22:58 ` sashiko-bot
2026-11-18 22:37 ` [PATCH 11/11] drm/amdgpu: bump driver version for userq updates Alex Deucher
2026-11-18 23:04 ` [PATCH 01/11] drm/amdgpu/userq: Add INFO IOCTL query for doorbell ranges sashiko-bot
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-222122@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexander.deucher@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