]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Revert "drm/xe: Skip exec queue schedule toggle if queue is idle during suspend"
authorTangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
Wed, 3 Jun 2026 06:52:15 +0000 (12:22 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 4 Jun 2026 13:03:57 +0000 (09:03 -0400)
This reverts commit 8533051ce92015e9cc6f75e0d52119b9d91610b6.

The idle-skip optimization bypasses GuC suspend, so the GPU may not
perform the context switch that flushes TLB entries for invalidated
userptr VMAs. In LR/preempt-fence VM mode, this can lead to missed TLB
invalidation and page faults during userptr invalidation tests.

Restore unconditional schedule toggling on suspend so the context-switch
TLB flush is always performed.

This optimization will be reintroduced with a fix that does not skip
suspend in LR/preempt-fence VM mode.

Fixes: 8533051ce920 ("drm/xe: Skip exec queue schedule toggle if queue is idle during suspend")
Cc: stable@vger.kernel.org # v7.0+
Suggested-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com>
Reviewed-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patch.msgid.link/20260603065217.3131066-2-tilak.tirumalesh.tangudu@intel.com
(cherry picked from commit 6a1e7934d9a6cf46aecae00a99c2603d1295e170)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_exec_queue.h
drivers/gpu/drm/xe/xe_guc_submit.c
drivers/gpu/drm/xe/xe_hw_engine_group.c

index a82d99bd77bcfb4a1034bbc7d911139cd8b33dd2..0225426c57b085451557b77c5ba00877d8690398 100644 (file)
@@ -162,21 +162,4 @@ int xe_exec_queue_contexts_hwsp_rebase(struct xe_exec_queue *q, void *scratch);
 struct xe_lrc *xe_exec_queue_lrc(struct xe_exec_queue *q);
 struct xe_lrc *xe_exec_queue_get_lrc(struct xe_exec_queue *q, u16 idx);
 
-/**
- * xe_exec_queue_idle_skip_suspend() - Can exec queue skip suspend
- * @q: The exec_queue
- *
- * If an exec queue is not parallel and is idle, the suspend steps can be
- * skipped in the submission backend immediatley signaling the suspend fence.
- * Parallel queues cannot skip this step due to limitations in the submission
- * backend.
- *
- * Return: True if exec queue is idle and can skip suspend steps, False
- * otherwise
- */
-static inline bool xe_exec_queue_idle_skip_suspend(struct xe_exec_queue *q)
-{
-       return !xe_exec_queue_is_parallel(q) && xe_exec_queue_is_idle(q);
-}
-
 #endif
index 912182dc77043a39aeedd02c83f4d3b49164abe3..3db627b56e11f4ae998640193a3c78fb5db91f20 100644 (file)
@@ -71,7 +71,6 @@ exec_queue_to_guc(struct xe_exec_queue *q)
 #define EXEC_QUEUE_STATE_WEDGED                        (1 << 8)
 #define EXEC_QUEUE_STATE_BANNED                        (1 << 9)
 #define EXEC_QUEUE_STATE_PENDING_RESUME                (1 << 10)
-#define EXEC_QUEUE_STATE_IDLE_SKIP_SUSPEND     (1 << 11)
 
 static bool exec_queue_registered(struct xe_exec_queue *q)
 {
@@ -218,21 +217,6 @@ static void clear_exec_queue_pending_resume(struct xe_exec_queue *q)
        atomic_and(~EXEC_QUEUE_STATE_PENDING_RESUME, &q->guc->state);
 }
 
-static bool exec_queue_idle_skip_suspend(struct xe_exec_queue *q)
-{
-       return atomic_read(&q->guc->state) & EXEC_QUEUE_STATE_IDLE_SKIP_SUSPEND;
-}
-
-static void set_exec_queue_idle_skip_suspend(struct xe_exec_queue *q)
-{
-       atomic_or(EXEC_QUEUE_STATE_IDLE_SKIP_SUSPEND, &q->guc->state);
-}
-
-static void clear_exec_queue_idle_skip_suspend(struct xe_exec_queue *q)
-{
-       atomic_and(~EXEC_QUEUE_STATE_IDLE_SKIP_SUSPEND, &q->guc->state);
-}
-
 static bool exec_queue_killed_or_banned_or_wedged(struct xe_exec_queue *q)
 {
        return (atomic_read(&q->guc->state) &
@@ -1153,7 +1137,7 @@ static void submit_exec_queue(struct xe_exec_queue *q, struct xe_sched_job *job)
        if (!job->restore_replay || job->last_replay) {
                if (xe_exec_queue_is_parallel(q))
                        wq_item_append(q);
-               else if (!exec_queue_idle_skip_suspend(q))
+               else
                        xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
                job->last_replay = false;
        }
@@ -1810,10 +1794,9 @@ static void __guc_exec_queue_process_msg_suspend(struct xe_sched_msg *msg)
 {
        struct xe_exec_queue *q = msg->private_data;
        struct xe_guc *guc = exec_queue_to_guc(q);
-       bool idle_skip_suspend = xe_exec_queue_idle_skip_suspend(q);
 
-       if (!idle_skip_suspend && guc_exec_queue_allowed_to_change_state(q) &&
-           !exec_queue_suspended(q) && exec_queue_enabled(q)) {
+       if (guc_exec_queue_allowed_to_change_state(q) && !exec_queue_suspended(q) &&
+           exec_queue_enabled(q)) {
                wait_event(guc->ct.wq, vf_recovery(guc) ||
                           ((q->guc->resume_time != RESUME_PENDING ||
                           xe_guc_read_stopped(guc)) && !exec_queue_pending_disable(q)));
@@ -1832,33 +1815,11 @@ static void __guc_exec_queue_process_msg_suspend(struct xe_sched_msg *msg)
                        disable_scheduling(q, false);
                }
        } else if (q->guc->suspend_pending) {
-               if (idle_skip_suspend)
-                       set_exec_queue_idle_skip_suspend(q);
                set_exec_queue_suspended(q);
                suspend_fence_signal(q);
        }
 }
 
-static void sched_context(struct xe_exec_queue *q)
-{
-       struct xe_guc *guc = exec_queue_to_guc(q);
-       struct xe_lrc *lrc = q->lrc[0];
-       u32 action[] = {
-               XE_GUC_ACTION_SCHED_CONTEXT,
-               q->guc->id,
-       };
-
-       xe_gt_assert(guc_to_gt(guc), !xe_exec_queue_is_parallel(q));
-       xe_gt_assert(guc_to_gt(guc), !exec_queue_destroyed(q));
-       xe_gt_assert(guc_to_gt(guc), exec_queue_registered(q));
-       xe_gt_assert(guc_to_gt(guc), !exec_queue_pending_disable(q));
-
-       trace_xe_exec_queue_submit(q);
-
-       xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
-       xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action), 0, 0);
-}
-
 static void __guc_exec_queue_process_msg_resume(struct xe_sched_msg *msg)
 {
        struct xe_exec_queue *q = msg->private_data;
@@ -1866,22 +1827,12 @@ static void __guc_exec_queue_process_msg_resume(struct xe_sched_msg *msg)
        if (guc_exec_queue_allowed_to_change_state(q)) {
                clear_exec_queue_suspended(q);
                if (!exec_queue_enabled(q)) {
-                       if (exec_queue_idle_skip_suspend(q)) {
-                               struct xe_lrc *lrc = q->lrc[0];
-
-                               clear_exec_queue_idle_skip_suspend(q);
-                               xe_lrc_set_ring_tail(lrc, lrc->ring.tail);
-                       }
                        q->guc->resume_time = RESUME_PENDING;
                        set_exec_queue_pending_resume(q);
                        enable_scheduling(q);
-               } else if (exec_queue_idle_skip_suspend(q)) {
-                       clear_exec_queue_idle_skip_suspend(q);
-                       sched_context(q);
                }
        } else {
                clear_exec_queue_suspended(q);
-               clear_exec_queue_idle_skip_suspend(q);
        }
 }
 
index 4c2b113364d33789c116c7e564409bc575b76cf6..02cf32ae5aa9a015ac36cfca8ca98a0c531d6974 100644 (file)
@@ -208,21 +208,15 @@ static int xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group
        lockdep_assert_held_write(&group->mode_sem);
 
        list_for_each_entry(q, &group->exec_queue_list, hw_engine_group_link) {
-               bool idle_skip_suspend;
 
                if (!xe_vm_in_fault_mode(q->vm))
                        continue;
 
-               idle_skip_suspend = xe_exec_queue_idle_skip_suspend(q);
-               if (!idle_skip_suspend && has_deps)
+               if (has_deps)
                        return -EAGAIN;
 
                xe_gt_stats_incr(q->gt, XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_COUNT, 1);
-               if (idle_skip_suspend)
-                       xe_gt_stats_incr(q->gt,
-                                        XE_GT_STATS_ID_HW_ENGINE_GROUP_SKIP_LR_QUEUE_COUNT, 1);
-
-               need_resume |= !idle_skip_suspend;
+               need_resume = true;
                q->ops->suspend(q);
                gt = q->gt;
        }