From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58BF7106ACEE for ; Thu, 12 Mar 2026 22:04:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A44D10E1EF; Thu, 12 Mar 2026 22:04:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="blPeXXzi"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1B0F910E1EF for ; Thu, 12 Mar 2026 22:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773353094; x=1804889094; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=+Ob7CtUzCfAOe1n6e0q6nMVwP2+8j5PR84ycB6L0ORo=; b=blPeXXzi5OKmd3xw8lZkeTpT1hVmdAB/xNIxJed1oRYw+FtMijzS85c5 x4i3Abi104xixtm7lSZ2mjhzIkhVpSnNkbLImzTCnueeuN/PhuPgLGG0/ WtP/XsSUPcst7k4Ngcoh50j+tTg6z3GQhmXJJzKXwdeITjYWuH2j+VIl/ X739zg7aWL4Z8y48e7gPigQOvWKexXNrR8De99vdVyO3EShjVxi1b5ZiR HL5QBWhHgpanj6GMojZVgaUnB2j5FMBCwBC4xEGdXqxVSwa4GA/8Mfc0N HDdA54UBRwfVAn50PM7j1tDhMW7Af/2FrmD3z5t/tzSyykSAPc2HVLYeK A==; X-CSE-ConnectionGUID: Ognunur3RGmhoig+yUpTHA== X-CSE-MsgGUID: kdzeOMvXQfKq1GdVxwpgCw== X-IronPort-AV: E=McAfee;i="6800,10657,11727"; a="78312064" X-IronPort-AV: E=Sophos;i="6.23,117,1770624000"; d="scan'208";a="78312064" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2026 15:04:52 -0700 X-CSE-ConnectionGUID: eaVe5xzoR5C7/y9GLS7pHg== X-CSE-MsgGUID: fZtpEoRrQFGs4iYogJ6o7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,117,1770624000"; d="scan'208";a="220217045" Received: from unknown (HELO adixit-MOBL3.intel.com) ([10.241.243.126]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2026 15:04:52 -0700 Date: Thu, 12 Mar 2026 15:04:51 -0700 Message-ID: <87pl58r9fg.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa Cc: intel-xe@lists.freedesktop.org Subject: Re: [PATCH] drm/xe/lrc: Fix uninitialized new_ts when capturing context timestamp In-Reply-To: <20260312125308.3126607-2-umesh.nerlige.ramappa@intel.com> References: <20260312125308.3126607-2-umesh.nerlige.ramappa@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Thu, 12 Mar 2026 05:53:09 -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 the last value that was sampled in SW - > lrc->ctx_timestamp. > > Flagged by static analysis. > > v2: Fix new_ts initialization (Ashutosh) Reviewed-by: Ashutosh Dixit > > Signed-off-by: Umesh Nerlige Ramappa > --- > drivers/gpu/drm/xe/xe_lrc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c > index aa26c71ae34f..04304dff45b0 100644 > --- a/drivers/gpu/drm/xe/xe_lrc.c > +++ b/drivers/gpu/drm/xe/xe_lrc.c > @@ -2563,14 +2563,14 @@ 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 > */ > u64 xe_lrc_timestamp(struct xe_lrc *lrc) > { > - u64 lrc_ts, reg_ts, new_ts; > + u64 lrc_ts, reg_ts, new_ts = lrc->ctx_timestamp; > u32 engine_id; > > lrc_ts = xe_lrc_ctx_timestamp(lrc); > -- > 2.51.0 >