All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav@intel.com>
To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: rodrigo.vivi@intel.com, matthew.brost@intel.com,
	himal.prasad.ghimiray@intel.com,
	thomas.hellstrom@linux.intel.com, tejas.upadhyay@intel.com
Subject: [PATCH] drm/xe/vm: Cancel pending rebind work before freeing the VM
Date: Wed, 25 Nov 2026 15:37:44 +0530	[thread overview]
Message-ID: <20261125100744.1440957-1-arvind.yadav@intel.com> (raw)

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


             reply	other threads:[~2026-11-25 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 10:07 Arvind Yadav [this message]
2026-11-25 11:25 ` ✓ CI.KUnit: success for drm/xe/vm: Cancel pending rebind work before freeing the VM 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125100744.1440957-1-arvind.yadav@intel.com \
    --to=arvind.yadav@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tejas.upadhyay@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.