public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm,drm/xe: Relax helper module reference requirement
@ 2026-03-16 16:20 Thomas Hellström
  2026-03-16 16:20 ` [PATCH 1/2] drm: Provide a drm_dev_release_barrier() function to wait for device release callbacks Thomas Hellström
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Thomas Hellström @ 2026-03-16 16:20 UTC (permalink / raw)
  To: intel-xe
  Cc: Thomas Hellström, Matthew Brost, Maarten Lankhorst,
	Christian König, Dave Airlie, Simona Vetter, dri-devel

Helper components that hold a drm device reference also need to hold
a module reference on the (sub)driver that owns the DRM device.

This can be undesirable since it's not possible to rmmod the module
without unbinding the driver first.

Provide means to relax that requirement and then relax it for the
drm/xe driver: Keep a device-count in the xe driver (Patch 2) and add a
function to drm to wait to ensure any device release callbacks are
done executing. (Patch 1).

The remaining requirement is that whatever module calls drm_dev_put()
needs to ensure it stays in memory until that function returns.
That is true also for the unload-protected driver itself
At unload time it needs to ensure that any code inside the module
itself ending up calling drm_dev_put() is waited for before
unloading the module. This change doesn't protect against that.

As an example, this series would allow dropping the module reference
held by drm_pagemap if the modules owning the drm device is
sufficently protected.

Thomas Hellström (2):
  drm: Provide a drm_dev_release_barrier() function to wait for device
    release callbacks
  drm/xe: Don't unload the driver until all drm devices are freed

 drivers/gpu/drm/drm_drv.c      | 25 +++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_device.c | 19 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_device.h |  2 ++
 drivers/gpu/drm/xe/xe_module.c |  5 ++++-
 include/drm/drm_drv.h          |  1 +
 5 files changed, 51 insertions(+), 1 deletion(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-17 18:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 16:20 [PATCH 0/2] drm,drm/xe: Relax helper module reference requirement Thomas Hellström
2026-03-16 16:20 ` [PATCH 1/2] drm: Provide a drm_dev_release_barrier() function to wait for device release callbacks Thomas Hellström
2026-03-16 17:42   ` Christian König
2026-03-16 20:10     ` Thomas Hellström
2026-03-16 20:36       ` Thomas Hellström
2026-03-16 16:20 ` [PATCH 2/2] drm/xe: Don't unload the driver until all drm devices are freed Thomas Hellström
2026-03-16 19:52 ` ✗ CI.checkpatch: warning for drm,drm/xe: Relax helper module reference requirement Patchwork
2026-03-16 19:54 ` ✓ CI.KUnit: success " Patchwork
2026-03-16 20:29 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-17 18:28 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox