From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Cc: francois.dugast@intel.com, michal.mrozek@intel.com
Subject: Re: [PATCH v2 7/7] drm/xe: Add more GT stats around pagefault mode switch flows
Date: Mon, 15 Dec 2025 12:00:58 +0100 [thread overview]
Message-ID: <bd00ede0e055ce7247cf7ec1d5a3f71bee350424.camel@linux.intel.com> (raw)
In-Reply-To: <20251212182847.1683222-8-matthew.brost@intel.com>
On Fri, 2025-12-12 at 10:28 -0800, Matthew Brost wrote:
> Add GT stats to measure the time spent switching between pagefault
> mode
> and dma-fence mode. Also add a GT stat to indicate when pagefault
> suspend is skipped because the system is idle. These metrics will
> help
> profile pagefault workloads while 3D and display are enabled.
>
> v2:
> - Use GT stats helper functions (Francois)
>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_stats.c | 6 ++++++
> drivers/gpu/drm/xe/xe_gt_stats_types.h | 3 +++
> drivers/gpu/drm/xe/xe_hw_engine_group.c | 22 +++++++++++++++++++++-
> 3 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c
> b/drivers/gpu/drm/xe/xe_gt_stats.c
> index 714045ad9354..fb2904bd0abd 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> @@ -68,8 +68,14 @@ static const char *const
> stat_description[__XE_GT_STATS_NUM_IDS] = {
> 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_SKIP_LR_QUEUE_COUNT,
> + "hw_engine_group_skip_lr_queue_count"),
> DEF_STAT_STR(HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT,
> "hw_engine_group_wait_dma_queue_count"),
> + DEF_STAT_STR(HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_US,
> + "hw_engine_group_suspend_lr_queue_us"),
> + DEF_STAT_STR(HW_ENGINE_GROUP_WAIT_DMA_QUEUE_US,
> + "hw_engine_group_wait_dma_queue_us"),
> };
>
> /**
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> index aada5df421e5..b92d013091d5 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> @@ -45,7 +45,10 @@ enum xe_gt_stats_id {
> 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_SKIP_LR_QUEUE_COUNT,
> XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT,
> + XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_US,
> + XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_US,
> /* must be the last entry */
> __XE_GT_STATS_NUM_IDS,
> };
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine_group.c
> b/drivers/gpu/drm/xe/xe_hw_engine_group.c
> index 022fc0c30d38..9a53021bbfa7 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine_group.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine_group.c
> @@ -200,7 +200,9 @@ static int
> xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group
> {
> int err;
> struct xe_exec_queue *q;
> + struct xe_gt *gt = NULL;
> bool need_resume = false;
> + ktime_t start = xe_gt_stats_ktime_get();
>
> lockdep_assert_held_write(&group->mode_sem);
>
> @@ -215,10 +217,13 @@ static int
> xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group
> return -EAGAIN;
>
> xe_gt_stats_incr(q->gt,
> XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_COUNT, 1);
> -
> + if (idle_skip_suspend)
> + xe_gt_stats_incr(q->gt,
> +
> XE_GT_STATS_ID_HW_ENGINE_GROUP_SKIP_LR_QUEUE_COUNT, 1);
>
> need_resume |= !idle_skip_suspend;
> q->ops->suspend(q);
> + gt = q->gt;
> }
>
> list_for_each_entry(q, &group->exec_queue_list,
> hw_engine_group_link) {
> @@ -230,6 +235,12 @@ static int
> xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group
> return err;
> }
>
> + if (gt) {
> + xe_gt_stats_incr(gt,
> +
> XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_US,
> + xe_gt_stats_ktime_us_delta(start));
> + }
> +
> if (need_resume)
> xe_hw_engine_group_resume_faulting_lr_jobs(group);
>
> @@ -250,7 +261,9 @@ static int
> xe_hw_engine_group_wait_for_dma_fence_jobs(struct xe_hw_engine_group
> {
> long timeout;
> struct xe_exec_queue *q;
> + struct xe_gt *gt = NULL;
> struct dma_fence *fence;
> + ktime_t start = xe_gt_stats_ktime_get();
>
> lockdep_assert_held_write(&group->mode_sem);
>
> @@ -262,11 +275,18 @@ static int
> xe_hw_engine_group_wait_for_dma_fence_jobs(struct xe_hw_engine_group
> fence = xe_exec_queue_last_fence_get_for_resume(q,
> q->vm);
> timeout = dma_fence_wait(fence, false);
> dma_fence_put(fence);
> + gt = q->gt;
>
> if (timeout < 0)
> return -ETIME;
> }
>
> + if (gt) {
> + xe_gt_stats_incr(gt,
> +
> XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_US,
> + xe_gt_stats_ktime_us_delta(start));
> + }
> +
> return 0;
> }
>
next prev parent reply other threads:[~2025-12-15 11:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 18:28 [PATCH v2 0/7] Fix performance when pagefaults and 3d/display share resources Matthew Brost
2025-12-12 18:28 ` [PATCH v2 1/7] drm/xe: Adjust long-running workload timeslices to reasonable values Matthew Brost
2025-12-15 10:08 ` Thomas Hellström
2025-12-15 21:48 ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 2/7] drm/xe: Use usleep_range for accurate long-running workload timeslicing Matthew Brost
2025-12-15 10:10 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 3/7] drm/xe: Add debugfs knobs to control long running " Matthew Brost
2025-12-15 10:11 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 4/7] drm/xe: Skip exec queue schedule toggle if queue is idle during suspend Matthew Brost
2025-12-15 12:08 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 5/7] drm/xe: Wait on in-syncs when swicthing to dma-fence mode Matthew Brost
2025-12-15 10:32 ` Thomas Hellström
2025-12-15 21:46 ` Matthew Brost
2025-12-15 21:48 ` Thomas Hellström
2025-12-16 1:12 ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 6/7] drm/xe: Add GT stats ktime helpers Matthew Brost
2025-12-15 10:17 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 7/7] drm/xe: Add more GT stats around pagefault mode switch flows Matthew Brost
2025-12-15 11:00 ` Thomas Hellström [this message]
2025-12-15 13:05 ` Francois Dugast
2025-12-12 22:37 ` ✗ CI.checkpatch: warning for Fix performance when pagefaults and 3d/display share resources (rev2) Patchwork
2025-12-12 22:38 ` ✓ CI.KUnit: success " Patchwork
2025-12-12 23:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-13 19:27 ` ✗ Xe.CI.Full: failure " Patchwork
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=bd00ede0e055ce7247cf7ec1d5a3f71bee350424.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=michal.mrozek@intel.com \
/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.