[PATCH v2 1/3] drm/xe: Save CTX_TIMESTAMP mmio value instead of LRC value

Matthew Brost matthew.brost at intel.com
Sat Apr 26 04:42:01 UTC 2025


On Fri, Apr 25, 2025 at 05:29:49PM -0700, Umesh Nerlige Ramappa wrote:
> For determining actual job execution time, save the current value of the
> CTX_TIMESTAMP register rather than the value saved in LRC since the
> current register value is the closest to the start time of the job.
> 
> Fixes: 65921374c48f ("drm/xe: Emit ctx timestamp copy in ring ops")
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

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

> ---
>  drivers/gpu/drm/xe/xe_ring_ops.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ring_ops.c b/drivers/gpu/drm/xe/xe_ring_ops.c
> index a7582b097ae6..bc1689db4cd7 100644
> --- a/drivers/gpu/drm/xe/xe_ring_ops.c
> +++ b/drivers/gpu/drm/xe/xe_ring_ops.c
> @@ -234,13 +234,10 @@ static u32 get_ppgtt_flag(struct xe_sched_job *job)
>  
>  static int emit_copy_timestamp(struct xe_lrc *lrc, u32 *dw, int i)
>  {
> -	dw[i++] = MI_COPY_MEM_MEM | MI_COPY_MEM_MEM_SRC_GGTT |
> -		MI_COPY_MEM_MEM_DST_GGTT;
> +	dw[i++] = MI_STORE_REGISTER_MEM | MI_SRM_USE_GGTT | MI_SRM_ADD_CS_OFFSET;
> +	dw[i++] = RING_CTX_TIMESTAMP(0).addr;
>  	dw[i++] = xe_lrc_ctx_job_timestamp_ggtt_addr(lrc);
>  	dw[i++] = 0;
> -	dw[i++] = xe_lrc_ctx_timestamp_ggtt_addr(lrc);
> -	dw[i++] = 0;
> -	dw[i++] = MI_NOOP;
>  
>  	return i;
>  }
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list