Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Shuicheng Lin <shuicheng.lin@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe/guc: Destroy LR exec queue directly if GuC is not running
Date: Wed, 15 Oct 2025 20:24:34 -0700	[thread overview]
Message-ID: <aPBlcnzi1a3rUZ9m@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251014033646.1619865-2-shuicheng.lin@intel.com>

On Tue, Oct 14, 2025 at 03:36:47AM +0000, Shuicheng Lin wrote:
> During LR exec queue cleanup, if the GuC firmware is not running,
> the driver cannot communicate with the GuC to properly deregister
> the exec queue. In this case, directly destroy the exec queue
> instead of attempting deregistration.
> 
> This prevents schedule disable failure and GuC ID resource leaks as
> below dmesg log:
> "
> [   50.242564] pci 0000:03:00.0: [drm] GT0: Schedule disable failed to respond, guc_id=2
> [   50.242568] ------------[ cut here ]------------
> [   50.242584] pci 0000:03:00.0: [drm] Assertion `ret` failed!
> ...
> [   50.244942] pci 0000:03:00.0: [drm] *ERROR* GT0: GUC ID manager unclean (1/65535)
> [   50.244970] pci 0000:03:00.0: [drm] GT0:     total 65535
> [   50.245002] pci 0000:03:00.0: [drm] GT0:     used 1
> [   50.245032] pci 0000:03:00.0: [drm] GT0:     range 2..2 (1)
> "
> 
> Fixes: 8ae8a2e8dd21 ("drm/xe: Long running job update")
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 0ef67d3523a7..d2dfbdc82920 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -47,6 +47,8 @@
>  #include "xe_uc_fw.h"
>  #include "xe_vm.h"
>  
> +static void __guc_exec_queue_destroy(struct xe_guc *guc, struct xe_exec_queue *q);
> +
>  static struct xe_guc *
>  exec_queue_to_guc(struct xe_exec_queue *q)
>  {
> @@ -1060,10 +1062,15 @@ static void xe_guc_exec_queue_lr_cleanup(struct work_struct *w)
>  	 * state.
>  	 */
>  	if (!wedged && exec_queue_registered(q) && !exec_queue_destroyed(q)) {
> -		struct xe_guc *guc = exec_queue_to_guc(q);
>  		int ret;
>  
>  		set_exec_queue_banned(q);
> +		/* If GuC is not running, just destroy the exec queue as we can't communicate with it */
> +		if (!xe_uc_fw_is_running(&guc->fw)) {
> +			__guc_exec_queue_destroy(guc, q);
> +			goto skip_deregister;
> +		}
> +

I want to rework LR queues to use the normal TDR / refcounting scheme.

I don't really like a direct destroy here as it can invert or we have
have dangling refs to queue here.

So I'd say live with this until I rework this.

Matt

>  		disable_scheduling_deregister(guc, q);
>  
>  		/*
> @@ -1088,6 +1095,7 @@ static void xe_guc_exec_queue_lr_cleanup(struct work_struct *w)
>  		}
>  	}
>  
> +skip_deregister:
>  	if (!exec_queue_killed(q) && !xe_lrc_ring_is_idle(q->lrc[0]))
>  		xe_devcoredump(q, NULL, "LR job cleanup, guc_id=%d", q->guc->id);
>  
> -- 
> 2.49.0
> 

  parent reply	other threads:[~2025-10-16  3:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  3:36 [PATCH] drm/xe/guc: Destroy LR exec queue directly if GuC is not running Shuicheng Lin
2025-10-14  4:28 ` ✗ CI.checkpatch: warning for " Patchwork
2025-10-14  4:29 ` ✓ CI.KUnit: success " Patchwork
2025-10-14  5:08 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-14 12:53 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-15 17:07 ` [PATCH] " Lin, Shuicheng
2025-10-15 18:01   ` Summers, Stuart
2025-10-15 18:11     ` Lin, Shuicheng
2025-10-15 18:15       ` Summers, Stuart
2025-10-15 18:02 ` Daniele Ceraolo Spurio
2025-10-15 21:07   ` Lin, Shuicheng
2025-10-16  3:24 ` Matthew Brost [this message]
2025-10-16 14:51   ` Lin, Shuicheng

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=aPBlcnzi1a3rUZ9m@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=shuicheng.lin@intel.com \
    /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