Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: "Dandamudi, Priyanka" <priyanka.dandamudi@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] xe/xe_bo_move: Enhance xe_bo_move trace
Date: Thu, 4 Jan 2024 19:24:35 +0000	[thread overview]
Message-ID: <ZZcF8yl2ZNH9gxEC@DUT025-TGLU.fm.intel.com> (raw)
In-Reply-To: <CH3PR11MB8434FFE4D37A01C7FE5B3A4A8D60A@CH3PR11MB8434.namprd11.prod.outlook.com>

On Wed, Jan 03, 2024 at 02:19:52PM +0000, Dandamudi, Priyanka wrote:
> 
> 
> > -----Original Message-----
> > From: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> > Sent: Wednesday, January 3, 2024 6:52 PM
> > To: Dandamudi, Priyanka <priyanka.dandamudi@intel.com>; intel-
> > xe@lists.freedesktop.org; Kempczynski, Zbigniew
> > <zbigniew.kempczynski@intel.com>; Zeng, Oak <oak.zeng@intel.com>; Welty,
> > Brian <brian.welty@intel.com>
> > Subject: Re: [PATCH] xe/xe_bo_move: Enhance xe_bo_move trace
> > 
> > Hi, Priyanka,
> > 
> > On Wed, 2024-01-03 at 18:08 +0530, priyanka.dandamudi@intel.com wrote:
> > > From: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
> > >
> > > Enhanced xe_bo_move trace to be more readable.
> > > It will help to show the migration details.
> > > Src and dst details.
> > >
> > > v2: Modify trace_xe_bo_move(), it takes the integer mem_type rather
> > > than a string.
> > > Make mem_type_to_name() extern, it will be used by trace.(Thomas)
> > >
> > > Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> > > Cc: Oak Zeng <oak.zeng@intel.com>
> > > Cc: Kempczynski Zbigniew <Zbigniew.Kempczynski@intel.com>
> > > Cc: Matthew Brost <matthew.brost@intel.com>
> > > Cc: Brian Welty <brian.welty@intel.com>
> > > Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi@intel.com>
> > > ---
> > >  drivers/gpu/drm/xe/xe_bo.c         |  3 +--
> > >  drivers/gpu/drm/xe/xe_drm_client.c | 16 ++++++++--------
> > >  drivers/gpu/drm/xe/xe_drm_client.h |  2 ++
> > >  drivers/gpu/drm/xe/xe_trace.h      | 24 +++++++++++++++++++++---
> > >  4 files changed, 32 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> > > index 8e4a3b1f6b93..f7075fd86547 100644
> > > --- a/drivers/gpu/drm/xe/xe_bo.c
> > > +++ b/drivers/gpu/drm/xe/xe_bo.c
> > > @@ -713,8 +713,7 @@ static int xe_bo_move(struct ttm_buffer_object
> > > *ttm_bo, bool evict,
> > >  		migrate = xe->tiles[0].migrate;
> > >
> > >  	xe_assert(xe, migrate);
> > > -
> > > -	trace_xe_bo_move(bo);
> > > +	trace_xe_bo_move(bo, new_mem->mem_type, old_mem_type);
> > >  	xe_device_mem_access_get(xe);
> > >
> > >  	if (xe_bo_is_pinned(bo) && !xe_bo_is_user(bo)) { diff --git
> > > a/drivers/gpu/drm/xe/xe_drm_client.c
> > > b/drivers/gpu/drm/xe/xe_drm_client.c
> > > index 82d1305e831f..e845b7f22e38 100644
> > > --- a/drivers/gpu/drm/xe/xe_drm_client.c
> > > +++ b/drivers/gpu/drm/xe/xe_drm_client.c
> > > @@ -15,6 +15,14 @@
> > >  #include "xe_drm_client.h"
> > >  #include "xe_trace.h"
> > >
> > > +const char *const mem_type_to_name[TTM_NUM_MEM_TYPES]  = {
> > > +	[XE_PL_SYSTEM] = "system",
> > > +	[XE_PL_TT] = "gtt",
> > > +	[XE_PL_VRAM0] = "vram0",
> > > +	[XE_PL_VRAM1] = "vram1",
> > > +	[XE_PL_STOLEN] = "stolen"
> > > +};
> > > +
> > 
> > Please use xe_bo.[ch] for this, since it is related to the buffer object
> > placements, and the Xe placements are defined in xe_bo.h
> > 
> > /Thomas
> > 
> The above is already declared in this program in show_meminfo(). I just moved of it to make it global.
> Is it required again to define it in xe_bo.[ch]?
> --Priyanka

The change to trace looks good to me. I think Thomas is saying move
mem_type_to_name to xe_bo.c and extern to xe_bo.h.

Matt

> > 
> > >  /**
> > >   * xe_drm_client_alloc() - Allocate drm client
> > >   * @void: No arg
> > > @@ -131,14 +139,6 @@ static void bo_meminfo(struct xe_bo *bo,
> > >
> > >  static void show_meminfo(struct drm_printer *p, struct drm_file
> > > *file)
> > >  {
> > > -	static const char *const
> > > mem_type_to_name[TTM_NUM_MEM_TYPES]  = {
> > > -		[XE_PL_SYSTEM] = "system",
> > > -		[XE_PL_TT] = "gtt",
> > > -		[XE_PL_VRAM0] = "vram0",
> > > -		[XE_PL_VRAM1] = "vram1",
> > > -		[4 ... 6] = NULL,
> > > -		[XE_PL_STOLEN] = "stolen"
> > > -	};
> > >  	struct drm_memory_stats stats[TTM_NUM_MEM_TYPES] = {};
> > >  	struct xe_file *xef = file->driver_priv;
> > >  	struct ttm_device *bdev = &xef->xe->ttm; diff --git
> > > a/drivers/gpu/drm/xe/xe_drm_client.h
> > > b/drivers/gpu/drm/xe/xe_drm_client.h
> > > index a9649aa36011..4e33d0981b6a 100644
> > > --- a/drivers/gpu/drm/xe/xe_drm_client.h
> > > +++ b/drivers/gpu/drm/xe/xe_drm_client.h
> > > @@ -13,6 +13,8 @@
> > >  #include <linux/sched.h>
> > >  #include <linux/spinlock.h>
> > >
> > > +extern const char *const mem_type_to_name[];
> > > +
> > >  struct drm_file;
> > >  struct drm_printer;
> > >  struct xe_bo;
> > > diff --git a/drivers/gpu/drm/xe/xe_trace.h
> > > b/drivers/gpu/drm/xe/xe_trace.h index 95163c303f3e..196d277795a0
> > > 100644
> > > --- a/drivers/gpu/drm/xe/xe_trace.h
> > > +++ b/drivers/gpu/drm/xe/xe_trace.h
> > > @@ -13,6 +13,7 @@
> > >  #include <linux/types.h>
> > >
> > >  #include "xe_bo_types.h"
> > > +#include "xe_drm_client.h"
> > >  #include "xe_exec_queue_types.h"
> > >  #include "xe_gpu_scheduler_types.h"
> > >  #include "xe_gt_tlb_invalidation_types.h"
> > > @@ -100,9 +101,26 @@ DEFINE_EVENT(xe_bo, xe_bo_cpu_fault,
> > >  	     TP_ARGS(bo)
> > >  );
> > >
> > > -DEFINE_EVENT(xe_bo, xe_bo_move,
> > > -	     TP_PROTO(struct xe_bo *bo),
> > > -	     TP_ARGS(bo)
> > > +TRACE_EVENT(xe_bo_move,
> > > +	    TP_PROTO(struct xe_bo *bo, uint32_t new_placement,
> > > uint32_t old_placement),
> > > +	    TP_ARGS(bo, new_placement, old_placement),
> > > +	    TP_STRUCT__entry(
> > > +		     __field(struct xe_bo *, bo)
> > > +		     __field(size_t, size)
> > > +		     __field(u32, new_placement)
> > > +		     __field(u32, old_placement)
> > > +			),
> > > +
> > > +	    TP_fast_assign(
> > > +		   __entry->bo      = bo;
> > > +		   __entry->size = bo->size;
> > > +		   __entry->new_placement = new_placement;
> > > +		   __entry->old_placement = old_placement;
> > > +
> > > +		   ),
> > > +	    TP_printk("migrate object %p [size %zu] from %s to %s",
> > > +		      __entry->bo, __entry->size,
> > > mem_type_to_name[__entry->old_placement],
> > > +		      mem_type_to_name[__entry->new_placement])
> > >  );
> > >
> > >  DECLARE_EVENT_CLASS(xe_exec_queue,
> 

  reply	other threads:[~2024-01-04 19:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 12:38 [PATCH] xe/xe_bo_move: Enhance xe_bo_move trace priyanka.dandamudi
2024-01-03 13:21 ` Thomas Hellström
2024-01-03 14:19   ` Dandamudi, Priyanka
2024-01-04 19:24     ` Matthew Brost [this message]
2024-01-04 13:33 ` ✓ CI.Patch_applied: success for xe/xe_bo_move: Enhance xe_bo_move trace (rev2) Patchwork
2024-01-04 13:33 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-04 13:34 ` ✓ CI.KUnit: success " Patchwork
2024-01-04 13:42 ` ✓ CI.Build: " Patchwork
2024-01-04 13:42 ` ✓ CI.Hooks: " Patchwork
2024-01-04 13:43 ` ✓ CI.checksparse: " Patchwork
2024-01-04 14:18 ` ✓ CI.BAT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-02-20  4:47 [PATCH] xe/xe_bo_move: Enhance xe_bo_move trace priyanka.dandamudi
2024-02-20  7:49 ` Thomas Hellström
2024-02-13  9:53 priyanka.dandamudi
2024-02-07  4:22 priyanka.dandamudi
2024-02-06 10:59 priyanka.dandamudi
2024-02-07  3:16 ` Zeng, Oak
2024-01-05  5:24 priyanka.dandamudi
2024-01-08 15:43 ` Thomas Hellström
2024-01-08 15:49   ` Jani Nikula
2024-01-12  4:48     ` Dandamudi, Priyanka
2024-01-15 15:24 ` Zeng, Oak
2024-01-03 10:29 priyanka.dandamudi
2024-01-03 11:08 ` Thomas Hellström

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=ZZcF8yl2ZNH9gxEC@DUT025-TGLU.fm.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=priyanka.dandamudi@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