[PATCH 3/4] drm/xe/guc: Protect queuing of G2H handler with fast lock

Matthew Brost matthew.brost at intel.com
Fri Dec 29 04:35:06 UTC 2023


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 at 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



More information about the Intel-xe mailing list