Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop
@ 2026-07-27 14:11 Daniel Pesic
  2026-07-27 14:11 ` [PATCH 1/2] drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists() Daniel Pesic
  2026-07-27 14:11 ` [PATCH 2/2] rust: drm: gpuvm: call drm_gpuvm_bo_destroy_not_in_lists() in Drop Daniel Pesic
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Pesic @ 2026-07-27 14:11 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: Matthew Brost, Thomas Hellström, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
	Onur Özkan, dri-devel, linux-kernel, rust-for-linux,
	Daniel Pesic

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(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-27 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 14:11 [PATCH 0/2] drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop Daniel Pesic
2026-07-27 14:11 ` [PATCH 1/2] drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists() Daniel Pesic
2026-07-27 14:11 ` [PATCH 2/2] rust: drm: gpuvm: call drm_gpuvm_bo_destroy_not_in_lists() in Drop Daniel Pesic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox