Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/vm: Cancel pending rebind work before freeing the VM
@ 2026-11-25 10:07 Arvind Yadav
  2026-11-25 11:25 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Arvind Yadav @ 2026-11-25 10:07 UTC (permalink / raw)
  To: intel-xe, dri-devel
  Cc: rodrigo.vivi, matthew.brost, himal.prasad.ghimiray,
	thomas.hellstrom, tejas.upadhyay

vm_destroy_work_func() runs on xe->destroy_wq and flushes rebind work
on xe->ordered_wq. The destroy queue has WQ_MEM_RECLAIM, but the
ordered queue has no rescuer. The kernel warns because this wait can
stall memory reclaim.

The VM is already closed, so a pending rebind would return immediately.
Use cancel_work_sync() to cancel pending work and wait for a running
rebind to finish before freeing the VM.

[  727.067318] ------------[ cut here ]------------
[  727.067552] workqueue: WQ_MEM_RECLAIM xe-destroy-wq:vm_destroy_work_func [xe] is flushing !WQ_MEM_RECLAIM xe-ordered-wq:preempt_rebind_work_func [xe]
[  727.067726] WARNING: kernel/workqueue.c:4043 at check_flush_dependency.part.0+0xd9/0x110, CPU#1: kworker/1:0/33641
[  727.067876] Workqueue: xe-destroy-wq vm_destroy_work_func [xe]
[  727.067963] Call Trace:
[  727.067964]  <TASK>
[  727.067967]  __flush_work+0x44b/0x660
[  727.067970]  ? __lock_acquire+0x584/0x29c0
[  727.067974]  ? lock_is_held_type+0xa3/0x130
[  727.067980]  flush_work+0x28/0x40
[  727.067982]  vm_destroy_work_func+0x1a9/0x350 [xe]
[  727.068061]  ? lock_release+0xd0/0x2c0
[  727.068065]  process_one_work+0x2ad/0x890
[  727.068071]  worker_thread+0x200/0x3f0
[  727.068074]  ? __pfx_worker_thread+0x10/0x10
[  727.068077]  kthread+0x113/0x150
[  727.068079]  ? __pfx_kthread+0x10/0x10
[  727.068081]  ret_from_fork+0x3bf/0x470
[  727.068085]  ? __pfx_kthread+0x10/0x10
[  727.068087]  ret_from_fork_asm+0x1a/0x30
[  727.068096]  </TASK>
[  727.068108] ---[ end trace 0000000000000000 ]---

Fixes: 61e18525023a ("drm/xe: Route deferred xe_vma/xe_vm teardown off system_dfl_wq")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Tejas Upadhyay <tejas.upadhyay@intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index dd855876f571..2ba99c083db8 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -2091,7 +2091,7 @@ static void vm_destroy_work_func(struct work_struct *w)
 	xe_assert(xe, !vm->size);
 
 	if (xe_vm_in_preempt_fence_mode(vm))
-		flush_work(&vm->preempt.rebind_work);
+		cancel_work_sync(&vm->preempt.rebind_work);
 
 	mutex_destroy(&vm->snap_mutex);
 
-- 
2.43.0


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

end of thread, other threads:[~2026-11-26  4:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 10:07 [PATCH] drm/xe/vm: Cancel pending rebind work before freeing the VM Arvind Yadav
2026-11-25 11:25 ` ✓ CI.KUnit: success for " Patchwork
2026-11-25 12:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-25 15:59 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-25 16:21 ` [PATCH] " Matthew Brost
2026-11-25 17:30   ` Matthew Brost
2026-11-26  4:43     ` Yadav, Arvind

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