Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Francois Dugast <francois.dugast@intel.com>
Cc: intel-xe@lists.freedesktop.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH] drm/xe/hw_engine_group: Add stats for mode switching
Date: Tue, 9 Dec 2025 14:28:07 -0800	[thread overview]
Message-ID: <aTiid7BPIZb/Bvqu@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251209164625.228826-1-francois.dugast@intel.com>

On Tue, Dec 09, 2025 at 05:46:25PM +0100, Francois Dugast wrote:
> The GT stats interface is extended to include counters of how many jobs
> are either interrupted or waited on in the hardware engine groups. This
> can help application debugging.
> 
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_stats.c        | 4 ++++
>  drivers/gpu/drm/xe/xe_gt_stats_types.h  | 2 ++
>  drivers/gpu/drm/xe/xe_hw_engine_group.c | 3 +++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c
> index 5f74706bab81..edb18582e0f4 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> @@ -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_JOB_COUNT,
> +		     "hw_engine_group_suspend_lr_job_count"),
> +	DEF_STAT_STR(HW_ENGINE_GROUP_WAIT_DMA_JOB_COUNT,
> +		     "hw_engine_group_wait_dma_job_count"),

This is will be helpful. One nit, this is really isn't a per-job
operation - it is per queue. Can you change the name to reflect that?

Matt 

>  };
>  
>  /**
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> index d8348a8de2e1..826727eac485 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> @@ -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_JOB_COUNT,
> +	XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_JOB_COUNT,
>  	/* 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 fa4db5f23342..47a9d1af7d81 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine_group.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine_group.c
> @@ -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_JOB_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_JOB_COUNT, 1);
>  		fence = xe_exec_queue_last_fence_get_for_resume(q, q->vm);
>  		timeout = dma_fence_wait(fence, false);
>  		dma_fence_put(fence);
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-12-09 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 16:46 [PATCH] drm/xe/hw_engine_group: Add stats for mode switching Francois Dugast
2025-12-09 22:28 ` Matthew Brost [this message]
2025-12-10  2:45 ` ✓ CI.KUnit: success for " Patchwork
2025-12-10  4:49 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-10  7:22 ` ✓ Xe.CI.Full: " 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=aTiid7BPIZb/Bvqu@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox