Commit 8e011f6d authored by Francois Dugast's avatar Francois Dugast
Browse files

drm/xe/hw_engine_group: Add stats for mode switching



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: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20251210165000.60789-1-francois.dugast@intel.com


Signed-off-by: default avatarFrancois Dugast <francois.dugast@intel.com>
parent 3efadf02
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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"),
};

/**
+2 −0
Original line number Diff line number Diff line
@@ -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,
};
+3 −0
Original line number Diff line number Diff line
@@ -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);