Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [PATCH 3/4] drm/xe/guc: Protect queuing of G2H handler with fast lock
Date: Thu, 28 Dec 2023 20:35:06 -0800	[thread overview]
Message-ID: <20231229043507.1002411-4-matthew.brost@intel.com> (raw)
In-Reply-To: <20231229043507.1002411-1-matthew.brost@intel.com>

Once CTs are disabled it is expected that the G2H handler will not be
queued again. To prevent the IRQ handler from racing with a disable,
guard the queuing of the G2H handler in the IRQ handler by the fast
lock.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_ct.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_guc_ct.h b/drivers/gpu/drm/xe/xe_guc_ct.h
index 214a6a357519..176301f58153 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.h
+++ b/drivers/gpu/drm/xe/xe_guc_ct.h
@@ -31,8 +31,13 @@ static inline bool xe_guc_ct_enabled(struct xe_guc_ct *ct)
 static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
 {
 	wake_up_all(&ct->wq);
+
+	/* Guard against CT being disabled */
+	spin_lock(&ct->fast_lock);
 	if (xe_guc_ct_enabled(ct))
 		queue_work(system_unbound_wq, &ct->g2h_worker);
+	spin_unlock(&ct->fast_lock);
+
 	xe_guc_ct_fast_path(ct);
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-12-29  4:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  4:35 [PATCH 0/4] GuC CT tweaks Matthew Brost
2023-12-29  4:35 ` [PATCH 1/4] drm/xe/guc: Add more GuC CT states Matthew Brost
2023-12-29 23:36   ` Michal Wajdeczko
2024-01-02 16:52     ` Matthew Brost
2023-12-29  4:35 ` [PATCH 2/4] drm/xe: Move TLB invalidation reset before HW reset Matthew Brost
2023-12-29  4:35 ` Matthew Brost [this message]
2023-12-29  4:35 ` [PATCH 4/4] drm/xe/guc: Flush G2H handler when turning off CTs Matthew Brost
2024-01-04  4:03 ` ✓ CI.Patch_applied: success for GuC CT tweaks Patchwork
2024-01-04  4:03 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-04  4:04 ` ✓ CI.KUnit: success " Patchwork
2024-01-04  4:11 ` ✓ CI.Build: " Patchwork
2024-01-04  4:12 ` ✓ CI.Hooks: " Patchwork
2024-01-04  4:13 ` ✓ CI.checksparse: " Patchwork
2024-01-04  4:48 ` ✓ CI.BAT: " 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=20231229043507.1002411-4-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.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