Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com, rodrigo.vivi@intel.com,
	thomas.hellstrom@linux.intel.com, riana.tauro@intel.com,
	michal.wajdeczko@intel.com, matthew.d.roper@intel.com,
	michal.winiarski@intel.com, matthew.auld@intel.com,
	maarten@lankhorst.se, jani.nikula@intel.com,
	lukasz.laguna@intel.com, Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v3 02/10] drm/xe/hw_fence: Synchronize fence irq before destroying the job
Date: Sun,  8 Mar 2026 19:25:28 +0530	[thread overview]
Message-ID: <20260308135536.3852304-3-raag.jadav@intel.com> (raw)
In-Reply-To: <20260308135536.3852304-1-raag.jadav@intel.com>

We may need to cancel and destroy jobs while they are in-flight.
Make sure the irq work is synchronized when we do it.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
v3: Cancel in-flight jobs before FLR
---
 drivers/gpu/drm/xe/xe_hw_fence.c  | 5 +++++
 drivers/gpu/drm/xe/xe_hw_fence.h  | 1 +
 drivers/gpu/drm/xe/xe_sched_job.c | 1 +
 3 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c
index ae8ed15b64c5..c4e2b8e2648f 100644
--- a/drivers/gpu/drm/xe/xe_hw_fence.c
+++ b/drivers/gpu/drm/xe/xe_hw_fence.c
@@ -106,6 +106,11 @@ void xe_hw_fence_irq_run(struct xe_hw_fence_irq *irq)
 	irq_work_queue(&irq->work);
 }
 
+void xe_hw_fence_irq_sync(struct xe_hw_fence_irq *irq)
+{
+	irq_work_sync(&irq->work);
+}
+
 void xe_hw_fence_ctx_init(struct xe_hw_fence_ctx *ctx, struct xe_gt *gt,
 			  struct xe_hw_fence_irq *irq, const char *name)
 {
diff --git a/drivers/gpu/drm/xe/xe_hw_fence.h b/drivers/gpu/drm/xe/xe_hw_fence.h
index 599492c13f80..7ad64a515ae3 100644
--- a/drivers/gpu/drm/xe/xe_hw_fence.h
+++ b/drivers/gpu/drm/xe/xe_hw_fence.h
@@ -17,6 +17,7 @@ void xe_hw_fence_module_exit(void);
 void xe_hw_fence_irq_init(struct xe_hw_fence_irq *irq);
 void xe_hw_fence_irq_finish(struct xe_hw_fence_irq *irq);
 void xe_hw_fence_irq_run(struct xe_hw_fence_irq *irq);
+void xe_hw_fence_irq_sync(struct xe_hw_fence_irq *irq);
 
 void xe_hw_fence_ctx_init(struct xe_hw_fence_ctx *ctx, struct xe_gt *gt,
 			  struct xe_hw_fence_irq *irq, const char *name);
diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c
index 3927666fe556..d5f3f90e9061 100644
--- a/drivers/gpu/drm/xe/xe_sched_job.c
+++ b/drivers/gpu/drm/xe/xe_sched_job.c
@@ -175,6 +175,7 @@ void xe_sched_job_destroy(struct kref *ref)
 	struct xe_device *xe = job_to_xe(job);
 	struct xe_exec_queue *q = job->q;
 
+	xe_hw_fence_irq_sync(job->q->fence_irq);
 	xe_sched_job_free_fences(job);
 	dma_fence_put(job->fence);
 	drm_sched_job_cleanup(&job->drm);
-- 
2.43.0


  parent reply	other threads:[~2026-03-08 13:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-08 13:55 [PATCH v3 00/10] Introduce Xe PCIe FLR Raag Jadav
2026-03-08 13:55 ` [PATCH v3 01/10] drm/xe/uc_fw: Allow re-initializing firmware Raag Jadav
2026-03-08 13:55 ` Raag Jadav [this message]
2026-03-08 13:55 ` [PATCH v3 03/10] drm/xe/guc_submit: Support cancelling submission Raag Jadav
2026-03-13 15:37   ` Dong, Zhanjun
2026-03-15  9:58     ` Raag Jadav
2026-03-16  2:31       ` Matthew Brost
2026-03-08 13:55 ` [PATCH v3 04/10] drm/xe/gt: Introduce FLR helpers Raag Jadav
2026-03-08 13:55 ` [PATCH v3 05/10] drm/xe/irq: Introduce xe_irq_disable() Raag Jadav
2026-03-08 13:55 ` [PATCH v3 06/10] drm/xe: Introduce xe_device_assert_lmem_ready() Raag Jadav
2026-03-08 13:55 ` [PATCH v3 07/10] drm/xe/bo_evict: Introduce xe_bo_restore_map() Raag Jadav
2026-03-08 13:55 ` [PATCH v3 08/10] drm/xe/exec_queue: Introduce xe_exec_queue_reinit() Raag Jadav
2026-03-08 13:55 ` [PATCH v3 09/10] drm/xe/migrate: Introduce xe_migrate_reinit() Raag Jadav
2026-03-08 13:55 ` [PATCH v3 10/10] drm/xe/pci: Introduce PCIe FLR Raag Jadav
2026-03-08 14:08 ` ✗ CI.checkpatch: warning for Introduce Xe PCIe FLR (rev3) Patchwork
2026-03-08 14:09 ` ✓ CI.KUnit: success " Patchwork
2026-03-08 14:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-08 15:49 ` ✓ Xe.CI.FULL: " 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=20260308135536.3852304-3-raag.jadav@intel.com \
    --to=raag.jadav@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=maarten@lankhorst.se \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox