From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EDEFEA4FAE for ; Mon, 23 Feb 2026 11:22:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF75410E15F; Mon, 23 Feb 2026 11:22:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="SSTyAR/h"; dkim-atps=neutral Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4FA510E15F for ; Mon, 23 Feb 2026 11:22:46 +0000 (UTC) Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48372facfedso44758075e9.0 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=lists.freedesktop.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=SSTyAR/hQUCDNtOjuqH643u6K12cS4BqEgli6HBtsS39ScVMTK5eVgAZDMO1LwqReA kPlpNOgVqeXHVdGyczQFZ55Ev8svn5m50zBPh5Me5g4cXhK4aS9JcdMgknn0zv8wTLFB 1kuPD2EftxxmKMyLTEVRQ0B1MCbl5U3i46na0LjUkHOQxLXZml9sGfxVlB0lEVdV6Dkv noAqdyoV2zAH81uGz3YyHBmh2HcFNfTAH0hw/ZEiqVIGS0OQdXL034ipCXa6o8pcbc53 otVCdmBJZolxMmmr+UlSeNBI2OQRTJtDSBTxLjDllOsoQmkV5in9PAtJ87bBGf0+x44y Pw8A== 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=PYWoHtPyC5211ulKpny54YcBhShblg7MXVW6CC3bXodiZ89ACOHXlb3+/p5Lo+JBqu V5rAqL1C5UfjsRSeb55k79MBwDCZRn4jpbbKUmuIL9MuRjhavbLLXG4dM+xpNSuvVMmY xbt3CCTx9OQluJtUZDoT04m8uG1St7Jc63aS4XZ0245rEJJzCcV9uAo1TfeM7VbaNwsY e9LE1+zgKOBY5WDK7nbJe0eIoSj9UC5RHRnM6ou8MRcNuhVtxilFNXgkXIVxzwRql3Kh Z3I1agC//2xxoEFmmBfxuCe/G1RMAeJHQSv4AJyGGNNbpsuRJcN0SOEBUMj5O2GsgwvL 7tYw== X-Forwarded-Encrypted: i=1; AJvYcCWvih86OvtFOF+Ie1NC52/s7XhBcjpuddF18TS5WygLAWRFQGlEme7qFUS+dVTjXz2YE9plpEaZFUc=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxrxJXpR6IqqtJfQtamQG8DMtnOClJD/QSurcbVXbw+x9DJzIyC l83TflTvVHRL9EVggrFJlIQ7J2loNalqP1DXL68dH1I1OiyK94QMSYM46SrA5M3bDURhATgB11T s3oZq5n2jsKYgzORPEg== 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: 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" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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