All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/lrc: Fix uninitialized new_ts when capturing context timestamp
Date: Wed, 11 Mar 2026 16:43:19 -0700	[thread overview]
Message-ID: <87y0jyvso8.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20260311104901.2933716-2-umesh.nerlige.ramappa@intel.com>

On Wed, 11 Mar 2026 03:49:02 -0700, Umesh Nerlige Ramappa wrote:
>
> Getting engine specific CTX TIMESTAMP register can fail. In that case,
> if the context is active, new_ts is uninitialized. Fix that case by
> initializing new_ts to lrc_ts.
>
> Flagged by static analysis.
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_lrc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> index aa26c71ae34f..9d766ef414ed 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
> @@ -2563,7 +2563,7 @@ static int get_ctx_timestamp(struct xe_lrc *lrc, u32 engine_id, u64 *reg_ctx_ts)
>   * @lrc: Pointer to the lrc.
>   *
>   * Return latest ctx timestamp. With support for active contexts, the
> - * calculation may bb slightly racy, so follow a read-again logic to ensure that
> + * calculation may be slightly racy, so follow a read-again logic to ensure that
>   * the context is still active before returning the right timestamp.
>   *
>   * Returns: New ctx timestamp value
> @@ -2584,6 +2584,8 @@ u64 xe_lrc_timestamp(struct xe_lrc *lrc)
>		engine_id = xe_lrc_engine_id(lrc);
>		if (!get_ctx_timestamp(lrc, engine_id, &reg_ts))
>			new_ts = reg_ts;
> +		else
> +			new_ts = lrc_ts;

Sorry, don't understand this too well. But looks like here 'lrc_ts ==
CONTEXT_ACTIVE' which is not a real timestamp value (it's value is 1). So
can we return that? See also the final 'if' statement in the function.

>
>		/* read lrc again to ensure context is still active */
>		lrc_ts = xe_lrc_ctx_timestamp(lrc);
> --
> 2.51.0
>

  parent reply	other threads:[~2026-03-11 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 10:49 [PATCH] drm/xe/lrc: Fix uninitialized new_ts when capturing context timestamp Umesh Nerlige Ramappa
2026-03-11 10:55 ` ✓ CI.KUnit: success for " Patchwork
2026-03-11 11:29 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-11 23:43 ` Dixit, Ashutosh [this message]
2026-03-12 12:35   ` [PATCH] " Umesh Nerlige Ramappa
2026-03-12  2:04 ` ✓ Xe.CI.FULL: success for " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2026-03-12 12:53 [PATCH] " Umesh Nerlige Ramappa
2026-03-12 22:04 ` Dixit, Ashutosh

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=87y0jyvso8.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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 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.