Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baoli Zhang <baoli.zhang@linux.intel.com>
To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	jani.nikula@linux.intel.com, rodrigo.vivi@intel.com,
	joonas.lahtinen@linux.intel.com, tursulin@ursulin.net,
	matthew.brost@intel.com, thomas.hellstrom@linux.intel.com,
	matthew.auld@intel.com, airlied@gmail.com, simona@ffwll.ch,
	andriy.shevchenko@linux.intel.com,
	Baoli Zhang <baoli.zhang@linux.intel.com>
Subject: [PATCH 0/3] drm/xe/display: Free the KMS objects on DRM device release, not on unbind
Date: Mon, 16 Nov 2026 09:15:01 +0800	[thread overview]
Message-ID: <20261116011504.3910139-1-baoli.zhang@linux.intel.com> (raw)

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


             reply	other threads:[~2026-11-16  1:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  1:15 Baoli Zhang [this message]
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
2026-11-16  1:35 ` ✓ CI.KUnit: success for drm/xe/display: Free the KMS objects on DRM device release, not on unbind Patchwork
2026-11-16  2:08 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16  3:20 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116011504.3910139-1-baoli.zhang@linux.intel.com \
    --to=baoli.zhang@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox