Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>, stable@vger.kernel.org
Subject: [PATCH 1/2] drm/xe/vm: move rebind_work init earlier
Date: Wed, 14 May 2025 16:24:25 +0100	[thread overview]
Message-ID: <20250514152424.149591-3-matthew.auld@intel.com> (raw)

In xe_vm_close_and_put() we need to be able to call
flush_work(rebind_work), however during vm creation we can call this on
the error path, before having actually set up the worker, leading to a
splat from flush_work().

It looks like we can simply move the worker init step earlier to fix
this.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
---
 drivers/gpu/drm/xe/xe_vm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 5a978da411b0..168756fb140b 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1704,8 +1704,10 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 	 * scheduler drops all the references of it, hence protecting the VM
 	 * for this case is necessary.
 	 */
-	if (flags & XE_VM_FLAG_LR_MODE)
+	if (flags & XE_VM_FLAG_LR_MODE) {
+		INIT_WORK(&vm->preempt.rebind_work, preempt_rebind_work_func);
 		xe_pm_runtime_get_noresume(xe);
+	}
 
 	vm_resv_obj = drm_gpuvm_resv_object_alloc(&xe->drm);
 	if (!vm_resv_obj) {
@@ -1750,10 +1752,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 		vm->batch_invalidate_tlb = true;
 	}
 
-	if (vm->flags & XE_VM_FLAG_LR_MODE) {
-		INIT_WORK(&vm->preempt.rebind_work, preempt_rebind_work_func);
+	if (vm->flags & XE_VM_FLAG_LR_MODE)
 		vm->batch_invalidate_tlb = false;
-	}
 
 	/* Fill pt_root after allocating scratch tables */
 	for_each_tile(tile, xe, id) {
-- 
2.49.0


             reply	other threads:[~2025-05-14 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 15:24 Matthew Auld [this message]
2025-05-14 15:24 ` [PATCH 2/2] drm/xe/vm: move xe_svm_init() earlier Matthew Auld
2025-05-15  0:08   ` Matthew Brost
2025-05-14 23:46 ` ✓ CI.Patch_applied: success for series starting with [1/2] drm/xe/vm: move rebind_work init earlier Patchwork
2025-05-14 23:46 ` ✓ CI.checkpatch: " Patchwork
2025-05-14 23:47 ` ✓ CI.KUnit: " Patchwork
2025-05-14 23:58 ` ✓ CI.Build: " Patchwork
2025-05-15  0:00 ` ✓ CI.Hooks: " Patchwork
2025-05-15  0:01 ` [PATCH 1/2] " Matthew Brost
2025-05-15  0:02 ` ✓ CI.checksparse: success for series starting with [1/2] " Patchwork
2025-05-15  0:24 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-15  9:23 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-27  1:16 ` ✓ CI.Patch_applied: success " Patchwork
2025-05-27  1:16 ` ✓ CI.checkpatch: " Patchwork
2025-05-27  1:17 ` ✓ CI.KUnit: " Patchwork
2025-05-27  1:28 ` ✓ CI.Build: " Patchwork

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=20250514152424.149591-3-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox