On Wed Nov 18, 2026 at 4:29 PM GMT, Danilo Krummrich wrote: > Make the DRM file private data lifetime-parameterized, allowing drivers > to borrow from RegistrationData in their per-file data. > > Introduce DriverFile<'a> as a lifetime-parameterized trait that receives > both the device and registration data in open(). Parametrize File<D> on > the driver type rather than the file data type, deriving the concrete > file type through Driver::File<'a>. > > Add inner_with() to access the driver file data from a File<D> reference. > > Ensure file data is always dropped before registration data: > > - In Registration::drop(), detach driver_priv for all open files under > filelist_mutex, then drop the detached data after releasing the mutex > and wait for file-data destruction in concurrent postclose_callback() > calls via an open_count / WaitQueue pair on drm::Device. > > - In postclose_callback(), skip the drop if driver_priv has already > been NULLed by the filelist iteration. The NULL write is visible > through the filelist_mutex acquire/release chain in > drm_close_helper(). > > Reviewed-by: Daniel Almeida <[email protected]> > Reviewed-by: Alice Ryhl <[email protected]> > Signed-off-by: Danilo Krummrich <[email protected]>
Reviewed-by: Gary Guo <[email protected]> > --- > drivers/gpu/drm/nova/driver.rs | 2 +- > drivers/gpu/drm/nova/file.rs | 13 ++- > drivers/gpu/drm/nova/gem.rs | 8 +- > drivers/gpu/drm/tyr/driver.rs | 2 +- > drivers/gpu/drm/tyr/file.rs | 11 ++- > rust/kernel/drm/device.rs | 31 +++++- > rust/kernel/drm/driver.rs | 113 +++++++++++++++++++-- > rust/kernel/drm/file.rs | 173 ++++++++++++++++++++++++--------- > rust/kernel/drm/gem/mod.rs | 44 ++++++--- > rust/kernel/drm/gem/shmem.rs | 9 +- > rust/kernel/drm/ioctl.rs | 6 +- > 11 files changed, 322 insertions(+), 90 deletions(-)
