Rust for Linux List
 help / color / mirror / Atom feed
From: Sami Tolvanen <samitolvanen@google.com>
To: "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>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: Deborah Brouwer <deborah.brouwer@collabora.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	 rust-for-linux@vger.kernel.org
Subject: [PATCH v4 0/2] rust: drm: gpuvm: implement Send and Sync for refcounted handles
Date: Thu, 11 Jun 2026 22:17:20 +0000	[thread overview]
Message-ID: <20260611-gpuvm-sync-send-v4-0-6c7f4ab2778a@google.com> (raw)

Hi folks,

GpuVaAlloc and GpuVmBo implement neither Send or Sync, so drivers
that move them between threads need their own unsafe impls. GpuVm
implements both unconditionally, which Sashiko points out is
unsound.

Path 1 requires Send + Sync on DriverGpuVm and its associated data
instead of bounding each impl separately, as discussed in the v3
thread. Patch 2 adds bounds for GpuVaAlloc and GpuVmBo.

This series is based on Deborah's DeviceContext patch as they would
otherwise conflict:

https://lore.kernel.org/rust-for-linux/20260610-gpuvm_device_context_v1-v1-1-01a890b17448@collabora.com/

Sami

---
v4:
- Moved the bounds to the DriverGpuVm trait as discussed in the
  v3 thread, and reordered the series.
- Added Send for VaData as pointed out by Sashiko again.
- Rebased on top of Deborah's DeviceContext patch.

v3:
- Added a patch for GpuVm, and changed GpuVmBo bounds based on
  another Sashiko analysis.

v2:
- Added a missing T::Object: Send + Sync bound pointed out by
  Sashiko.

---
Sami Tolvanen (2):
      rust: drm: gpuvm: require Send + Sync for the driver's associated data
      rust: drm: gpuvm: implement Send and Sync for GpuVaAlloc and GpuVmBo

 rust/kernel/drm/gpuvm/mod.rs   | 26 +++++++++++++++-----------
 rust/kernel/drm/gpuvm/va.rs    |  8 ++++++++
 rust/kernel/drm/gpuvm/vm_bo.rs |  9 +++++++++
 3 files changed, 32 insertions(+), 11 deletions(-)
---
base-commit: 550dc7536644db2d67c6f8cf525bba682fba08d9
change-id: 20260611-gpuvm-sync-send-aa47a9001ae6
prerequisite-change-id: 20260610-gpuvm_device_context_v1-367c21f94e1e:v1
prerequisite-patch-id: eb2074676db5d923c8505208388fd1c0dba58b6a

             reply	other threads:[~2026-06-11 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 22:17 Sami Tolvanen [this message]
2026-06-11 22:17 ` [PATCH v4 1/2] rust: drm: gpuvm: require Send + Sync for the driver's associated data Sami Tolvanen
2026-06-11 22:17 ` [PATCH v4 2/2] rust: drm: gpuvm: implement Send and Sync for GpuVaAlloc and GpuVmBo Sami Tolvanen

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=20260611-gpuvm-sync-send-v4-0-6c7f4ab2778a@google.com \
    --to=samitolvanen@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=deborah.brouwer@collabora.com \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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