From: "Christian König" <christian.koenig@amd.com>
To: "Zhang, Jesse(Jie)" <Jesse.Zhang@amd.com>,
Alex Deucher <alexdeucher@gmail.com>
Cc: "amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>
Subject: Re: [PATCH v4 10/10] drm/amdgpu/userq_fence: NOTIFY MES on SDMA UMQ submit
Date: Wed, 6 May 2026 09:21:48 +0200 [thread overview]
Message-ID: <d997108b-47e1-4769-b450-61ba6ce0a960@amd.com> (raw)
In-Reply-To: <DM4PR12MB5152E6B971F2830E7141089CE33F2@DM4PR12MB5152.namprd12.prod.outlook.com>
On 5/6/26 08:08, Zhang, Jesse(Jie) wrote:
> AMD General
>
>> -----Original Message-----
>> From: Koenig, Christian <Christian.Koenig@amd.com>
>> Sent: Monday, May 4, 2026 5:01 PM
>> To: Alex Deucher <alexdeucher@gmail.com>; Zhang, Jesse(Jie)
>> <Jesse.Zhang@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander
>> <Alexander.Deucher@amd.com>
>> Subject: Re: [PATCH v4 10/10] drm/amdgpu/userq_fence: NOTIFY MES on SDMA
>> UMQ submit
>>
>> On 5/1/26 15:30, Alex Deucher wrote:
>>> On Thu, Apr 30, 2026 at 12:29 PM Jesse Zhang <Jesse.Zhang@amd.com>
>> wrote:
>>>>
>>>> From: "Jesse.zhang" <Jesse.zhang@amd.com>
>>>>
>>>> Pair the userspace aggregated-doorbell ring (added by the
>>>> AMDGPU_INFO_DOORBELL /
>> AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL ABI in
>>>> the previous patches) with a kernel-side
>>>> MES_MISC_OP_NOTIFY_WORK_ON_UNMAPPED_QUEUE in
>>>> amdgpu_userq_signal_ioctl for SDMA UMQs.
>>>>
>>>> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
>>>
>>> How will this work if the user doesn't use this IOCTL? protected
>>> fences are optional. An application can create a user queue and never
>>> use a protected fence. Why don't KFD SDMA queues need this special
>>> treatment?
>>
>> Yeah agree that whole approach doesn't work.
>>
>> What we could do is similar to the MM queues that userspace need to signal both a
>> per queue doorbell and an aggregated one for the queue type.
>>
>> Regards,
>> Christian.
> Hi Christian, Alex,
>
> Agreed, and will drop this patch.
>
> The MM-style userspace ABI is already in place: David's agdb_bo
> (AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL + GEM_OP_OPEN_GLOBAL) plus patch 9
> (AMDGPU_INFO_DOORBELL reports the SDMA agdb slot). IGT rings per-queue +
> aggregated on every submit.
>
> The remaining gap: on MES12 , a bare agg_db ring does NOT wake an
> unmapped SDMA UMQ — MES needs hasReadyQueues set, which today only
> NOTIFY_WORK_ON_UNMAPPED_QUEUE flips. This is by design, not Linux-only.
> The Windows UMQ path also uses the same
> contract — MES writes 1 to *unmap_flag_addr on preempt; UMD checks the
> flag and calls NOTIFY before ringing doorbells on the next submit.
>
> Next version v5 (matches Windows):
>
> - Drop patch 10.
> - Keep David's ABI + INFO_DOORBELL.
> - Add a small standalone NOTIFY ioctl (e.g. AMDGPU_USERQ_OP_NOTIFY_WORK)
Completely NAK to that approach. This not only results in problems with GFX userqueues but also completely breaks ROCm.
It looks like we need to go back to the drawing board with the FW team and avoid such workarounds.
Regards,
Christian.
> so UMQ apps call it on demand.
>
> Is it the right direction?
>
> Attached test results (current v4, with the to-be-dropped signal_ioctl NOTIFY):
>
> HW / fw : gfx12
> Test : IGT amd_userq_sdma stress, 100 iters
> Result : 100/100 PASS
>
> So the agg_db + NOTIFY mechanism works on hardware.
>
> Thanks,
> Jesse
>>
>>>
>>> Alex
>>>
>>>> ---
>>>> .../gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 29
>> +++++++++++++++++++
>>>> 1 file changed, 29 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
>>>> index a58342c2ac44..50e275b51c9e 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
>>>> @@ -598,6 +598,35 @@ int amdgpu_userq_signal_ioctl(struct drm_device
>> *dev, void *data,
>>>> /* drop the reference acquired in fence creation function */
>>>> dma_fence_put(fence);
>>>>
>>>> + /*
>>>> + * SDMA UMQ wake: SDMA has no CP_UNMAPPED_DOORBELL HW
>> intercept, so
>>>> + * once MES gangs the queue out (after the first IB's
>> PROTECTED_FENCE
>>>> + * idles the queue), per-queue doorbell rings hit a mapped-out HW
>>>> + * slot and are silently dropped — FENCE IRQ never fires.
>>>> + *
>>>> + * Userspace rings the priority's MES aggregated doorbell directly
>>>> + * via the agdb_bo mmap (see AMDGPU_INFO_DOORBELL +
>>>> + * AMDGPU_GEM_GLOBAL_AGGREGATED_DOORBELL). That alone,
>> however, is
>>>> + * not enough on current MES12 firmware — MES will not scan the
>>>> + * priority's queue list unless its hasReadyQueues flag is set.
>>>> + * NOTIFY_WORK_ON_UNMAPPED_QUEUE flips that flag, so MES
>> then
>>>> + * processes the doorbell ring and re-MAP_QUEUEs the SDMA UMQ.
>>>> + *
>>>> + * This is a kernel-side companion to the userspace agg doorbell
>>>> + * ring; remove once firmware learns to wake on bare aggregated
>>>> + * doorbell.
>>>> + */
>>>> + if (queue && queue->queue_type == AMDGPU_HW_IP_DMA &&
>>>> + adev->enable_mes && adev->mes.funcs->misc_op) {
>>>> + struct mes_misc_op_input op = { 0 };
>>>> +
>>>> + op.op =
>> MES_MISC_OP_NOTIFY_WORK_ON_UNMAPPED_QUEUE;
>>>> + op.notify_work.priority_level =
>> AMDGPU_MES_PRIORITY_LEVEL_NORMAL;
>>>> + amdgpu_mes_lock(&adev->mes);
>>>> + (void)adev->mes.funcs->misc_op(&adev->mes, &op);
>>>> + amdgpu_mes_unlock(&adev->mes);
>>>> + }
>>>> +
>>>> exec_fini:
>>>> drm_exec_fini(&exec);
>>>> put_gobj_write:
>>>> --
>>>> 2.49.0
>>>>
>
next prev parent reply other threads:[~2026-05-06 7:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 16:03 [PATCH v4 01/10] drm/amdgpu/mes: add NOTIFY_WORK_ON_UNMAPPED_QUEUE op + ADD_QUEUE fields Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 02/10] drm/amdgpu/mes11: plumb unmap_flag_addr + NOTIFY_WORK_ON_UNMAPPED_QUEUE Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 03/10] drm/amdgpu/mes12: plumb is_user_mode_submission, unmap_flag_addr, NOTIFY Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 04/10] drm/amdgpu/mes_userqueue: mark SDMA UMQs as user-mode submission Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 05/10] amdgpu: add global aggregated doorbell bo Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 06/10] drm/amdgpu: add AMDGPU_INFO_DOORBELL Jesse Zhang
2026-05-01 13:37 ` Alex Deucher
2026-04-30 16:03 ` [PATCH v4 07/10] drm/amdgpu: Add AMDGPU_GEM_OP_OPEN_GLOBAL Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 08/10] drm/amdgpu/mes: route NORMAL aggregated doorbell through global agdb_bo Jesse Zhang
2026-04-30 16:03 ` [PATCH v4 09/10] drm/amdgpu/userq: report SDMA UMQ doorbell info via AMDGPU_INFO_DOORBELL Jesse Zhang
2026-05-01 13:35 ` Alex Deucher
2026-04-30 16:03 ` [PATCH v4 10/10] drm/amdgpu/userq_fence: NOTIFY MES on SDMA UMQ submit Jesse Zhang
2026-05-01 13:30 ` Alex Deucher
2026-05-04 9:01 ` Christian König
2026-05-06 6:08 ` Zhang, Jesse(Jie)
2026-05-06 7:21 ` Christian König [this message]
2026-05-01 13:26 ` [PATCH v4 01/10] drm/amdgpu/mes: add NOTIFY_WORK_ON_UNMAPPED_QUEUE op + ADD_QUEUE fields Alex Deucher
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=d997108b-47e1-4769-b450-61ba6ce0a960@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Jesse.Zhang@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
/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