On 19-11-2026 09:17, Matthew Brost wrote:
On Wed, Nov 18, 2026 at 01:38:30PM -0700, Summers, Stuart wrote:On Mon, 2026-11-16 at 15:50 +0530, Arvind Yadav wrote:The memory CAT error handler uses the same cleanup path as the context-reset handler. This immediately triggers the TDR, which can send a scheduling-disable request before the context-reset notification arrives.So as below - a CAT error is immediately followed by an engine reset G2H?On a BMG dGPU, an early disable after a CCS memory CAT error is associated with subsequent contexts being enabled but never starting work. Recovery occurs later when a scheduling-disable timeout triggers a GT reset. Separate waking user-fence waiters from triggering the TDR. On a memory CAT notification, mark the queue reset and wake waiters without starting the TDR. Keep the existing cleanup triggered by the context-reset notification. Leave the uncorrectable-error and CGP context-error paths unchanged. Tested on a BMG dGPU using a standalone SYCL reproducer with two separate processes. The first process submits a kernel that reads an unmapped GPU address, causing a page fault followed by a memory CAT error. It then calls abort() without waiting for the kernel to finish. After that process exits, a second process, called "victim", starts. It submits a simple kernel that writes 7 to a device allocation, copies the value back to the CPU and checks the result. Without the patch, the victim can hang and reach its 60-second userspace timeout. With the patch, the victim completed and returned the expected value in all tested rounds where the first process triggered the fault. Recovery without a context-reset notification still needs confirmation, particularly for LR queues, which have no normal finite job timeout. Independent queue-kill and cleanup paths are unchanged. Cc: Matthew Brost <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Himal Prasad Ghimiray <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Tejas Upadhyay <[email protected]> Assisted-by: LLMFixes: ...Signed-off-by: Arvind Yadav <[email protected]>This isn't right... I'm not clear on what problem we're trying to solve here. Is it that the engine reset happening after CAT error is takingI'm little unclear too. I haven't looked in depth - but are we saying every CAT error is also followed by an engine reset? iirc - that is some GuC klv option. If we always get a CAT error + engine reset G2H - this patch is generally ok, but TBH as with Stuart I'm a little confused what exactly the problem is here but Arvind appears to have data back to this up, perhaps a GuC or HW quirk. Assuming this some quirk, I'd say we get in this into the GuC spec if has programming flows section.too long? And where is the schedule disable originating? If it's partThe schedule disable originates from the TDR.of the TDR that means we likely want to re-arrange the TDR sequence rather than just skip it.Well the TDR can't signal any fences (this is the job of TDR) until a schedule disable returns to avoid any possible memory corruption which infinitely worse than a long hang as that can take down the OS.Engine reset is required after a CAT error to recover and the driver is doing that as part of this flow (vs an engine reset due to a preemption failure which originates from GuC and the driver just reacts to that).Right, iirc we always get a engine reset after CAT error - but my assumption was schedule disable from the TDR was the source of the engine reset, not from the CAT error. So TL;DR, I think this patch is fine with a bit more explaination and possible GuC spec follow up.
Hi Stuart and Matt,The issue in GSD-14189 is that the next application hangs after the faulting process exits. On BMG the first process hits a CCS memory CAT error. The CAT handler queues TDR and guc_exec_queue_timedout_job() sends a scheduling disable for the faulting queue.
In the failing trace GuC acknowledges the disable and deregisters the queue. It then acknowledges enabling the queue for the next process. The first job on that queue never starts. The process reaches its 60-second userspace timeout. During teardown the disable for this second queue times out and Xe requests a GT reset. The reset itself took about 13 ms. Most of the delay was spent waiting before the reset.
During debugging I found that the next process hung when Xe sent the first disable 11 to 18 µs after the CAT. In a round where Xe sent it 1.5ms later we saw a reset G2H and the next process completed. I then delayed only the first disable by 5 ms and the next process passed all 100 runs. In a separate test v1 also passed 100/100 with no added delay. It removed the immediate TDR kick from the CAT handler.
This points to the timing of the first disable. It does not tell us whether GuC had already started the engine reset or whether the disable triggered it. I have not confirmed that every CAT produces a reset G2H. I will check the order of the reset G2H and the first disable for the same queue and follow up on whether it depends on a GuC KLV.
I agree that a CAT alone does not mean the context has stopped. I will keep CAT pending separate from RESET and preserve the disable acknowledgement before TDR signals job fences.
Please let me know if you see a better way to handle this issue. Thanks, Arvind
MattThanks, Stuart--- drivers/gpu/drm/xe/xe_guc_submit.c | 50 ++++++++++++++++++++++------ -- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c index d76f125f9c3a..aa382634a235 100644 --- a/drivers/gpu/drm/xe/xe_guc_submit.c +++ b/drivers/gpu/drm/xe/xe_guc_submit.c @@ -557,17 +557,39 @@ static bool vf_recovery(struct xe_guc *guc) return xe_gt_recovery_pending(guc_to_gt(guc)); }-static void xe_guc_exec_queue_trigger_cleanup(struct xe_exec_queue*q) +static void xe_guc_exec_queue_wake_ufence(struct xe_exec_queue *q) { struct xe_guc *guc = exec_queue_to_guc(q); struct xe_device *xe = guc_to_xe(guc);/** to wakeup xe_wait_user_fence ioctl if exec queue is reset*/ wake_up_all(&xe->ufence_wq); +} + +static void xe_guc_exec_queue_trigger_cleanup(struct xe_exec_queue *q) +{ + xe_guc_exec_queue_wake_ufence(q);xe_sched_tdr_queue_imm(&q->guc->sched);}+/*+ * Allow callers to wake user-fence waiters without triggering the TDR. + * The memory CAT handler uses this to avoid starting cleanup before + * the context-reset notification arrives. + */ +static void xe_queue_trigger_cleanup_for_reset(struct xe_exec_queue *q, + bool trigger_tdr) +{ + if (exec_queue_banned(q)) + return; + + if (trigger_tdr) + xe_guc_exec_queue_trigger_cleanup(q); + else + xe_guc_exec_queue_wake_ufence(q); +} + static void xe_guc_exec_queue_group_stop(struct xe_exec_queue *q) { struct xe_exec_queue *primary = xe_exec_queue_multi_queue_primary(q); @@ -653,7 +675,8 @@ static void xe_guc_exec_queue_group_trigger_cleanup(struct xe_exec_queue *q) mutex_unlock(&group->list_lock); }-static void xe_guc_exec_queue_reset_trigger_cleanup(structxe_exec_queue *q) +static void xe_guc_exec_queue_reset_trigger_cleanup(struct xe_exec_queue *q, + bool trigger_tdr) { if (xe_exec_queue_is_multi_queue(q)) { struct xe_exec_queue *primary = xe_exec_queue_multi_queue_primary(q); @@ -664,20 +687,17 @@ static void xe_guc_exec_queue_reset_trigger_cleanup(struct xe_exec_queue *q) WRITE_ONCE(group->banned, true);set_exec_queue_reset(primary);- if (!exec_queue_banned(primary)) - xe_guc_exec_queue_trigger_cleanup(primary); + xe_queue_trigger_cleanup_for_reset(primary, trigger_tdr);mutex_lock(&group->list_lock);list_for_each_entry(eq, &group->list, multi_queue.link) { set_exec_queue_reset(eq); - if (!exec_queue_banned(eq)) - xe_guc_exec_queue_trigger_cleanup(eq); + xe_queue_trigger_cleanup_for_reset(eq, trigger_tdr); } mutex_unlock(&group->list_lock); } else { set_exec_queue_reset(q); - if (!exec_queue_banned(q)) - xe_guc_exec_queue_trigger_cleanup(q); + xe_queue_trigger_cleanup_for_reset(q, trigger_tdr); } }@@ -3523,7 +3543,7 @@ int xe_guc_exec_queue_reset_handler(structxe_guc *guc, u32 *msg, u32 len) * jobs by setting timeout of the job to the minimum value kicking * guc_exec_queue_timedout_job. */ - xe_guc_exec_queue_reset_trigger_cleanup(q); + xe_guc_exec_queue_reset_trigger_cleanup(q, true);return 0;} @@ -3601,8 +3621,12 @@ int xe_guc_exec_queue_memory_cat_error_handler(struct xe_guc *guc, u32 *msg,trace_xe_exec_queue_memory_cat_error(q); - /* Treat the same as engine reset */- xe_guc_exec_queue_reset_trigger_cleanup(q); + /* + * Starting the TDR here can send a scheduling-disable request before + * the context-reset notification arrives. Mark the queue reset and + * wake user-fence waiters, leaving that notification to trigger cleanup. + */ + xe_guc_exec_queue_reset_trigger_cleanup(q, false);return 0;} @@ -3644,7 +3668,7 @@ int xe_guc_uncorrectable_error_handler(struct xe_guc *guc, u32 *msg, u32 len) trace_xe_guc_uncorrectable_error(q);/* Treat the same as engine reset */- xe_guc_exec_queue_reset_trigger_cleanup(q); + xe_guc_exec_queue_reset_trigger_cleanup(q, true);return 0;} @@ -3696,7 +3720,7 @@ int xe_guc_exec_queue_cgp_context_error_handler(struct xe_guc *guc, u32 *msg, trace_xe_exec_queue_cgp_context_error(q);/* Treat the same as engine reset */- xe_guc_exec_queue_reset_trigger_cleanup(q); + xe_guc_exec_queue_reset_trigger_cleanup(q, true);return 0;}
