From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.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 800232D2486 for ; Fri, 23 Jan 2026 09:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160184; cv=none; b=Arn/GcU7qWLceTbBonQJky7HjN+GBpHR/cngSNo5Bvz9CK3hnHEOqs6fbM0LvSbv4cAVw0ojPlrWUDCB8Yn2rG1IG3roBt8TBjDmSp7QzxBBuC92r0zfKGLj3Ip3gkNyzE7w2xi3X+zQiHyYwPgVk/VlfZdAqkzXwOMaqx6nd6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769160184; c=relaxed/simple; bh=jmRzwHbiBDRhvUStizcooMOirVVk+Rjihob918JmbUE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NIXI7gAdxUdP8+CkJ81Kii2sWTSXgr+oJ/dFqKW90ygWVwk26v9koiCASGmO5l8L2Ltm/8ve5bngn86ZYLbYLPA6NWNmRLSAT0rKNajE0FINQHIQvqaubiWc397lVhNb+sQtDn64uz8L+xdrF2yqwxiWAftDGucUO2sezT+P5Xg= 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=XgC/Sbp0; arc=none smtp.client-ip=209.85.218.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="XgC/Sbp0" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-b83c3dd2092so208436266b.1 for ; Fri, 23 Jan 2026 01:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769160182; x=1769764982; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=krQTROe4H3NUeXd/bSNRIGoEhdSPybqAT9gUYqiaTP0=; b=XgC/Sbp0nA1R18XWzbNvm2XRskOFg1IavMFRlAW3cBbpqs7STRnhu4cMVHCsBo/T+4 TWdUHSCKLVPZRY1ON4EvJ7tVleflmERQunjxoVdJBjWThX3lSBK+oVBM3Pjj1nXOFg2D x5I3+Q+wCzp4Ji8Trv3EpJU7+swa+XAcXHribzWFYruCJtIU7y69CUFKESngX8AGiCGv 0J1/NDLWzNY5CWdOjBP7PD8QaaX6YvIUdmlSKmp8VnnHJAYlzcsg254/bj9MTY7gTaFE rFSHcx7RApkklqkVTQZILI5o47hGz68KytfUKXiaF0wsRYnd8sM5WvWZVP6arUrt9F+d n98Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769160182; x=1769764982; h=content-transfer-encoding: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=krQTROe4H3NUeXd/bSNRIGoEhdSPybqAT9gUYqiaTP0=; b=SrJjOfwUcpSj9l4NkPS6YSgK2/eMPWBbX7qkXD7S7CKB2r+KVMsSIO2ELuQuFjcn5v 1Y2x2tPbK9pGMRHZRJIeVwovkcu8/1+nsuFRvT72zd8zTBypmxikP8Y3i4xYFDxgn0l3 K/ZeXw4xdxlFpm5azXuL+Je1I74Hm2oHJshQqF+ZGctnDLGqBizf9L1/u0p7zk6wMvKT v6mzPi5NpAzDBZnqBG9yKQZTjDPEx1823p0wUMgSnoz70coZafPg36K4bIV7F+EHrCV6 2UGkYaIKOWijaWivBazGK2IvMbZ8XcSnSLo0SslnwGrHR2XsZFNyzKggBwCNGfff4E/z g+BQ== X-Forwarded-Encrypted: i=1; AJvYcCWFIk3NtlmE54mNcWPN0j+0cFD+qv06yEhiM+HZapJm63mv5wJf1rCErieEaXt0tIsJl8lDhVd8p97IoSo=@vger.kernel.org X-Gm-Message-State: AOJu0YwB9miwErMjD9PyK6s6Z+Ulv2T8GkQfUuGX1ZPLErjAqztqkiCd 16v5GQg9YUAe/B634X500l/1ykE4fd3GpmS23aWt3I4sJ6OQPjryau5D1w70ivI6W1rnIGNxuSD hWqTRDFZLe+VBPZYNKA== X-Received: from ejrp15.prod.google.com ([2002:a17:906:6a8f:b0:b88:39f3:89d1]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:1c1b:b0:b87:380f:f576 with SMTP id a640c23a62f3a-b88673667bamr47886066b.30.1769160181881; Fri, 23 Jan 2026 01:23:01 -0800 (PST) Date: Fri, 23 Jan 2026 09:23:00 +0000 In-Reply-To: <180E0324-383E-4813-8CD0-CA15EC3B3EFB@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260121-gpuvm-rust-v3-0-dd95c04aec35@google.com> <20260121-gpuvm-rust-v3-5-dd95c04aec35@google.com> <180E0324-383E-4813-8CD0-CA15EC3B3EFB@collabora.com> Message-ID: Subject: Re: [PATCH v3 5/6] rust: gpuvm: add GpuVmCore::sm_unmap()' From: Alice Ryhl To: Daniel Almeida Cc: Danilo Krummrich , 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" Content-Transfer-Encoding: quoted-printable On Thu, Jan 22, 2026 at 07:43:11PM -0300, Daniel Almeida wrote: > Hi Alice, >=20 > > On 21 Jan 2026, at 08:31, Alice Ryhl wrote: > > +/// Represents an `sm_step_unmap` operation that has not yet been comp= leted. > > +pub struct OpUnmap<'op, T: DriverGpuVm> { > > + op: &'op bindings::drm_gpuva_op_unmap, > > + _invariant: PhantomData<*mut &'op mut T>, >=20 > Would have been cool to explain why we have a pointer in this PhantomData= . >=20 > Same elsewhere, IMHO. Helps with maintainability in the future. >=20 > (To be honest, I=E2=80=99m not really sure what=E2=80=99s going on here..= ) Normally, when you have an OpUnmap<'long, T> Rust will let you convert that into an OpUnmap<'short, T>, but I don't want that in this case. Making such coercions impossible means that callers of sm_step_unmap() cannot return the "wrong" OpUnmapped from the closure because the only way to get an OpUnmapped with the right lifetime is to call remove() on the OpUnmap you received. (Otherwise, it may be possible to return an OpUnmapped from one sm_step_unmap() call in another sm_step_unmap() call.) There are various different types one can place in PhantomData to have this effect. A mutable pointer is one choice. I could also have used: PhantomData &'op mut T> or a few other options. Alice