drm/xe/display: Free the KMS objects on DRM device release, not on unbind
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | drm/i915/display: Tear down encoder hardware state in a separate hookdrivers/ drivers/ drivers/ +4 more | +45 | 0 replies | |
| 2/3 | drm/i915/display: Let the drivers free the KMS objectsdrivers/ drivers/ drivers/ +1 more | +17 | 2 replies | |
| 3/3 | drm/xe/display: Free the KMS objects on DRM device releasedrivers/ | +4 | 0 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by.
| Patch | Yanx L Liu |
|---|---|
| 1/3 | T-b |
| 2/3 | T-b |
| 3/3 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] drm/xe/display: Free the KMS objects on DRM device release, not on unbind
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(-)
Signature · 1 line
2.43.0