From: Stuart Summers <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org, matthew.brost@intel.com,
niranjana.vishwanathapura@intel.com, zhanjun.dong@intel.com,
shuicheng.lin@intel.com,
Stuart Summers <stuart.summers@intel.com>
Subject: [PATCH 1/6] drm/xe: Add additional trace points for LRCs
Date: Mon, 27 Oct 2025 18:04:07 +0000 [thread overview]
Message-ID: <20251027180412.63743-2-stuart.summers@intel.com> (raw)
In-Reply-To: <20251027180412.63743-1-stuart.summers@intel.com>
Add trace points to indicate when an LRC has been
created and destroyed or get and put.
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
drivers/gpu/drm/xe/xe_lrc.c | 4 +++
drivers/gpu/drm/xe/xe_lrc.h | 3 +++
drivers/gpu/drm/xe/xe_trace_lrc.h | 42 ++++++++++++++++++++++++++++++-
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index b5083c99dd50..42d1c861fe18 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1575,6 +1575,8 @@ struct xe_lrc *xe_lrc_create(struct xe_hw_engine *hwe, struct xe_vm *vm,
return ERR_PTR(err);
}
+ trace_xe_lrc_create(lrc);
+
return lrc;
}
@@ -1589,6 +1591,8 @@ void xe_lrc_destroy(struct kref *ref)
{
struct xe_lrc *lrc = container_of(ref, struct xe_lrc, refcount);
+ trace_xe_lrc_destroy(lrc);
+
xe_lrc_finish(lrc);
kfree(lrc);
}
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h
index 2fb628da5c43..fd67810f9812 100644
--- a/drivers/gpu/drm/xe/xe_lrc.h
+++ b/drivers/gpu/drm/xe/xe_lrc.h
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include "xe_lrc_types.h"
+#include "xe_trace_lrc.h"
struct drm_printer;
struct xe_bb;
@@ -61,6 +62,7 @@ void xe_lrc_destroy(struct kref *ref);
static inline struct xe_lrc *xe_lrc_get(struct xe_lrc *lrc)
{
kref_get(&lrc->refcount);
+ trace_xe_lrc_get(lrc);
return lrc;
}
@@ -73,6 +75,7 @@ static inline struct xe_lrc *xe_lrc_get(struct xe_lrc *lrc)
*/
static inline void xe_lrc_put(struct xe_lrc *lrc)
{
+ trace_xe_lrc_put(lrc);
kref_put(&lrc->refcount, xe_lrc_destroy);
}
diff --git a/drivers/gpu/drm/xe/xe_trace_lrc.h b/drivers/gpu/drm/xe/xe_trace_lrc.h
index d525cbee1e34..e8daa5d323e7 100644
--- a/drivers/gpu/drm/xe/xe_trace_lrc.h
+++ b/drivers/gpu/drm/xe/xe_trace_lrc.h
@@ -13,7 +13,6 @@
#include <linux/types.h>
#include "xe_gt_types.h"
-#include "xe_lrc.h"
#include "xe_lrc_types.h"
#define __dev_name_lrc(lrc) dev_name(gt_to_xe((lrc)->fence_ctx.gt)->drm.dev)
@@ -42,6 +41,47 @@ TRACE_EVENT(xe_lrc_update_timestamp,
__get_str(device_id))
);
+DECLARE_EVENT_CLASS(xe_lrc,
+ TP_PROTO(struct xe_lrc *lrc),
+ TP_ARGS(lrc),
+
+ TP_STRUCT__entry(
+ __field(struct xe_lrc *, lrc)
+ __string(name, lrc->fence_ctx.name)
+ __string(device_id, __dev_name_lrc(lrc))
+ ),
+
+ TP_fast_assign(
+ __entry->lrc = lrc;
+ __assign_str(name);
+ __assign_str(device_id);
+ ),
+
+ TP_printk("lrc=:%p lrc->name=%s device_id:%s",
+ __entry->lrc, __get_str(name),
+ __get_str(device_id))
+);
+
+DEFINE_EVENT(xe_lrc, xe_lrc_create,
+ TP_PROTO(struct xe_lrc *lrc),
+ TP_ARGS(lrc)
+);
+
+DEFINE_EVENT(xe_lrc, xe_lrc_destroy,
+ TP_PROTO(struct xe_lrc *lrc),
+ TP_ARGS(lrc)
+);
+
+DEFINE_EVENT(xe_lrc, xe_lrc_get,
+ TP_PROTO(struct xe_lrc *lrc),
+ TP_ARGS(lrc)
+);
+
+DEFINE_EVENT(xe_lrc, xe_lrc_put,
+ TP_PROTO(struct xe_lrc *lrc),
+ TP_ARGS(lrc)
+);
+
#endif
/* This part must be outside protection */
--
2.34.1
next prev parent reply other threads:[~2025-10-27 18:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 18:04 [PATCH 0/6] Fix a couple of wedge corner-case memory leaks Stuart Summers
2025-10-27 18:04 ` Stuart Summers [this message]
2025-10-28 19:46 ` [PATCH 1/6] drm/xe: Add additional trace points for LRCs Matt Atwood
2025-10-28 20:11 ` Summers, Stuart
2025-10-27 18:04 ` [PATCH 2/6] drm/xe: Add a trace point for VM close Stuart Summers
2025-10-28 20:03 ` Matt Atwood
2025-10-28 20:10 ` Summers, Stuart
2025-10-27 18:04 ` [PATCH 3/6] drm/xe: Add the BO pointer info to the BO trace Stuart Summers
2025-10-28 20:11 ` Matt Atwood
2025-10-27 18:04 ` [PATCH 4/6] drm/xe: Add new exec queue trace points Stuart Summers
2025-10-28 20:29 ` Matt Atwood
2025-10-27 18:04 ` [PATCH 5/6] drm/xe: Correct migration VM teardown order Stuart Summers
2025-10-27 19:46 ` Matthew Brost
2025-10-27 18:04 ` [PATCH 6/6] drm/xe: Clean up GuC software state after a wedge Stuart Summers
2025-10-27 18:16 ` ✗ CI.checkpatch: warning for Fix a couple of wedge corner-case memory leaks (rev6) Patchwork
2025-10-27 18:17 ` ✗ CI.KUnit: failure " Patchwork
2025-10-27 18:18 ` Summers, Stuart
2025-10-27 20:10 ` Summers, Stuart
-- strict thread matches above, loose matches on Subject: below --
2025-10-14 18:09 [PATCH 0/6] Fix a couple of wedge corner-case memory leaks Stuart Summers
2025-10-14 18:09 ` [PATCH 1/6] drm/xe: Add additional trace points for LRCs Stuart Summers
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=20251027180412.63743-2-stuart.summers@intel.com \
--to=stuart.summers@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=niranjana.vishwanathapura@intel.com \
--cc=shuicheng.lin@intel.com \
--cc=zhanjun.dong@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