[PATCH 0/3] drm/amdgpu: Explicit sync for PRT unmaps

From: Natalie Vock

Date: Fri May 29 2026 - 02:36:02 EST


Hi,

here's another attempt at getting unmaps (especially PRT ones) to be
synced explicitly, i.e. without the implicit sync to every other
submission in the VM.

The motivator is that many games have come to heavily use sparse
bindings, and they often rely on being able to overlap frame work on
gfx/compute queues with sparse binding work on sdma. If we sync to every
other submission, heavy sparse binding load can stall the gfx/compute
submissions for quite a long while, leading to very noticeable stutters
and hitches.

Currently, we have one free-list per VM, but random unrelated mappings
might stick around in the free-list in addition to the unmaps performed
in the current VM update. It is obviously invalid to clear those
unrelated mappings with the same explicit sync semantics, so we need a
way to separate out the mappings that can be cleared with explicit sync
from those that can't.

To introduce that separation, patch 1 wraps all VM update operations in
a "VM update context". This context encapsulates some state that is
carried around different VM update functions, most importantly the
mappings that were freed along the way. amdgpu_vm_clear_freed then only
clears the mappings that were actually freed in the update operation.

Patch 2 builds on the update context to add some additional bookkeeping
and track if every mapping from the context's free-list actually
supports being cleared with explicit sync. If userspace requests it and
all conditions are met, explicit sync is then enabled for the PT
clearing operations.

In the UAPI, a new VA IOCTL flag is added to request explicit sync, and
the minor driver version is bumped to inform userspace of support for
the explicit sync flag.

Signed-off-by: Natalie Vock <natalie.vock@xxxxxx>
---
Natalie Vock (3):
drm/amdgpu: Add and use vm_update_ctx struct
drm/amdgpu: Implement explicit sync for PRT unmaps
drm/amdgpu: Bump minor version

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 42 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 30 ++-
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 22 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 61 +++---
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c | 21 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 5 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 262 +++++++++++++++--------
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 93 +++++++-
drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 15 +-
include/uapi/drm/amdgpu_drm.h | 2 +
13 files changed, 396 insertions(+), 167 deletions(-)
---
base-commit: 0b5b03275d8e8961706e5f61903e41e44e8ebfaa
change-id: 20260529-prt-explicit-sync-3d74b9dd420c

Best regards,
--
Natalie Vock <natalie.vock@xxxxxx>