summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Dugast <francois.dugast@intel.com>2026-03-25 19:01:52 +0300
committerMatthew Brost <matthew.brost@intel.com>2026-03-26 04:19:37 +0300
commit4e966014ce8826bb7d0180394f40b643b1405925 (patch)
tree71e5055d1653a5118e2537792c11d9cea181a0f5
parent50c577eab051638fbe8989fae1f826ecc1d2e2c7 (diff)
downloadlinux-4e966014ce8826bb7d0180394f40b643b1405925.tar.xz
drm/xe: Add new SVM copy GT stats per size
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> Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260325160152.1057556-1-francois.dugast@intel.com
-rw-r--r--drivers/gpu/drm/xe/xe_gt_stats.c6
-rw-r--r--drivers/gpu/drm/xe/xe_gt_stats_types.h6
-rw-r--r--drivers/gpu/drm/xe/xe_svm.c27
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,