Skip to content

drm/amdgpu: fix bugs when amdgpu_vm_ptes_update fails

Thadeu Lima de Souza Cascardo amd-gfx dri-devel 1 version In review

Get series with b4
b4 am [email protected] change-id 20260914-amdgpu_vm_fixes-d64d1478657e

Versions newest first

  1. v1 Latest4 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4drm/amdgpu: make amdgpu_vm_sdma_commit handle NULL or empty jobdrivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c+13 -20 replies
2/4drm/amdgpu: make amdgpu_vm_update_funcs commit return voiddrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +2 more+13 -240 replies
3/4drm/amdgpu: don't free mapping when amdgpu_vm_update_range failsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+2 -210 replies
4/4drm/amdgpu: commit pending work when amdgpu_vm_ptes_update failsdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+1 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/4] drm/amdgpu: fix bugs when amdgpu_vm_ptes_update fails

When amdgpu_vm_ptes_update fails, there might be jobs leak and mappings might be kept in an on-stack list, which will lead to invalid list walking later on.

One of the approaches that was attempted was introducing an abort function to amdgpu_vm_update_funcs. But given the possibility that some mappings have already been pushed and committed and some may have been moved to tlb_flush_waitlist, do a partial commit instead and return the error to amdgpu_vm_update_range caller.

Also, fix amdgpu_vm_clear_freed ignoring the result of amdgpu_vm_update_range.

I just noticed a different fix for the latter was submitted at [1]. It re-adds the mapping to the freed list instead of not removing it when amdgpu_vm_update_range fails.

[1] https://lore.kernel.org/amd-gfx/[email protected]/

---
Thadeu Lima de Souza Cascardo (4):
drm/amdgpu: make amdgpu_vm_sdma_commit handle NULL or empty job drm/amdgpu: make amdgpu_vm_update_funcs commit return void drm/amdgpu: don't free mapping when amdgpu_vm_update_range fails drm/amdgpu: commit pending work when amdgpu_vm_ptes_update fails

 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c      | 14 +++++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h      |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c  |  8 +++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 26 ++++++++++++++++----------
 5 files changed, 27 insertions(+), 27 deletions(-)

---
base-commit: 59ced288fcba9e91bd38e61a972ad782c4edb7d0
change-id: 20260914-amdgpu_vm_fixes-d64d1478657e

Best regards,

Signature · 1 line
Thadeu Lima de Souza Cascardo <[email protected]>