Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Nguyen <brian3.nguyen@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: tejas.upadhyay@intel.com, matthew.brost@intel.com,
	shuicheng.lin@intel.com, stuart.summers@intel.com
Subject: [PATCH v2 02/11] drm/xe: Reset tlb fence timeout on invalid seqno received
Date: Thu, 27 Nov 2025 07:02:03 +0800	[thread overview]
Message-ID: <20251126230201.3782788-15-brian3.nguyen@intel.com> (raw)
In-Reply-To: <20251126230201.3782788-13-brian3.nguyen@intel.com>

TLB_INVALIDATION_SEQNO_INVALID are now used to indicate in progress
multi-step TLB invalidations, so reset tdr to ensure that action
won't prematurely trigger when G2H actions are still ongoing.

v2: Remove lock from xe_tlb_inval_reset_timeout. (Matthew B)

Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_tlb_inval.c |  3 +--
 drivers/gpu/drm/xe/xe_tlb_inval.c     | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
index f10ecfb49735..848d3493df10 100644
--- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
+++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
@@ -234,8 +234,7 @@ int xe_guc_tlb_inval_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
 	if (unlikely(len != 1))
 		return -EPROTO;
 
-	if (msg[0] != TLB_INVALIDATION_SEQNO_INVALID)
-		xe_tlb_inval_done_handler(&gt->tlb_inval, msg[0]);
+	xe_tlb_inval_done_handler(&gt->tlb_inval, msg[0]);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/xe/xe_tlb_inval.c b/drivers/gpu/drm/xe/xe_tlb_inval.c
index 918a59e686ea..a122fbb9fc4a 100644
--- a/drivers/gpu/drm/xe/xe_tlb_inval.c
+++ b/drivers/gpu/drm/xe/xe_tlb_inval.c
@@ -199,6 +199,20 @@ void xe_tlb_inval_reset(struct xe_tlb_inval *tlb_inval)
 	mutex_unlock(&tlb_inval->seqno_lock);
 }
 
+/**
+ * xe_tlb_inval_reset_timeout() - Reset TLB inval fence timeout
+ * @tlb_inval: TLB invalidation client
+ *
+ * Reset the TLB invalidation timeout timer.
+ */
+static void xe_tlb_inval_reset_timeout(struct xe_tlb_inval *tlb_inval)
+{
+	lockdep_assert_held(&tlb_inval->pending_lock);
+
+	mod_delayed_work(system_wq, &tlb_inval->fence_tdr,
+			 tlb_inval->ops->timeout_delay(tlb_inval));
+}
+
 static bool xe_tlb_inval_seqno_past(struct xe_tlb_inval *tlb_inval, int seqno)
 {
 	int seqno_recv = READ_ONCE(tlb_inval->seqno_recv);
@@ -360,6 +374,12 @@ void xe_tlb_inval_done_handler(struct xe_tlb_inval *tlb_inval, int seqno)
 	 * process_g2h_msg().
 	 */
 	spin_lock_irqsave(&tlb_inval->pending_lock, flags);
+	if (seqno == TLB_INVALIDATION_SEQNO_INVALID) {
+		xe_tlb_inval_reset_timeout(tlb_inval);
+		spin_unlock_irqrestore(&tlb_inval->pending_lock, flags);
+		return;
+	}
+
 	if (xe_tlb_inval_seqno_past(tlb_inval, seqno)) {
 		spin_unlock_irqrestore(&tlb_inval->pending_lock, flags);
 		return;
-- 
2.52.0


  parent reply	other threads:[~2025-11-26 23:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 23:02 [PATCH v2 00/11] Page Reclamation Support for Xe3p Platforms Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 01/11] [DO, NOT, REVIEW] drm/xe: Do not forward invalid TLB invalidation seqnos to upper layers Brian Nguyen
2025-11-26 23:02 ` Brian Nguyen [this message]
2025-12-02 22:24   ` [PATCH v2 02/11] drm/xe: Reset tlb fence timeout on invalid seqno received Matthew Brost
2025-11-26 23:02 ` [PATCH v2 03/11] drm/xe/xe_tlb_inval: Modify fence interface to support PPC flush Brian Nguyen
2025-12-02 22:18   ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 04/11] drm/xe: Add page reclamation info to device info Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 05/11] drm/xe/guc: Add page reclamation interface to GuC Brian Nguyen
2025-12-02 22:21   ` Matthew Brost
2025-12-03  0:17   ` Lin, Shuicheng
2025-11-26 23:02 ` [PATCH v2 06/11] drm/xe: Create page reclaim list on unbind Brian Nguyen
2025-12-01 21:45   ` Nguyen, Brian3
2025-12-03 22:56   ` Matthew Brost
2025-12-04  0:19     ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 07/11] drm/xe: Suballocate BO for page reclaim Brian Nguyen
2025-12-03 23:06   ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 08/11] drm/xe: Prep page reclaim in tlb inval job Brian Nguyen
2025-12-03 23:13   ` Matthew Brost
2025-12-04  0:22     ` Nguyen, Brian3
2025-12-04  1:20       ` Matthew Brost
2025-12-04  5:42         ` Nguyen, Brian3
2025-12-04 18:05           ` Matthew Brost
2025-12-04 20:02             ` Nguyen, Brian3
2025-12-09  5:57       ` Upadhyay, Tejas
2025-12-09  6:14         ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 09/11] drm/xe: Append page reclamation action to tlb inval Brian Nguyen
2025-12-03 23:15   ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 10/11] drm/xe: Optimize flushing of L2$ by skipping unnecessary page reclaim Brian Nguyen
2025-12-09 14:23   ` Upadhyay, Tejas
2025-11-26 23:02 ` [PATCH v2 11/11] drm/xe: Add debugfs support for page reclamation Brian Nguyen
2025-12-02 22:28   ` Matthew Brost
2025-12-02 22:51     ` Nguyen, Brian3
2025-12-02 22:59       ` Matthew Brost
2025-12-05 18:02   ` Lin, Shuicheng
2025-11-26 23:52 ` ✗ CI.checkpatch: warning for Page Reclamation Support for Xe3p Platforms (rev2) Patchwork
2025-11-26 23:54 ` ✓ CI.KUnit: success " Patchwork
2025-11-27  0:54 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-11-27  1:42 ` ✗ 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=20251126230201.3782788-15-brian3.nguyen@intel.com \
    --to=brian3.nguyen@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=tejas.upadhyay@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