public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<thomas.hellstrom@linux.intel.com>, <stuart.summers@intel.com>,
	<arvind.yadav@intel.com>, <tejas.upadhyay@intel.com>
Subject: Re: [RFC 09/15] drm/xe/trace: Add xe_vma_acc trace event for access counter notifications
Date: Thu, 2 Apr 2026 18:01:17 -0700	[thread overview]
Message-ID: <ac8RXcS0D83lmhoA@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260318074456.2839499-10-himal.prasad.ghimiray@intel.com>

On Wed, Mar 18, 2026 at 01:14:50PM +0530, Himal Prasad Ghimiray wrote:
> Trace VMA access counter notifications with asid, address range, and
> counter type (TRIGGER or NOTIFY) to aid debugging of migration hints.
> 
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_access_counter.c |  7 ++++--
>  drivers/gpu/drm/xe/xe_trace_bo.h       | 32 +++++++++++++++++++++++---
>  2 files changed, 34 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_access_counter.c b/drivers/gpu/drm/xe/xe_access_counter.c
> index 9eb9917d8da7..f93618faab02 100644
> --- a/drivers/gpu/drm/xe/xe_access_counter.c
> +++ b/drivers/gpu/drm/xe/xe_access_counter.c
> @@ -13,6 +13,7 @@
>  #include "xe_device.h"
>  #include "xe_gt_printk.h"
>  #include "xe_hw_engine.h"
> +#include "xe_trace_bo.h"
>  #include "xe_usm_queue.h"
>  #include "xe_vm.h"
>  
> @@ -109,6 +110,8 @@ static int xe_access_counter_service(struct xe_access_counter *ac)
>  		goto unlock_vm;
>  	}
>  
> +	trace_xe_vma_acc(vma, ac->consumer.counter_type);
> +
>  	/* TODO: Handle svm vma's  */
>  	if (xe_vma_has_no_bo(vma))
>  		goto unlock_vm;
> @@ -153,7 +156,7 @@ static void xe_access_counter_queue_work_func(struct work_struct *w)
>  #define USM_QUEUE_MAX_RUNTIME_MS	20
>  	threshold = jiffies + msecs_to_jiffies(USM_QUEUE_MAX_RUNTIME_MS);
>  
> -	while (xe_usm_queue_pop(ac_queue, &ac, xe_access_counter_entry_size())) {
> +	while (xe_usm_queue_pop(ac_queue, &ac, sizeof(struct xe_access_counter))) {
>  		int err;
>  
>  		if (!ac.gt)	/* Access counter squashed during reset */
> @@ -239,7 +242,7 @@ int xe_access_counter_handler(struct xe_device *xe, struct xe_access_counter *ac
>  	spin_lock_irqsave(&ac_queue->lock, flags);
>  	full = xe_usm_queue_full(ac_queue, sizeof(struct xe_access_counter));
>  	if (!full) {
> -		xe_usm_queue_push(ac_queue, ac, xe_access_counter_entry_size());
> +		xe_usm_queue_push(ac_queue, ac, sizeof(struct xe_access_counter));
>  		queue_work(xe->usm.pf_wq, &ac_queue->worker);
>  	} else {
>  		drm_warn(&xe->drm,
> diff --git a/drivers/gpu/drm/xe/xe_trace_bo.h b/drivers/gpu/drm/xe/xe_trace_bo.h
> index 86323cf3be2c..eae5a5d0dbdc 100644
> --- a/drivers/gpu/drm/xe/xe_trace_bo.h
> +++ b/drivers/gpu/drm/xe/xe_trace_bo.h
> @@ -12,6 +12,7 @@
>  #include <linux/tracepoint.h>
>  #include <linux/types.h>
>  
> +#include "xe_access_counter_types.h"
>  #include "xe_bo.h"
>  #include "xe_bo_types.h"
>  #include "xe_vm.h"
> @@ -125,9 +126,34 @@ DEFINE_EVENT(xe_vma, xe_vma_pagefault,
>  	     TP_ARGS(vma)
>  );
>  
> -DEFINE_EVENT(xe_vma, xe_vma_acc,
> -	     TP_PROTO(struct xe_vma *vma),
> -	     TP_ARGS(vma)
> +TRACE_EVENT(xe_vma_acc,
> +	    TP_PROTO(struct xe_vma *vma, u8 counter_type),
> +	    TP_ARGS(vma, counter_type),
> +
> +	    TP_STRUCT__entry(
> +		     __string(dev, __dev_name_vma(vma))
> +		     __field(struct xe_vma *, vma)
> +		     __field(struct xe_vm *, vm)
> +		     __field(u32, asid)
> +		     __field(u64, start)
> +		     __field(u64, end)
> +		     __field(u8, counter_type)
> +		     ),
> +
> +	    TP_fast_assign(
> +		   __assign_str(dev);
> +		   __entry->vma = vma;
> +		   __entry->vm = xe_vma_vm(vma);
> +		   __entry->asid = xe_vma_vm(vma)->usm.asid;
> +		   __entry->start = xe_vma_start(vma);
> +		   __entry->end = xe_vma_end(vma) - 1;
> +		   __entry->counter_type = counter_type;
> +		   ),
> +
> +	    TP_printk("dev=%s, vma=%p, vm=%p, asid=0x%05x, start=0x%012llx, end=0x%012llx, type=%s",
> +		      __get_str(dev), __entry->vma, __entry->vm,
> +		      __entry->asid, __entry->start, __entry->end,
> +		      __entry->counter_type == XE_ACCESS_COUNTER_TYPE_NOTIFY ? "NOTIFY" : "TRIGGER")
>  );
>  
>  DEFINE_EVENT(xe_vma, xe_vma_bind,
> -- 
> 2.34.1
> 

  reply	other threads:[~2026-04-03  1:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  7:44 [RFC 00/15] drm/xe: Access counter consumer layer Himal Prasad Ghimiray
2026-03-18  7:34 ` ✗ CI.checkpatch: warning for " Patchwork
2026-03-18  7:35 ` ✗ CI.KUnit: failure " Patchwork
2026-03-18  7:44 ` [RFC 01/15] drm/xe: Add xe_usm_queue generic USM circular buffer Himal Prasad Ghimiray
2026-04-01 21:28   ` Matthew Brost
2026-04-06  4:46     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 02/15] drm/xe/pagefault: Use xe_usm_queue helpers Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 03/15] drm/xe: Stub out new access_counter layer Himal Prasad Ghimiray
2026-04-02 21:46   ` Matthew Brost
2026-04-06  5:28     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 04/15] drm/xe: Implement xe_access_counter_init Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 05/15] drm/xe: Implement xe_access_counter_handler Himal Prasad Ghimiray
2026-04-03  2:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 06/15] drm/xe: Extract xe_vma_lock_and_validate helper Himal Prasad Ghimiray
2026-04-01 22:03   ` Matthew Brost
2026-03-18  7:44 ` [RFC 07/15] drm/xe: Move ASID to FAULT VM lookup to xe_device Himal Prasad Ghimiray
2026-04-02 21:50   ` Matthew Brost
2026-04-07  6:41     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 08/15] drm/xe: Implement xe_access_counter_queue_work Himal Prasad Ghimiray
2026-04-01 21:10   ` Matthew Brost
2026-04-01 22:01     ` Matthew Brost
2026-04-01 22:11   ` Matthew Brost
2026-04-02 22:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 09/15] drm/xe/trace: Add xe_vma_acc trace event for access counter notifications Himal Prasad Ghimiray
2026-04-03  1:01   ` Matthew Brost [this message]
2026-03-18  7:44 ` [RFC 10/15] drm/xe/svm: Handle svm ranges on access ctr trigger Himal Prasad Ghimiray
2026-04-03  0:25   ` Matthew Brost
2026-03-18  7:44 ` [RFC 11/15] drm/xe: Add xe_guc_access_counter layer Himal Prasad Ghimiray
2026-04-02 21:27   ` Matthew Brost
2026-03-18  7:44 ` [RFC 12/15] drm/xe/uapi: Add access counter parameter extension for exec queue Himal Prasad Ghimiray
2026-03-24 14:25   ` Francois Dugast
2026-04-01 14:46     ` Matthew Brost
2026-04-01 16:36       ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 13/15] drm/xe/lrc: Pass exec_queue to xe_lrc_create for access counter params Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 14/15] drm/xe/vm: Add xe_vma_supports_access_ctr() helper Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 15/15] drm/xe/pt: Set NC PTE bit for VMAs ineligible for access counting Himal Prasad Ghimiray
2026-04-03  0:09   ` Matthew Brost

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=ac8RXcS0D83lmhoA@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=stuart.summers@intel.com \
    --cc=tejas.upadhyay@intel.com \
    --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