Rust for Linux List
 help / color / mirror / Atom feed
From: Daniel Pesic <danny.pesic@gmail.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org,
	"Daniel Pesic" <danny.pesic@gmail.com>
Subject: [PATCH 0/2] drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop
Date: Mon, 27 Jul 2026 07:11:19 -0700	[thread overview]
Message-ID: <20260727141121.11975-1-danny.pesic@gmail.com> (raw)

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


             reply	other threads:[~2026-07-27 21:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 14:11 Daniel Pesic [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260727141121.11975-1-danny.pesic@gmail.com \
    --to=danny.pesic@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tmgross@umich.edu \
    --cc=tzimmermann@suse.de \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox