[PATCH 2/2] drm/xe: Add stats for tlb invalidation count

Upadhyay, Tejas tejas.upadhyay at intel.com
Wed Aug 7 05:47:43 UTC 2024



> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Nirmoy
> Das
> Sent: Wednesday, August 7, 2024 1:15 AM
> To: intel-xe at lists.freedesktop.org
> Cc: Das, Nirmoy <nirmoy.das at intel.com>; Brost, Matthew
> <matthew.brost at intel.com>; Wajdeczko, Michal
> <Michal.Wajdeczko at intel.com>
> Subject: [PATCH 2/2] drm/xe: Add stats for tlb invalidation count
> 
> Add stats for tlb invalidadtion count which can be viewed with per GT stat
> debugfs file.
> 
> Example output:
> cat /sys/kernel/debug/dri/0/gt0/stats
> tlb_inval_count: 22
> 
> Cc: Matthew Brost <matthew.brost at intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_stats.c            | 1 +
>  drivers/gpu/drm/xe/xe_gt_stats.h            | 1 +
>  drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 2 ++
>  3 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c
> b/drivers/gpu/drm/xe/xe_gt_stats.c
> index cc69d748e8f6..adb5a9aa6bd3 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> @@ -15,6 +15,7 @@ void xe_gt_stats_incr(struct xe_gt *gt, enum
> xe_gt_counter_stats id, int incr)  }
> 
>  static const char *const stat_description[] = {
> +	"tlb_inval_count",
>  };
> 
>  int xe_gt_stats_print_info(struct xe_gt *gt, struct drm_printer *p) diff --git
> a/drivers/gpu/drm/xe/xe_gt_stats.h b/drivers/gpu/drm/xe/xe_gt_stats.h
> index e83155ab1fdb..11b8ed17f9d9 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.h
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.h
> @@ -12,6 +12,7 @@ struct xe_gt;
>  //struct drm_printer;
> 
>  enum xe_gt_counter_stats {
> +	XE_GT_COUNTER_TLB_INVAL,
>  	XE_GT_COUNTER_STATS_NUM,
>  };
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> index 87cb76a8718c..e3cdb0e041af 100644
> --- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> +++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
> @@ -16,6 +16,7 @@
>  #include "xe_pm.h"
>  #include "xe_sriov.h"
>  #include "xe_trace.h"
> +#include "xe_gt_stats.h"

nit: include alphabetical order 

>  #include "regs/xe_guc_regs.h"
> 
>  #define FENCE_STACK_BIT		DMA_FENCE_FLAG_USER_BITS
> @@ -213,6 +214,7 @@ static int send_tlb_invalidation(struct xe_guc *guc,
>  			gt->tlb_invalidation.seqno = 1;
>  	}
>  	mutex_unlock(&guc->ct.lock);
> +	xe_gt_stats_incr(gt, XE_GT_COUNTER_TLB_INVAL, 1);

Apart from above nit, LGTM :
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> 
>  	return ret;
>  }
> --
> 2.42.0



More information about the Intel-xe mailing list