dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/xe/display: Free the KMS objects on DRM device release, not on unbind
@ 2026-11-16  1:15 Baoli Zhang
  2026-11-16  1:15 ` [PATCH 1/3] drm/i915/display: Tear down encoder hardware state in a separate hook Baoli Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Baoli Zhang @ 2026-11-16  1:15 UTC (permalink / raw)
  To: intel-xe, intel-gfx
  Cc: dri-devel, linux-kernel, jani.nikula, rodrigo.vivi,
	joonas.lahtinen, tursulin, matthew.brost, thomas.hellstrom,
	matthew.auld, airlied, simona, andriy.shevchenko, Baoli Zhang

Unbinding xe while a display server still has the DRM fd open gives
these warnings, and drm_fb_release() later walks the freed framebuffers
when the fd is closed:

  WARNING: drivers/gpu/drm/drm_mode_config.c:571 at drm_mode_config_cleanup+0x2e7/0x300
  xe 0000:00:02.0: [drm] drm_WARN_ON(!list_empty(&fb->filp_head))
  WARNING: drivers/gpu/drm/drm_framebuffer.c:833 at drm_framebuffer_free+0x87/0xa0

Since 5b6937b65e45 ("drm/xe/display: move display fini stuff to devm")
xe frees the KMS objects on unbind, but they should only be freed with
the last reference to the DRM device. drm_mode_config_init() already
registers drm_mode_config_cleanup() as a drmm action, so xe can simply
stop calling it. The first two patches prepare the shared display code
for that, with no change for i915:

1: move the hardware teardown out of the encoder ->destroy() callbacks
   into a new ->remove() hook, which still runs on unbind
2: move drm_mode_config_cleanup() out of
   intel_display_driver_remove_noirq() into the drivers
3: the actual fix, xe stops calling it

i915 keeps freeing the KMS objects on unbind for now. It frees the
display structure from its ->release() callback, before the drmm
actions run, so it can't rely on drmm without further changes.

We hit this with the LTP-DDT test TELEMETRY_XS_FUNC_TELEM_DRIVER, which
unbinds xe, on PTL with RHEL 10.3 and a v6.18.60 kernel (the trace above
is from there). It doesn't reproduce on Ubuntu, and only reproduces on
the first run after boot. My guess is that GDM holds the device on RHEL
and doesn't get it back after the first unbind/rebind.

Yanx tested the series backported to v6.18.60, the warnings are gone.
On mainline it is build-tested only.

Baoli Zhang (3):
  drm/i915/display: Tear down encoder hardware state in a separate hook
  drm/i915/display: Let the drivers free the KMS objects
  drm/xe/display: Free the KMS objects on DRM device release

 drivers/gpu/drm/i915/display/g4x_dp.c            |  8 ++++++--
 drivers/gpu/drm/i915/display/intel_ddi.c         | 16 +++++++++++-----
 .../gpu/drm/i915/display/intel_display_driver.c  | 15 ++++++++++++++-
 .../gpu/drm/i915/display/intel_display_driver.h  |  1 +
 .../gpu/drm/i915/display/intel_display_types.h   |  7 +++++++
 drivers/gpu/drm/i915/display/intel_encoder.c     |  9 +++++++++
 drivers/gpu/drm/i915/display/intel_encoder.h     |  1 +
 drivers/gpu/drm/i915/display/intel_sdvo.c        | 11 +++++++++--
 drivers/gpu/drm/i915/i915_driver.c               |  2 ++
 drivers/gpu/drm/xe/display/xe_display.c          |  4 ++++
 10 files changed, 64 insertions(+), 10 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-11-16  8:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  1:15 [PATCH 0/3] drm/xe/display: Free the KMS objects on DRM device release, not on unbind Baoli Zhang
2026-11-16  1:15 ` [PATCH 1/3] drm/i915/display: Tear down encoder hardware state in a separate hook Baoli Zhang
2026-11-16  1:38   ` sashiko-bot
2026-11-16  1:15 ` [PATCH 2/3] drm/i915/display: Let the drivers free the KMS objects Baoli Zhang
2026-11-16  1:53   ` sashiko-bot
2026-11-16  8:39   ` Jani Nikula
2026-11-16  1:15 ` [PATCH 3/3] drm/xe/display: Free the KMS objects on DRM device release Baoli Zhang
2026-11-16  1:54   ` sashiko-bot

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