Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Jia Yao <jia.yao@intel.com>, <umesh.nerlige.ramappa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Shuicheng Lin <shuicheng.lin@intel.com>
Subject: Re: [PATCH] drm/xe/guc: skip TDR timeout check when ctx_timestamp is 0 or 1
Date: Fri, 4 Sep 2026 11:18:37 -0700	[thread overview]
Message-ID: <apsLfbXfIYuJgKUl@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260904180943.3455267-1-jia.yao@intel.com>

On Fri, Sep 04, 2026 at 06:09:43PM +0000, Jia Yao wrote:

+Umesh

> A ctx_timestamp of 0 or 1 indicates an invalid timestamp:
> - 1 (CONTEXT_ACTIVE) is the cookie written by the WA BB immediately
>   after a full context restore, before the spinner has run.
> - 0 can occur when lrc->ctx_timestamp shadow is uninitialized or was
>   last updated while the context was being restored.
> 
> In both cases the timestamp is not yet valid, so reset the sampling
> baseline and wait for the next check_timeout() call.
> 
> Signed-off-by: Jia Yao <jia.yao@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 0a6e2b81b5a5..caf02d265533 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -1429,6 +1429,20 @@ static bool check_timeout(struct xe_exec_queue *q, struct xe_sched_job *job)
>  		return xe_sched_invalidate_job(job, 0);
>  	}
>  
> +	/*
> +	 * A ctx_timestamp of 0 or 1 indicates an invalid timestamp:
> +	 * - 1 (CONTEXT_ACTIVE) is the cookie written by the WA BB immediately
> +	 *   after a full context restore, before the spinner has run.
> +	 * - 0 can occur when lrc->ctx_timestamp shadow is uninitialized or was
> +	 *   last updated while the context was being restored.
> +	 * In both cases the timestamp is not yet valid, so reset the sampling
> +	 * baseline and wait for the next check_timeout() call.
> +	 */

This isn't right. `ctx_timestamp` is the 32-bit value returned by
`xe_lrc_timestamp()`, so 0 and 1 are valid values when the timestamp
wraps. If you were checking the full 64-bit value, then this might make
sense, although I'm not convinced of that either.

My understanding is that `xe_lrc_timestamp()` only inspects these
special states and takes additional action when 0 or 1 are detected. As
a result, those special values should never be propagated to the caller.
In other words, this is not a raw timestamp read, so we shouldn't need
to handle those cases here.

Umesh to confirm my understanding is correct.

Matt

> +	if (ctx_timestamp <= 1) {
> +		job->sample_timestamp = U64_MAX;
> +		return false;
> +	}
> +
>  	job->sample_timestamp = ctx_timestamp;
>  	ctx_job_timestamp = xe_lrc_ctx_job_timestamp(q->lrc[0]);
>  
> -- 
> 2.43.0
> 

  parent reply	other threads:[~2026-09-04 18:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 18:09 [PATCH] drm/xe/guc: skip TDR timeout check when ctx_timestamp is 0 or 1 Jia Yao
2026-09-04 18:17 ` ✓ CI.KUnit: success for " Patchwork
2026-09-04 18:18 ` Matthew Brost [this message]
2026-09-04 22:35   ` [PATCH] " Umesh Nerlige Ramappa
2026-09-05  3:40     ` Yao, Jia
2026-09-07 19:17       ` Yao, Jia
2026-09-04 18:20 ` sashiko-bot
2026-09-04 18:55 ` ✓ Xe.CI.BAT: success for " Patchwork
2026-09-05  2:18 ` ✓ 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=apsLfbXfIYuJgKUl@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jia.yao@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=umesh.nerlige.ramappa@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