Re: [PATCH 0/4] drm/tyr: use pin-init self-referential support
From: Danilo Krummrich
Date: Mon Nov 23 2026 - 18:34:53 EST
On Mon Nov 23, 2026 at 11:20 PM CET, Daniel Almeida wrote:
> Hi Danilo,
>
> Thanks for doing this.
>
> I spoke with Gary about this topic at Kangrejos and again a couple of weeks
> ago. What worries me is that we might introduce some restrictions that might
> paint us into a corner. IOW: we have significant downstream work, and I wonder
> whether it will work with this series after whatever refactors are needed.
The reason for the existence of the converted reference counts hasn't been that
reference counting was needed as an ownership model, it just was that we haven't
had a way to express borrowing from sibling fields that are already guaranteed
to be longer lived in any case.
The distinction is between A having an independent owner that keeps it alive for
all B consumers, so the Bs can borrow A, and the Bs collectively owning A, so A
is destroyed when the last B releases it. Reference counting expresses the
latter ownership model. Both can still be subject to lifetime bounds.
In the majority of cases, drivers acquire device resources in stages, keeping
earlier resources alive until their dependants have been torn down. Where
ownership follows this hierarchy, borrowing can express those relationships
without reference counting.
> To start with, Alvin's VM_BIND ioctl series [0] will need some changes, since
> it keeps the VM pool in the file data. I think this is doable if we move the
> pool into the registration data and have each file hold only an index to its
> own entry? i.e.: something like an XArray<Pool<Vm>> indexed by a number
> associated with the drm::File. Same for the group pool later. Is this what you
> had in mind?
No, the changes do not force XArray<Pool<Vm>> to be moved into the registration
data; drm::File private data can borrow from DRM registration data. It can (and
should) stay in the drm::File private data.
(I'm also working on a generalization of this, as it is a repeating pattern in
drivers. We want driver private data associated with an ioctl, e.g. VM_CREATE,
which is shorter lived than the drm::File data and hence shorter lived than the
drm::RegistrationData.
Concurrent ioctls associated with a handle to this data, i.e. the VM in this
example, need to be drained on either VM_DESTROY or drm::File private data
destruction, e.g. caused by unregistration through driver unbind.)
> Anything storing a KernelBo will also have to be outside of the file data,
> IIUC, since it now stores a &Vm. Also, downstream we defer KernelBo drops to a
> workqueue, because they can happen in the fence signalling path. I suppose we
> can keep doing that using ScopedWork/ScopedQueue?
I assume you refer to the Vm that lives in Firmware. If so, drm::File private
data can borrow from it, as Firmware lives in the DRM registration data.
The teardown has to happen in ScopedWork regardless, as they all carried device
resource induced lifetimes already and hence can't go into unbounded work
anyway.
Thanks,
Danilo