]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/hw_engine_group: Add stats for mode switching
authorFrancois Dugast <francois.dugast@intel.com>
Wed, 10 Dec 2025 16:50:00 +0000 (17:50 +0100)
committerFrancois Dugast <francois.dugast@intel.com>
Thu, 11 Dec 2025 09:54:17 +0000 (10:54 +0100)
The GT stats interface is extended to include counters of how many
queues are either interrupted or waited on in the hardware engine
groups. This can help application debugging.

v2: Rename to queue as those operations are queue-based (Matthew Brost)

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20251210165000.60789-1-francois.dugast@intel.com
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
drivers/gpu/drm/xe/xe_gt_stats.c
drivers/gpu/drm/xe/xe_gt_stats_types.h
drivers/gpu/drm/xe/xe_hw_engine_group.c

index 5f74706bab8148982bf7e497f8f63d87abef0cda..714045ad935483910a88446a237bb1a8eb5bde4e 100644 (file)
@@ -66,6 +66,10 @@ static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
        DEF_STAT_STR(SVM_4K_BIND_US, "svm_4K_bind_us"),
        DEF_STAT_STR(SVM_64K_BIND_US, "svm_64K_bind_us"),
        DEF_STAT_STR(SVM_2M_BIND_US, "svm_2M_bind_us"),
+       DEF_STAT_STR(HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_COUNT,
+                    "hw_engine_group_suspend_lr_queue_count"),
+       DEF_STAT_STR(HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT,
+                    "hw_engine_group_wait_dma_queue_count"),
 };
 
 /**
index d8348a8de2e1b23693df9cd775e094455bddeedb..aada5df421e5ed73e516de9a57fba2db1ccfcb96 100644 (file)
@@ -44,6 +44,8 @@ enum xe_gt_stats_id {
        XE_GT_STATS_ID_SVM_4K_BIND_US,
        XE_GT_STATS_ID_SVM_64K_BIND_US,
        XE_GT_STATS_ID_SVM_2M_BIND_US,
+       XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_COUNT,
+       XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT,
        /* must be the last entry */
        __XE_GT_STATS_NUM_IDS,
 };
index fa4db5f23342983e042e96f3ce760aaf0dfc15a3..290205a266b8b708574541b45cf0e26a691d508a 100644 (file)
@@ -9,6 +9,7 @@
 #include "xe_device.h"
 #include "xe_exec_queue.h"
 #include "xe_gt.h"
+#include "xe_gt_stats.h"
 #include "xe_hw_engine_group.h"
 #include "xe_vm.h"
 
@@ -203,6 +204,7 @@ static int xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group
                if (!xe_vm_in_fault_mode(q->vm))
                        continue;
 
+               xe_gt_stats_incr(q->gt, XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_COUNT, 1);
                need_resume = true;
                q->ops->suspend(q);
        }
@@ -244,6 +246,7 @@ static int xe_hw_engine_group_wait_for_dma_fence_jobs(struct xe_hw_engine_group
                if (xe_vm_in_lr_mode(q->vm))
                        continue;
 
+               xe_gt_stats_incr(q->gt, XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT, 1);
                fence = xe_exec_queue_last_fence_get_for_resume(q, q->vm);
                timeout = dma_fence_wait(fence, false);
                dma_fence_put(fence);