From: Matthew Brost <matthew.brost@intel.com>
To: Francois Dugast <francois.dugast@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Add new SVM copy GT stats per size
Date: Wed, 25 Mar 2026 18:18:18 -0700 [thread overview]
Message-ID: <acSJWjSBoAMe8PH3@gsse-cloud1> (raw)
In-Reply-To: <20260325160152.1057556-1-francois.dugast@intel.com>
On Wed, Mar 25, 2026 at 05:01:52PM +0100, Francois Dugast wrote:
> Breakdown the GT stats for copy to host and copy to device per size (4K,
> 64K 2M) to make it easier for user space to track memory migrations.
> This is helpful to verify allocation alignment is correct when porting
> applications to SVM.
>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_stats.c | 6 ++++++
> drivers/gpu/drm/xe/xe_gt_stats_types.h | 6 ++++++
> drivers/gpu/drm/xe/xe_svm.c | 27 ++++++++++++++++++++++++--
> 3 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c
> index 81cec441b449..59b3b23a54c8 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> @@ -85,7 +85,13 @@ static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
> DEF_STAT_STR(SVM_64K_CPU_COPY_US, "svm_64K_cpu_copy_us"),
> DEF_STAT_STR(SVM_2M_CPU_COPY_US, "svm_2M_cpu_copy_us"),
> DEF_STAT_STR(SVM_DEVICE_COPY_KB, "svm_device_copy_kb"),
> + DEF_STAT_STR(SVM_4K_DEVICE_COPY_KB, "svm_4K_device_copy_kb"),
> + DEF_STAT_STR(SVM_64K_DEVICE_COPY_KB, "svm_64K_device_copy_kb"),
> + DEF_STAT_STR(SVM_2M_DEVICE_COPY_KB, "svm_2M_device_copy_kb"),
> DEF_STAT_STR(SVM_CPU_COPY_KB, "svm_cpu_copy_kb"),
> + DEF_STAT_STR(SVM_4K_CPU_COPY_KB, "svm_4K_cpu_copy_kb"),
> + DEF_STAT_STR(SVM_64K_CPU_COPY_KB, "svm_64K_cpu_copy_kb"),
> + DEF_STAT_STR(SVM_2M_CPU_COPY_KB, "svm_2M_cpu_copy_kb"),
> DEF_STAT_STR(SVM_4K_GET_PAGES_US, "svm_4K_get_pages_us"),
> DEF_STAT_STR(SVM_64K_GET_PAGES_US, "svm_64K_get_pages_us"),
> DEF_STAT_STR(SVM_2M_GET_PAGES_US, "svm_2M_get_pages_us"),
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> index b6081c312474..081c787ddcb6 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> @@ -40,7 +40,13 @@ enum xe_gt_stats_id {
> XE_GT_STATS_ID_SVM_64K_CPU_COPY_US,
> XE_GT_STATS_ID_SVM_2M_CPU_COPY_US,
> XE_GT_STATS_ID_SVM_DEVICE_COPY_KB,
> + XE_GT_STATS_ID_SVM_4K_DEVICE_COPY_KB,
> + XE_GT_STATS_ID_SVM_64K_DEVICE_COPY_KB,
> + XE_GT_STATS_ID_SVM_2M_DEVICE_COPY_KB,
> XE_GT_STATS_ID_SVM_CPU_COPY_KB,
> + XE_GT_STATS_ID_SVM_4K_CPU_COPY_KB,
> + XE_GT_STATS_ID_SVM_64K_CPU_COPY_KB,
> + XE_GT_STATS_ID_SVM_2M_CPU_COPY_KB,
> XE_GT_STATS_ID_SVM_4K_GET_PAGES_US,
> XE_GT_STATS_ID_SVM_64K_GET_PAGES_US,
> XE_GT_STATS_ID_SVM_2M_GET_PAGES_US,
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index a91c84487a67..0251098650af 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -485,10 +485,33 @@ static void xe_svm_copy_kb_stats_incr(struct xe_gt *gt,
> const enum xe_svm_copy_dir dir,
> int kb)
> {
> - if (dir == XE_SVM_COPY_TO_VRAM)
> + if (dir == XE_SVM_COPY_TO_VRAM) {
> + switch (kb) {
> + case 4:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_4K_DEVICE_COPY_KB, kb);
> + break;
> + case 64:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_64K_DEVICE_COPY_KB, kb);
> + break;
> + case 2048:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_2M_DEVICE_COPY_KB, kb);
> + break;
> + }
> xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_DEVICE_COPY_KB, kb);
> - else
> + } else {
> + switch (kb) {
> + case 4:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_4K_CPU_COPY_KB, kb);
> + break;
> + case 64:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_64K_CPU_COPY_KB, kb);
> + break;
> + case 2048:
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_2M_CPU_COPY_KB, kb);
> + break;
> + }
> xe_gt_stats_incr(gt, XE_GT_STATS_ID_SVM_CPU_COPY_KB, kb);
> + }
> }
>
> static void xe_svm_copy_us_stats_incr(struct xe_gt *gt,
> --
> 2.43.0
>
prev parent reply other threads:[~2026-03-26 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 16:01 [PATCH] drm/xe: Add new SVM copy GT stats per size Francois Dugast
2026-03-25 16:08 ` ✓ CI.KUnit: success for " Patchwork
2026-03-25 16:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-26 1:11 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-26 1:18 ` Matthew Brost [this message]
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=acSJWjSBoAMe8PH3@gsse-cloud1 \
--to=matthew.brost@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.