On Wed, Nov 25, 2026 at 03:37:44PM +0530, Arvind Yadav wrote:
> 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 <[email protected]>
> Cc: Thomas Hellström <[email protected]>
> Cc: Rodrigo Vivi <[email protected]>
> Cc: Himal Prasad Ghimiray <[email protected]>
> Cc: Tejas Upadhyay <[email protected]>
> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> 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);
disable_work_sync ?
Matt
>
> mutex_destroy(&vm->snap_mutex);
>
> --
> 2.43.0
>