Skip to content

drm/amdgpu: Rework VM update ops for batching and explicit sync

Natalie Vock amd-gfx dri-devel lkml 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20260529-prt-explicit-sync-3d74b9dd420c

Versions newest first

  1. v2 Latest10 patches 1 replyIn review
  2. v13 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Added pending change structures to update context in order to batch changes
- Link to v1: https://patch.msgid.link/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10drm/amdgpu: Remove unused parameter from amdgpu_vm_pte_fragmentdrivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c+3 -50 replies
2/10drm/amdgpu: Add and use vm_update_ctx structdrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +7 more+317 -1440 replies
3/10drm/amdgpu: Make VM maps pending per update contextdrivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 more+113 -330 replies
4/10drm/amdgpu: Make removed/cleared mappings pending per update contextdrivers/gpu/drm/amd/amdgpu/amdgpu_csa.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 more+220 -1170 replies
5/10drm/amdgpu: Track dirty bo_va structures in update ctxdrivers/gpu/drm/amd/amdgpu/amdgpu_object.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+21 -20 replies
6/10drm/amdgpu: Add function to roll back a VM update ctxdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+27 -150 replies
7/10drm/amdgpu: Move some VA op validation to a helperdrivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+40 -310 replies
8/10drm/amdgpu: Only reject conflicting mappings if they are not cleareddrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+1 -10 replies
9/10drm/amdgpu: Add new AMDGPU_GEM_VA2 ioctldrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h +1 more+396 -31 reply
10/10drm/amdgpu: Bump minor versiondrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/10] drm/amdgpu: Rework VM update ops for batching and explicit sync

Hi,

this is v2 of my attempt at improving sparse binding perf.

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 PRT mappings are synced to every other submissions like they are right now, heavy sparse binding load can stall the gfx/compute submissions for quite a long while, leading to very noticeable stutters and hitches.

Another problem is that each sparse binding update requires a separate ioctl, so the CPU will also spend significant time constantly switching between user and kernel mode to execute the binding changes one at a time.

To remedy this, this patchset introduces a "VM update context" structure. This context encapsulates some state that is carried around different VM update functions, in patch 1 this is 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, which is a requirement for being able to explicitly sync that unmap.

In later patches, the update context is expanded to hold a set of pending mapping changes, so that a future ioctl that changes many mappings at a time has a place to keep pending changes while every change is validated, before applying everything atomically if things look okay.

Best,
Natalie

---
Changes in v2:
- Added pending change structures to update context in order to batch changes
- Link to v1: https://patch.msgid.link/[email protected]

---
Natalie Vock (10):
drm/amdgpu: Remove unused parameter from amdgpu_vm_pte_fragment drm/amdgpu: Add and use vm_update_ctx struct
drm/amdgpu: Make VM maps pending per update context drm/amdgpu: Make removed/cleared mappings pending per update context drm/amdgpu: Track dirty bo_va structures in update ctx drm/amdgpu: Add function to roll back a VM update ctx drm/amdgpu: Move some VA op validation to a helper drm/amdgpu: Only reject conflicting mappings if they are not cleared drm/amdgpu: Add new AMDGPU_GEM_VA2 ioctl
drm/amdgpu: Bump minor version

 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c |  33 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c           |  31 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c          |  21 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c      |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c          |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c          | 477 ++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h          |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h       |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_seq64.c        |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c       |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c        |  10 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c           | 660 +++++++++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h           | 100 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c        |   8 +-
 include/uapi/drm/amdgpu_drm.h                    |  46 ++
 15 files changed, 1099 insertions(+), 311 deletions(-)

---
base-commit: 65b7b0d2cf8c3cba99d599493ac96f3ab32c0a06
change-id: 20260529-prt-explicit-sync-3d74b9dd420c

Best regards,

Signature · 1 line
Natalie Vock <[email protected]>