Skip to content

Commit e6e3ea5

Browse files
unerligeThomas Hellström
authored andcommitted
drm/xe/lrc: Fix uninitialized new_ts when capturing context timestamp
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) Fixes: bb63e72 ("drm/xe: Avoid toggling schedule state to check LRC timestamp in TDR") Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Link: https://patch.msgid.link/[email protected] (cherry picked from commit 466e75d) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 9be6fd9 commit e6e3ea5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_lrc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,14 +2413,14 @@ static int get_ctx_timestamp(struct xe_lrc *lrc, u32 engine_id, u64 *reg_ctx_ts)
24132413
* @lrc: Pointer to the lrc.
24142414
*
24152415
* Return latest ctx timestamp. With support for active contexts, the
2416-
* calculation may bb slightly racy, so follow a read-again logic to ensure that
2416+
* calculation may be slightly racy, so follow a read-again logic to ensure that
24172417
* the context is still active before returning the right timestamp.
24182418
*
24192419
* Returns: New ctx timestamp value
24202420
*/
24212421
u64 xe_lrc_timestamp(struct xe_lrc *lrc)
24222422
{
2423-
u64 lrc_ts, reg_ts, new_ts;
2423+
u64 lrc_ts, reg_ts, new_ts = lrc->ctx_timestamp;
24242424
u32 engine_id;
24252425

24262426
lrc_ts = xe_lrc_ctx_timestamp(lrc);

0 commit comments

Comments
 (0)