All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Sk Anirban <sk.anirban@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
	<badal.nilawar@intel.com>, <riana.tauro@intel.com>,
	<karthik.poosa@intel.com>, <raag.jadav@intel.com>,
	<soham.purkait@intel.com>,  <mallesh.koujalagi@intel.com>,
	<vinay.belgaumkar@intel.com>, <michal.wajdeczko@intel.com>
Subject: Re: [PATCH v2 1/2] drm/xe/guc: distinguish wedged from recoverable cancellation
Date: Tue, 30 Jun 2026 07:27:58 -0700	[thread overview]
Message-ID: <akPSbhNTu9iMA4J1@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260624194618.2793571-5-sk.anirban@intel.com>

On Thu, Jun 25, 2026 at 01:16:20AM +0530, Sk Anirban wrote:
> The CT layer returns -ECANCELED regardless of whether cancellation
> is due to a GT reset or a wedged device. Return -ENOTRECOVERABLE
> on wedge so callers don't need xe_device_wedged() checks
> to suppress spurious error logs.
> Also document the return codes of xe_guc_ct_send() in kernel-doc form.
> 
> v2: Fix -ECANCELED description (Matt)
> 
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_ct.c | 40 +++++++++++++++++++++++++++++++++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 21e0dad9a481..8ca7d37c79b6 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1065,6 +1065,11 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
>  	xe_gt_assert(gt, g2h_len || !num_g2h);
>  	lockdep_assert_held(&ct->lock);
>  
> +	if (xe_device_wedged(ct_to_xe(ct))) {
> +		ret = -ENOTRECOVERABLE;
> +		goto out;
> +	}
> +
>  	if (unlikely(ct->ctbs.h2g.info.broken)) {
>  		ret = -EPIPE;
>  		goto out;
> @@ -1236,6 +1241,36 @@ static int guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
>  	return ret;
>  }
>  
> +/**
> + * xe_guc_ct_send - Send an HXG message to the GuC over CT
> + * @ct: the &xe_guc_ct
> + * @action: dword array with the HXG message (can't be NULL)
> + * @len: length of the HXG message in dwords (can't be 0)
> + * @g2h_len: G2H response space to reserve in dwords, or 0
> + * @num_g2h: number of G2H messages expected, or 0
> + *
> + * Return codes from the non-blocking send helpers are:
> + *
> + * * -ENOTRECOVERABLE: the xe device is wedged. Stop submitting new GuC work; the
> + *   request cannot make progress until the device is recovered.
> + * * -EPIPE: the H2G CTB is marked broken. The channel stays unusable until the
> + *   CT is restarted, which clears the broken flag.
> + * * -ENODEV: the CT channel is disabled, messages not expected in this state.
> + *   Don't retry until it is enabled again.
> + * * -ECANCELED: the CT channel is stopped or a GT recovery is pending; the
> + *   message was dropped. Often benign. Cancel-tolerant callers (e.g. TLB
> + *   invalidations, GuC submission) rely on the stop/start flow to recover;
> + *   others should retry once the CT is re-enabled or the reset/recovery
> + *   completes.
> + * * -EDEADLK: no CTB room and the wait for space timed out. The send helpers
> + *   have already requested an async GT reset before returning this error.
> + *
> + * -ENOMEM may also be returned if an internal allocation fails; the blocking
> + * xe_guc_ct_send_recv() path retries that allocation. -EBUSY and
> + * -EAGAIN are internal flow-control results handled by the send helpers.
> + *
> + * Return: 0 on success, or a negative error code on failure.
> + */
>  int xe_guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
>  		   u32 g2h_len, u32 num_g2h)
>  {
> @@ -1388,7 +1423,7 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
>  	if (g2h_fence.fail) {
>  		if (g2h_fence.cancel) {
>  			xe_gt_dbg(gt, "H2G request %#x canceled!\n", action[0]);
> -			ret = -ECANCELED;
> +			ret = xe_device_wedged(ct_to_xe(ct)) ? -ENOTRECOVERABLE : -ECANCELED;
>  			goto unlock;
>  		}
>  		xe_gt_err(gt, "H2G request %#x failed: error %#x hint %#x\n",
> @@ -1724,6 +1759,9 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
>  	xe_gt_assert(gt, xe_guc_ct_initialized(ct));
>  	lockdep_assert_held(&ct->fast_lock);
>  
> +	if (xe_device_wedged(xe))
> +		return -ENOTRECOVERABLE;
> +
>  	if (ct->state == XE_GUC_CT_STATE_DISABLED)
>  		return -ENODEV;
>  
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-06-30 14:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 19:46 [PATCH v2 0/2] drm/xe/guc: distinguish wedged from recoverable cancellation Sk Anirban
2026-06-24 19:46 ` [PATCH v2 1/2] " Sk Anirban
2026-06-30 14:27   ` Matthew Brost [this message]
2026-06-24 19:46 ` [PATCH v2 2/2] drm/xe/guc: fix activity stats error message format Sk Anirban
2026-06-24 19:59 ` ✓ CI.KUnit: success for drm/xe/guc: distinguish wedged from recoverable cancellation (rev2) Patchwork
2026-06-25  0:10 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-06-25  0:30 ` ✗ Xe.CI.FULL: " Patchwork
2026-07-01  9:19 ` ✓ CI.KUnit: success for drm/xe/guc: distinguish wedged from recoverable cancellation (rev3) Patchwork
2026-07-01 10:08 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-02  0:34 ` ✓ Xe.CI.FULL: " Patchwork

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=akPSbhNTu9iMA4J1@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=soham.purkait@intel.com \
    --cc=vinay.belgaumkar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.