Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] drm/xe/guc: Fix wake_up race in handle_sched_done
@ 2026-08-26  9:33 Jakub Legowski
  2026-08-26  9:39 ` ✗ CI.checkpatch: warning for series starting with [v1,1/1] " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jakub Legowski @ 2026-08-26  9:33 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, maciej.patelczyk, Jakub Legowski

Move wake_up_all() after clear_exec_queue_pending_disable()

When a SCHED_DONE G2H arrives for a banned exec queue,
handle_sched_done() calls wake_up_all() before
clear_exec_queue_pending_disable(). This creates a race with the
wait_event_timeout() in guc_exec_queue_timedout_job() that waits
for pending_disable to be cleared:

    smp_rmb();
    ret = wait_event_timeout(guc->ct.wq,
                 ...
                 ...);

This was observed as:
[drm:guc_exec_queue_timedout_job [xe]] Tile0: GT0: Check job timeout: seqno=4294967169, lrc_seqno=4294967169, guc_id=4, running_time_ms=0, timeout_ms=5000, diff=0x00000001

Noving the wake_up_all() (along with its smp_wmb())
after all paths that clear pending_disable, ensuring that waiters
always observe the updated state when woken.

Same as for runnable_state == 1 in the beginning of
handle_sched_done().

Signed-off-by: Jakub Legowski <jakub.legowski@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 99d8c807ff05..2b86c2cde802 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -3239,10 +3239,6 @@ static void handle_sched_done(struct xe_guc *guc, struct xe_exec_queue *q,
 			clear_exec_queue_pending_disable(q);
 			suspend_fence_signal(q);
 		} else {
-			if (exec_queue_banned(q)) {
-				smp_wmb();
-				wake_up_all(&guc->ct.wq);
-			}
 			if (exec_queue_destroyed(q)) {
 				/*
 				 * Make sure to clear the pending_disable only
@@ -3258,6 +3254,11 @@ static void handle_sched_done(struct xe_guc *guc, struct xe_exec_queue *q,
 			} else {
 				clear_exec_queue_pending_disable(q);
 			}
+			if (exec_queue_banned(q)) {
+				/* Pairs with the smp_rmb() in guc_exec_queue_timedout_job() */
+				smp_wmb();
+				wake_up_all(&guc->ct.wq);
+			}
 		}
 	}
 }
-- 
2.48.1

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-26 11:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26  9:33 [PATCH v1 1/1] drm/xe/guc: Fix wake_up race in handle_sched_done Jakub Legowski
2026-08-26  9:39 ` ✗ CI.checkpatch: warning for series starting with [v1,1/1] " Patchwork
2026-08-26  9:40 ` ✓ CI.KUnit: success " Patchwork
2026-08-26  9:50 ` [PATCH v1 1/1] " sashiko-bot
2026-08-26 10:22 ` ✓ Xe.CI.BAT: success for series starting with [v1,1/1] " Patchwork
2026-08-26 11:39 ` ✗ Xe.CI.FULL: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox