Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Summers, Stuart" <stuart.summers@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Dugast, Francois" <francois.dugast@intel.com>
Cc: "Brost, Matthew" <matthew.brost@intel.com>,
	"Mrozek, Michal" <michal.mrozek@intel.com>
Subject: Re: [RFC 1/2] drm/xe/migrate: Add tracepoint during VRAM copy
Date: Tue, 9 Sep 2025 19:03:47 +0000	[thread overview]
Message-ID: <65ee8dcc2384b5e1652d4ffac97f06bb2f56b0b2.camel@intel.com> (raw)
In-Reply-To: <20250909150437.986365-2-francois.dugast@intel.com>

On Tue, 2025-09-09 at 17:03 +0200, Francois Dugast wrote:
> Add a new tracepoint when migrating memory to/from VRAM.
> 
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_migrate.c       |  9 ++++----
>  drivers/gpu/drm/xe/xe_migrate_types.h | 14 ++++++++++++
>  drivers/gpu/drm/xe/xe_trace.h         | 32
> +++++++++++++++++++++++++++
>  3 files changed, 50 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/gpu/drm/xe/xe_migrate_types.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> b/drivers/gpu/drm/xe/xe_migrate.c
> index 3f0c8832120f..d4462cb91cbb 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -28,12 +28,14 @@
>  #include "xe_hw_engine.h"
>  #include "xe_lrc.h"
>  #include "xe_map.h"
> +#include "xe_migrate_types.h"
>  #include "xe_mocs.h"
>  #include "xe_pt.h"
>  #include "xe_res_cursor.h"
>  #include "xe_sa.h"
>  #include "xe_sched_job.h"
>  #include "xe_sync.h"
> +#include "xe_trace.h"
>  #include "xe_trace_bo.h"
>  #include "xe_vm.h"
>  #include "xe_vram.h"
> @@ -1783,11 +1785,6 @@ static void build_pt_update_batch_sram(struct
> xe_migrate *m,
>         }
>  }
>  
> -enum xe_migrate_copy_dir {
> -       XE_MIGRATE_COPY_TO_VRAM,
> -       XE_MIGRATE_COPY_TO_SRAM,
> -};
> -
>  #define XE_CACHELINE_BYTES     64ull
>  #define XE_CACHELINE_MASK      (XE_CACHELINE_BYTES - 1)
>  
> @@ -1813,6 +1810,8 @@ static struct dma_fence *xe_migrate_vram(struct
> xe_migrate *m,
>         int err;
>         unsigned long i, j;
>  
> +       trace_xe_migrate_vram(xe, len, vram_addr, dir);

Looks great, thanks!
Reviewed-by: Stuart Summers <stuart.summers@intel.com>

> +
>         if (drm_WARN_ON(&xe->drm, (len & XE_CACHELINE_MASK) ||
>                         (sram_offset | vram_addr) &
> XE_CACHELINE_MASK))
>                 return ERR_PTR(-EOPNOTSUPP);
> diff --git a/drivers/gpu/drm/xe/xe_migrate_types.h
> b/drivers/gpu/drm/xe/xe_migrate_types.h
> new file mode 100644
> index 000000000000..c332d0610814
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_migrate_types.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#ifndef _XE_MIGRATE_TYPES_
> +#define _XE_MIGRATE_TYPES_
> +
> +enum xe_migrate_copy_dir {
> +       XE_MIGRATE_COPY_TO_VRAM,
> +       XE_MIGRATE_COPY_TO_SRAM,
> +};
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/xe_trace.h
> b/drivers/gpu/drm/xe/xe_trace.h
> index 314f42fcbcbd..b9f59651771e 100644
> --- a/drivers/gpu/drm/xe/xe_trace.h
> +++ b/drivers/gpu/drm/xe/xe_trace.h
> @@ -16,6 +16,7 @@
>  #include "xe_gpu_scheduler_types.h"
>  #include "xe_gt_types.h"
>  #include "xe_guc_exec_queue_types.h"
> +#include "xe_migrate_types.h"
>  #include "xe_sched_job.h"
>  #include "xe_tlb_inval_types.h"
>  #include "xe_vm.h"
> @@ -441,6 +442,37 @@ TRACE_EVENT(xe_eu_stall_data_read,
>                       __entry->read_size, __entry->total_size)
>  );
>  
> +DECLARE_EVENT_CLASS(xe_migrate,
> +                   TP_PROTO(struct xe_device *xe, unsigned long len,
> +                            u64 vram_addr, u8 dir),
> +                   TP_ARGS(xe, len, vram_addr, dir),
> +
> +                   TP_STRUCT__entry(
> +                           __string(dev, __dev_name_xe(xe))
> +                           __field(u32, len)
> +                           __field(u64, vram_addr)
> +                           __field(u8, dir)
> +                           ),
> +
> +                   TP_fast_assign(
> +                           __assign_str(dev);
> +                           __entry->len = len;
> +                           __entry->vram_addr = vram_addr;
> +                           __entry->dir = dir;
> +                           ),
> +
> +                   TP_printk("dev=%s len=%x vram_addr=%llx dir=%s",
> +                             __get_str(dev), __entry->len, __entry-
> >vram_addr,
> +                             __entry->dir == XE_MIGRATE_COPY_TO_VRAM
> ?
> +                             "TO_VRAM" : "TO_SRAM")
> +);
> +
> +DEFINE_EVENT(xe_migrate, xe_migrate_vram,
> +            TP_PROTO(struct xe_device *xe, unsigned long len, u64
> vram_addr,
> +                     u8 dir),
> +            TP_ARGS(xe, len, vram_addr, dir)
> +);
> +
>  #endif
>  
>  /* This part must be outside protection */


  reply	other threads:[~2025-09-09 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 15:03 [RFC 0/2] Add tracepoints to profile SVM page faults and migration Francois Dugast
2025-09-09 15:03 ` [RFC 1/2] drm/xe/migrate: Add tracepoint during VRAM copy Francois Dugast
2025-09-09 19:03   ` Summers, Stuart [this message]
2025-09-09 15:03 ` [RFC 2/2] drm/xe/gt_pagefault: Add tracepoints when handing page faults Francois Dugast
2025-09-09 19:08   ` Summers, Stuart
2025-09-09 20:29     ` Matthew Brost
2025-09-10 17:33       ` Summers, Stuart
2025-09-10  7:59     ` Francois Dugast
2025-09-10 17:57       ` Summers, Stuart
2025-09-09 15:11 ` ✗ CI.checkpatch: warning for Add tracepoints to profile SVM page faults and migration Patchwork
2025-09-09 15:12 ` ✓ CI.KUnit: success " Patchwork
2025-09-09 15:47 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-09 20:43 ` ✗ Xe.CI.Full: failure " 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=65ee8dcc2384b5e1652d4ffac97f06bb2f56b0b2.camel@intel.com \
    --to=stuart.summers@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=michal.mrozek@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