Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/xe/bo: Fix async BO free teardown deadlock
@ 2026-11-23  4:56 Sanjay Yadav
  2026-11-23  4:56 ` [PATCH 1/2] drm/xe/bo: Fix self-flush deadlock in async BO free Sanjay Yadav
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sanjay Yadav @ 2026-11-23  4:56 UTC (permalink / raw)
  To: intel-xe

The async BO free worker can drop the last drm_device reference when
freeing a page-table BO (BO -> VM -> drm_gpuvm_free() -> drm_dev_put()).
Device teardown then runs from the worker and xe_bo_dev_fini() flushes
the work it is running on, deadlocking.

  WARNING: possible recursive locking detected
  kworker/7:0/50249 is trying to acquire lock:
  ((work_completion)(&bo_dev->async_free)), at: __flush_work+0x25d/0x640
  but task is already holding lock:
  ((work_completion)(&bo_dev->async_free)), at: process_one_work+0x26d/0x890
  ...
  Workqueue: events xe_bo_dev_work_func [xe]
  Call Trace:
   flush_work+0x2d/0x40
   xe_bo_dev_fini+0xe/0x20 [xe]
   xe_device_destroy+0x19/0xa0 [xe]
   drm_managed_release+0x8b/0x170
   drm_dev_put+0x69/0x90
   drm_gpuvm_free+0xc2/0x2e0 [drm_gpuvm]
   drm_gpuvm_put+0x48/0x80 [drm_gpuvm]
   xe_ttm_bo_destroy+0xfa/0x320 [xe]
   ttm_bo_release+0x70/0x310 [ttm]
   ttm_bo_fini+0x3c/0x70 [ttm]
   xe_gem_object_free+0x1a/0x30 [xe]
   drm_gem_object_free+0x1d/0x40
   xe_bo_dev_work_func+0x3a/0x60 [xe]
   process_one_work+0x2ad/0x890
   worker_thread+0x200/0x3f0

Patch 1 fixes the deadlock by holding a device reference in the worker
and not self-flushing from xe_bo_dev_fini().

Patch 2 moves the work to the module-lifetime xe_destroy_wq, so module
unload cannot free the xe text while the worker is still finishing a
teardown it triggered.

Sanjay Yadav (2):
  drm/xe/bo: Fix self-flush deadlock in async BO free
  drm/xe/bo: Queue async BO free on the module-lifetime destroy wq

 drivers/gpu/drm/xe/xe_bo.c     | 20 +++++++++++++++++++-
 drivers/gpu/drm/xe/xe_bo.h     |  3 ++-
 drivers/gpu/drm/xe/xe_module.c |  5 +++--
 drivers/gpu/drm/xe/xe_pt.c     |  2 +-
 4 files changed, 25 insertions(+), 5 deletions(-)

-- 
2.52.0


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

end of thread, other threads:[~2026-11-23  5:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23  4:56 [PATCH 0/2] drm/xe/bo: Fix async BO free teardown deadlock Sanjay Yadav
2026-11-23  4:56 ` [PATCH 1/2] drm/xe/bo: Fix self-flush deadlock in async BO free Sanjay Yadav
2026-11-23  5:41   ` sashiko-bot
2026-11-23  4:56 ` [PATCH 2/2] drm/xe/bo: Queue async BO free on the module-lifetime destroy wq Sanjay Yadav
2026-11-23  5:20 ` ✗ CI.KUnit: failure for drm/xe/bo: Fix async BO free teardown deadlock (rev2) Patchwork

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