drm/amdgpu/userq: commit seq64 BO mapping at queue creation
Subsystems (2)
PATCH 1/1 drm/amdgpu/userq: commit seq64 BO mapping at queue creation
The seq64 sync BO's PTE update only ran from the legacy CS path, so userqueue-only clients never got it mapped and their fence_drv could never signal completion. Add support for userqueues too.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +21 -0
@@ -720,6 +720,27 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)if (r) goto free_fence_drv; +/* Update the seq64 BO mapping in VM for User Queues */ +if (fpriv->seq64_va) { +struct amdgpu_bo *seq64_bo = fpriv->seq64_va->base.bo; + + r =amdgpu_bo_reserve (seq64_bo, false); +if (r) { +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + + r =amdgpu_vm_bo_update (adev, fpriv->seq64_va, false); +if (r) { +amdgpu_bo_unreserve (seq64_bo); +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + +dma_fence_wait (fpriv->seq64_va->last_pt_update, false); +amdgpu_bo_unreserve (seq64_bo); + } + if (amdgpu_userq_input_va_validate(adev, queue, args->in.queue_va, args->in.queue_size, &queue->userq_vas.va.queue_rb) ||
Signature · 1 line
2.34.1
Ignore please. Sent new patch.
Quoted 42 lines · Sunil Khatri
The seq64 sync BO's PTE update only ran from the legacy CS path, so userqueue-only clients never got it mapped and their
fence_drvcould never signal completion. Add support for userqueues too.Fixes ae05e3f3d02b812c ("drm/amdgpu: move amdgpu_vm_bo_update() call into correct location")Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +21
-0@@ -720,6 +720,27 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)if (r) goto free_fence_drv; +/* Update the seq64 BO mapping in VM for User Queues */ +if (fpriv->seq64_va) { +struct amdgpu_bo *seq64_bo = fpriv->seq64_va->base.bo; + + r =amdgpu_bo_reserve (seq64_bo, false); +if (r) { +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + + r =amdgpu_vm_bo_update (adev, fpriv->seq64_va, false); +if (r) { +amdgpu_bo_unreserve (seq64_bo); +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + +dma_fence_wait (fpriv->seq64_va->last_pt_update, false); +amdgpu_bo_unreserve (seq64_bo); + } + if (amdgpu_userq_input_va_validate(adev, queue, args->in.queue_va, args->in.queue_size, &queue->userq_vas.va.queue_rb) ||
AMD General
Quoted 50 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Khatri, Sunil
Sent: Friday, October 16, 2026 10:59 AM
To: Khatri, Sunil <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] drm/amdgpu/userq: commit seq64 BO mapping at queue creationIgnore please. Sent new patch.
Quoted 5 lines · Sunil Khatri
The seq64 sync BO's PTE update only ran from the legacy CS path, so userqueue-only clients never got it mapped and their
fence_drvcould never signal completion. Add support for userqueues too.Fixes ae05e3f3d02b812c ("drm/amdgpu: move amdgpu_vm_bo_update()call
Quoted 4 lines
into correct location")
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 21+++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union
Quoted 8 lines
1 file changed, 21 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -720,6 +720,27 @@ amdgpu_userq_create(struct drm_file *filp, union
drm_amdgpu_userq*args)Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +13
-0if (r) goto free_fence_drv; +/* Update the seq64 BO mapping in VM for User Queues */ +if (fpriv->seq64_va) { +struct amdgpu_bo *seq64_bo = fpriv->seq64_va->base.bo; + + r =amdgpu_bo_reserve (seq64_bo, false); +if (r) { +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + + r =amdgpu_vm_bo_update (adev, fpriv->seq64_va, false); +if (r) { +amdgpu_bo_unreserve (seq64_bo);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args) · line 743
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +8
-0+amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + +dma_fence_wait (fpriv->seq64_va->last_pt_update, false); +amdgpu_bo_unreserve (seq64_bo); + } +
Hi Sunil,
I noticed two issues in the earlier version that are worth checking in the replacement patch.
The update runs before VM validation. If the VM page tables were evicted before the first USERQ_CREATE, amdgpu_vm_bo_update() can return -EBUSY because vm->evicting is still set. CREATE then exits before reaching amdgpu_userq_ensure_ev_fence(), which would otherwise trigger VM validation and restore.
Also, the root PD is already reserved here. Reserving the seq64 BO with another amdgpu_bo_reserve() uses no shared ww ticket, so it can deadlock against a drm_exec retry that holds seq64 and is waiting for the PD.
Could we update seq64 in amdgpu_userq_vm_validate_and_restore_queue(), after VM validation, with the BO reserved through the existing drm_exec, and wait for its PTE update before restoring the queues? please try the patch: "map the seq64 memory when restoring user queues"
https://lists.freedesktop.org/archives/amd-gfx/2026-October/155022.html
Thanks,
Jesse
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0if (amdgpu_userq_input_va_validate (adev, queue, args->in.queue_va, args->in.queue_size, &queue->userq_vas.va.queue_rb)||
AMD General
Yes, I realised that and updated the patch in restore path and pushed it already.
Thanks for pointing.
Regards
Sunil khatri
________________________________
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Friday, 16 October 2026 08:45:34
To: Khatri, Sunil <[email protected]>; Khatri, Sunil <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected] <[email protected]>
Subject: RE: [PATCH v1] drm/amdgpu/userq: commit seq64 BO mapping at queue creation
AMD General
Quoted 50 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Khatri, Sunil
Sent: Friday, October 16, 2026 10:59 AM
To: Khatri, Sunil <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] drm/amdgpu/userq: commit seq64 BO mapping at queue creationIgnore please. Sent new patch.
Quoted 5 lines · Sunil Khatri
The seq64 sync BO's PTE update only ran from the legacy CS path, so userqueue-only clients never got it mapped and their
fence_drvcould never signal completion. Add support for userqueues too.Fixes ae05e3f3d02b812c ("drm/amdgpu: move amdgpu_vm_bo_update()call
Quoted 4 lines
into correct location")
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 21+++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union
Quoted 8 lines
1 file changed, 21 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -720,6 +720,27 @@ amdgpu_userq_create(struct drm_file *filp, union
drm_amdgpu_userq*args)Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +13
-0if (r) goto free_fence_drv; +/* Update the seq64 BO mapping in VM for User Queues */ +if (fpriv->seq64_va) { +struct amdgpu_bo *seq64_bo = fpriv->seq64_va->base.bo; + + r =amdgpu_bo_reserve (seq64_bo, false); +if (r) { +amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + + r =amdgpu_vm_bo_update (adev, fpriv->seq64_va, false); +if (r) { +amdgpu_bo_unreserve (seq64_bo);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args) · line 743
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +8
-0+amdgpu_bo_unreserve (fpriv->vm.root.bo); + goto free_fence_drv; + } + +dma_fence_wait (fpriv->seq64_va->last_pt_update, false); +amdgpu_bo_unreserve (seq64_bo); + } +
Hi Sunil,
I noticed two issues in the earlier version that are worth checking in the replacement patch.
The update runs before VM validation. If the VM page tables were evicted before the first USERQ_CREATE, amdgpu_vm_bo_update() can return -EBUSY because vm->evicting is still set. CREATE then exits before reaching amdgpu_userq_ensure_ev_fence(), which would otherwise trigger VM validation and restore.
Also, the root PD is already reserved here. Reserving the seq64 BO with another amdgpu_bo_reserve() uses no shared ww ticket, so it can deadlock against a drm_exec retry that holds seq64 and is waiting for the PD.
Could we update seq64 in amdgpu_userq_vm_validate_and_restore_queue(), after VM validation, with the BO reserved through the existing drm_exec, and wait for its PTE update before restoring the queues? please try the patch: "map the seq64 memory when restoring user queues"
https://lists.freedesktop.org/archives/amd-gfx/2026-October/155022.html
Thanks,
Jesse
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0if (amdgpu_userq_input_va_validate (adev, queue, args->in.queue_va, args->in.queue_size, &queue->userq_vas.va.queue_rb)||