intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Summers <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org, matthew.brost@intel.com,
	farah.kassabri@intel.com,
	Stuart Summers <stuart.summers@intel.com>
Subject: [PATCH 2/9] drm/xe: Cancel pending TLB inval workers on teardown
Date: Mon, 25 Aug 2025 17:57:14 +0000	[thread overview]
Message-ID: <20250825175721.89129-3-stuart.summers@intel.com> (raw)
In-Reply-To: <20250825175721.89129-1-stuart.summers@intel.com>

Add a new _fini() routine on the GT TLB invalidation
side to handle this worker cleanup on driver teardown.

v2: Move the TLB teardown to the gt fini() routine called during
    gt_init rather than in gt_alloc. This way the GT structure stays
    alive for while we reset the TLB state.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_gt.c                  |  2 ++
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 12 ++++++++++++
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h |  1 +
 3 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index a3397f04abcc..178c4783bbda 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -603,6 +603,8 @@ static void xe_gt_fini(void *arg)
 	struct xe_gt *gt = arg;
 	int i;
 
+	xe_gt_tlb_invalidation_fini(gt);
+
 	for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
 		xe_hw_fence_irq_finish(&gt->fence_irq[i]);
 
diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
index 75854b963d66..db00c5adead9 100644
--- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
+++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
@@ -188,6 +188,18 @@ void xe_gt_tlb_invalidation_reset(struct xe_gt *gt)
 	mutex_unlock(&gt->tlb_invalidation.seqno_lock);
 }
 
+/**
+ *
+ * xe_gt_tlb_invalidation_fini - Clean up GT TLB invalidation state
+ *
+ * Cancel pending fence workers and clean up any additional
+ * GT TLB invalidation state.
+ */
+void xe_gt_tlb_invalidation_fini(struct xe_gt *gt)
+{
+	xe_gt_tlb_invalidation_reset(gt);
+}
+
 static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno)
 {
 	int seqno_recv = READ_ONCE(gt->tlb_invalidation.seqno_recv);
diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
index f7f0f2eaf4b5..3e4cff3922d6 100644
--- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
+++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h
@@ -16,6 +16,7 @@ struct xe_vm;
 struct xe_vma;
 
 int xe_gt_tlb_invalidation_init_early(struct xe_gt *gt);
+void xe_gt_tlb_invalidation_fini(struct xe_gt *gt);
 
 void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
 int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);
-- 
2.34.1


  parent reply	other threads:[~2025-08-25 17:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 17:57 [PATCH 0/9] Add TLB invalidation abstraction Stuart Summers
2025-08-25 17:57 ` [PATCH 1/9] drm/xe: Move explicit CT lock in TLB invalidation sequence Stuart Summers
2025-08-25 17:57 ` Stuart Summers [this message]
2025-08-25 18:06   ` [PATCH 2/9] drm/xe: Cancel pending TLB inval workers on teardown Summers, Stuart
2025-08-25 18:20     ` Matthew Brost
2025-08-25 18:23       ` Summers, Stuart
2025-08-25 18:32         ` Summers, Stuart
2025-08-25 17:57 ` [PATCH 3/9] drm/xe: s/tlb_invalidation/tlb_inval Stuart Summers
2025-08-25 17:57 ` [PATCH 4/9] drm/xe: Add xe_tlb_inval structure Stuart Summers
2025-08-25 17:57 ` [PATCH 5/9] drm/xe: Add xe_gt_tlb_invalidation_done_handler Stuart Summers
2025-08-25 17:57 ` [PATCH 6/9] drm/xe: Decouple TLB invalidations from GT Stuart Summers
2025-08-25 17:57 ` [PATCH 7/9] drm/xe: Prep TLB invalidation fence before sending Stuart Summers
2025-08-25 17:57 ` [PATCH 8/9] drm/xe: Add helpers to send TLB invalidations Stuart Summers
2025-08-25 17:57 ` [PATCH 9/9] drm/xe: Split TLB invalidation code in frontend and backend Stuart Summers
2025-08-25 19:09 ` ✗ CI.checkpatch: warning for Add TLB invalidation abstraction (rev9) Patchwork
2025-08-25 19:10 ` ✓ CI.KUnit: success " Patchwork
2025-08-25 20:09 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-26  6:18 ` ✓ Xe.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-08-26 18:29 [PATCH 0/9] Add TLB invalidation abstraction Stuart Summers
2025-08-26 18:29 ` [PATCH 2/9] drm/xe: Cancel pending TLB inval workers on teardown Stuart Summers
2025-08-20 23:30 [PATCH 0/9] Add TLB invalidation abstraction Stuart Summers
2025-08-20 23:30 ` [PATCH 2/9] drm/xe: Cancel pending TLB inval workers on teardown Stuart Summers
2025-08-21 22:13   ` Matthew Brost
2025-08-21 23:34     ` Summers, Stuart
2025-08-22  2:21       ` Matthew Brost
2025-08-22 14:57         ` Summers, Stuart
2025-08-20 22:45 [PATCH 0/9] Add TLB invalidation abstraction Stuart Summers
2025-08-20 22:45 ` [PATCH 2/9] drm/xe: Cancel pending TLB inval workers on teardown Stuart Summers

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=20250825175721.89129-3-stuart.summers@intel.com \
    --to=stuart.summers@intel.com \
    --cc=farah.kassabri@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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;
as well as URLs for NNTP newsgroup(s).