[Intel-xe] [PATCH] drm/xe/display: fix bo leak when unloading module

Matthew Auld matthew.auld at intel.com
Fri Feb 17 10:36:47 UTC 2023


One of the issues affecting module unload (DG2 + display) appears to be
some kind of BO leak:

WARNING: CPU: 1 PID: 1198 at drivers/gpu/drm/drm_mm.c:999 drm_mm_takedown+0x2e/0xc0
WARNING: CPU: 1 PID: 1198 at drivers/gpu/drm/drm_buddy.c:174 drm_buddy_fini+0x5e/0x70 [drm_buddy]

Turning on more debugging points at:

[drm:drm_mm_takedown] *ERROR* node [00e10000 + 00e11000]: inserted at
  drm_mm_insert_node_in_range+0x2c8/0x500
  __xe_ggtt_insert_bo_at+0xb0/0x120 [xe]
  xe_bo_create_locked_range+0x255/0x2d0 [xe]
  xe_bo_create_pin_map_at+0x4d/0x170 [xe]
  intel_alloc_initial_plane_obj.isra.0+0x175/0x340 [xe]
  intel_crtc_initial_plane_config+0x7e/0x270 [xe]
  intel_modeset_init_nogem+0x341/0x8b0 [xe]
  xe_display_init_noaccel+0x1e/0x50 [xe]
  xe_device_probe+0x1fa/0x2a0 [xe]

So looks like we are leaking the object ref for the initial fb. Looking
at the i915 code we also drop the driver reference to the underlying BO,
which appears to just leave the drm framebuffer holding the last ref. Do
the same for Xe.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/xe/display/xe_plane_initial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c
index bd5d588e8fbf..a2ef0823ed02 100644
--- a/drivers/gpu/drm/xe/display/xe_plane_initial.c
+++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c
@@ -230,6 +230,8 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,
 
 	atomic_or(plane->frontbuffer_bit, &to_intel_framebuffer(fb)->bits);
 
+	plane_config->vma = vma;
+
 	/*
 	 * Flip to the newly created mapping ASAP, so we can re-use the
 	 * first part of GGTT for WOPCM, prevent flickering, and prevent
@@ -263,6 +265,9 @@ static void plane_config_fini(struct intel_initial_plane_config *plane_config)
 		else
 			kfree(fb);
 	}
+
+	if (plane_config->vma)
+		drm_gem_object_put(&plane_config->vma->bo->ttm.base);
 }
 
 void intel_crtc_initial_plane_config(struct intel_crtc *crtc)
-- 
2.39.1



More information about the Intel-xe mailing list