Skip to content

drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop

Daniel Pesic dri-devel lkml rust-for-linux 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists()drivers/gpu/drm/drm_gpuvm.c include/drm/drm_gpuvm.h+5 -20 replies
2/2rust: drm: gpuvm: call drm_gpuvm_bo_destroy_not_in_lists() in Droprust/kernel/drm/gpuvm/vm_bo.rs+7 -30 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/2] drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop

GpuVmBoAlloc::drop() (rust/kernel/drm/gpuvm/vm_bo.rs) currently releases its drm_gpuvm_bo via drm_gpuvm_bo_put_deferred(), which exists to handle destruction from contexts where the GEM's gpuva lock cannot be taken synchronously. However, a GpuVmBoAlloc has a refcount of one and is never added to the gem, extobj, or evict lists by construction. Therefore, a GpuVmBoAlloc that is dropped without being consumed by obtain() does not require a deferred put.

drm_gpuvm_bo_obtain_prealloc() currently handles this situation internally, where it discards the losing preallocated drm_gpuvm_bo by unlocking obj->gpuva.lock and calling drm_gpuvm_bo_destroy_not_in_lists() directly, which skips the deferred path.

This series lets GpuVmBoAlloc::drop() behave the same:

1/2: exports drm_gpuvm_bo_destroy_not_in_lists() so it can be called from the Rust binding, and promotes its comment to kernel-doc.

2/2: switches GpuVmBoAlloc::drop() to call it directly, and includes the safety argument for why its precondition holds. Drops the TODO left previously.

Note: there is currently no in-tree caller of GpuVm::obtain(), so the drop path isn't currently exercised by an existing driver.

Daniel Pesic (2):
drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists()
rust: drm: gpuvm: call drm_gpuvm_bo_destroy_not_in_lists() in Drop

 drivers/gpu/drm/drm_gpuvm.c    |  5 +++--
 include/drm/drm_gpuvm.h        |  2 ++
 rust/kernel/drm/gpuvm/vm_bo.rs | 10 +++++++---
 3 files changed, 12 insertions(+), 5 deletions(-)
Signature · 1 line
2.55.0