From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0719C35B65F for ; Mon, 23 Feb 2026 11:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771845768; cv=none; b=B7+kiRdKV3HF87rX6+Qpi+b3NgEaJq/bZinNQUhZoRIPzae3aVBYyo3cDKS5kAa7dd44ErFgSs6LfZzYxbm1hDVsTPXbZhhvo7TUl5J8yRFqgvgixQ7iIGN2TF1OvYK+FsaKYL7lohZdxutXwfrn6JFErhoA4AItR4Iqv5O07X0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771845768; c=relaxed/simple; bh=rNwPGmhwj2ALlaJUUs0+8tA0iNVj/xRk1HADmk42YWE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Tave8pxzMMmImIyAxQ/10C6zOHD8OA5tgiSFnBDohd/dl2UgMpnb1DU/tp+9tNo1DoCnF4mcrobCSijzaMjy4pwKHIfUGHuVRrG1mwx4FssXP5hZoae+Ua0sTrh693KaHHTlc8zoIByGD3dWStkmjdBRCeFKrUF6xZj19T2Bmnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=By1XFl21; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="By1XFl21" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-48378df3469so31290085e9.1 for ; Mon, 23 Feb 2026 03:22:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771845765; x=1772450565; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Ezzn5ZoGBmTqaL/WoWOOmJY3hi0ECWwZN/jUNRe/4RY=; b=By1XFl21Ny/bO84IazQfzIceE3zhMspqj9vVXG87d3ZXVEWjMBGn1yqoZ25fvGRzxd OHaskh4ci8RXHg93JfpuTD2gotmK+ruoWckYPPo5CP93D7oh+Jt0SVZjKAlOY9d7tMRK 9bWln6nsmu9YxVsBBOftwodIJGrqqZmiVSvkfENTBRIYgGc3gYN3t/itMUR4LCqFV5Xr znUiIB2kmXnzsbDbnR0wcwgF0dZzoyIq2AKwWRo+TfW6tYWDXONXLrFdm9p4ygMLsJaH 4fJL0VyJY75Ocmwozrsz4IX6VyNZO6ltyBXPF1Fv+XKXxvuYUnmLNSu/4mOD3INWt0yO EY1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771845765; x=1772450565; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ezzn5ZoGBmTqaL/WoWOOmJY3hi0ECWwZN/jUNRe/4RY=; b=BbUxBW8mDWKJb1GgNonp64nun8Ox8lIXrtddfFMCiytQlsrPQqMuXOJIzP32KhhoC6 7W0lB89DZM/wB0/ZQMhXphbWdjgU2ZndSTDu8fbXpouyBQNQukRH5+1aV3EGRXLMtr9P czh2NrL+OVcFhlGEbiabZnlUPkLn8xL4eABO5SIKg8FW68Lje4w4JsbM0aRyM3vgFIAt axmS/tRr8XlNVV54+FTwkejvk+yF8heb4rxo8OLJQOSUoHglU77EB1nzpDEgNYyrCIra 1ezcWwLJLPZkLmVqS/e1UiWJYo1ncJkuCer/dt6S/1OD0Yav/8dEvOahU43RRMqvLr9L I5Xg== X-Forwarded-Encrypted: i=1; AJvYcCUJP1M4ng2A5GZu7KmQVBggFA4hVNi/A8tIaaw3amKvqjULNhF3A50esKVQngEaPJEqkSNHtk2NEjAnJrI=@vger.kernel.org X-Gm-Message-State: AOJu0YyC4OfGoMQMhkhg/U4zyEKHChr9zeXj6nPeh7lAfNr/FVRMKhbb OwNwT5VWW6XyB9zichccE80J4GXfD6jkjoWdKYg3J3Y2INpB/49NG88YWi15COwGojyh3tyy0ta 6kRJzqK3F2XHbzkYXxg== X-Received: from wmqc1.prod.google.com ([2002:a05:600c:a41:b0:483:702a:341c]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1f08:b0:46e:59bd:f7e2 with SMTP id 5b1f17b1804b1-483a94c996fmr127902415e9.11.1771845765025; Mon, 23 Feb 2026 03:22:45 -0800 (PST) Date: Mon, 23 Feb 2026 11:22:44 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260130-gpuvm-rust-v4-0-8364d104ff40@google.com> <20260130-gpuvm-rust-v4-3-8364d104ff40@google.com> Message-ID: Subject: Re: [PATCH v4 3/6] rust: gpuvm: add GpuVm::obtain() From: Alice Ryhl To: Danilo Krummrich Cc: Daniel Almeida , Boris Brezillon , Janne Grunau , Matthew Brost , "Thomas =?utf-8?Q?Hellstr=C3=B6m?=" , Lyude Paul , Asahi Lina , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Mon, Feb 23, 2026 at 11:44:12AM +0100, Danilo Krummrich wrote: > On Mon Feb 23, 2026 at 10:15 AM CET, Alice Ryhl wrote: > > On Sat, Feb 21, 2026 at 04:09:41PM +0100, Danilo Krummrich wrote: > >> On Sat Feb 21, 2026 at 9:46 AM CET, Alice Ryhl wrote: > >> > So, should we get rid of GpuVmBoRegistered in favor of ARef>? > >> > >> I wanted to avoid exposing the reference count, as I suspect drivers might not > >> need it in Rust, but I don't know for sure. > >> > >> We could also define it as GpuVmBo(ARef>), where > >> GpuVmBoInner is private, but I also don't want you to go back and forth with > >> this in case it turns out we do need drivers to be able to take a reference > >> count and I also don't think it hurts too much exposing the reference count, > >> even if not needed. > >> > >> So, either is fine with me, ARef> or > >> GpuVmBo(ARef>). > > > > I don't think GpuVmBo(ARef>) works because we need to > > be able to talk about both ARef> and &GpuVmBoInner. > > The reference type is returned by several different APIs, so the Inner > > type can't be private. > > I meant NonNull>, analogous to the current GpuVmBoRegistered. Not sure what you mean. Ultimately there is GpuVmBo which is just an Opaque wrapper. Around that, we need two pointer types: &_ and owned. The owned one can be ARef<_>, or it can be a custom pointer type like the patch has right now. Or maybe it could be Owned<_>, but it's honestly not a great match as it's not really unique. Alice