From: Riana Tauro <riana.tauro@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: riana.tauro@intel.com, anshuman.gupta@intel.com,
umesh.nerlige.ramappa@intel.com, lucas.demarchi@intel.com,
vinay.belgaumkar@intel.com, soham.purkait@intel.com
Subject: [PATCH v6 2/8] drm/xe/trace: Add trace for engine activity
Date: Tue, 11 Feb 2025 15:39:44 +0530 [thread overview]
Message-ID: <20250211100952.322303-3-riana.tauro@intel.com> (raw)
In-Reply-To: <20250211100952.322303-1-riana.tauro@intel.com>
Add engine activity related information to trace events for
better debuggability
v2: add trace for engine activity (Umesh)
v3: use hex for quanta_ratio
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
drivers/gpu/drm/xe/xe_guc_engine_activity.c | 5 +++
drivers/gpu/drm/xe/xe_trace_guc.h | 49 +++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_guc_engine_activity.c b/drivers/gpu/drm/xe/xe_guc_engine_activity.c
index 255e63d82a96..a424527eddb6 100644
--- a/drivers/gpu/drm/xe/xe_guc_engine_activity.c
+++ b/drivers/gpu/drm/xe/xe_guc_engine_activity.c
@@ -17,6 +17,7 @@
#include "xe_hw_engine.h"
#include "xe_map.h"
#include "xe_mmio.h"
+#include "xe_trace_guc.h"
#define TOTAL_QUANTA 0x8000
@@ -165,6 +166,8 @@ static u64 get_engine_active_ticks(struct xe_guc *guc, struct xe_hw_engine *hwe)
ea->active = lower_32_bits(gpm_ts) - cached_activity->last_update_tick;
}
+ trace_xe_guc_engine_activity(xe, ea, hwe->name, hwe->instance);
+
return ea->total + ea->active;
}
@@ -198,6 +201,8 @@ static u64 get_engine_total_ticks(struct xe_guc *guc, struct xe_hw_engine *hwe)
ea->quanta_remainder_ns = numerator % TOTAL_QUANTA;
ea->quanta = cpu_ns_to_guc_tsc_tick(ea->quanta_ns, cached_metadata->guc_tsc_frequency_hz);
+ trace_xe_guc_engine_activity(xe, ea, hwe->name, hwe->instance);
+
return ea->quanta;
}
diff --git a/drivers/gpu/drm/xe/xe_trace_guc.h b/drivers/gpu/drm/xe/xe_trace_guc.h
index 23abdd55dc62..78949db9cfce 100644
--- a/drivers/gpu/drm/xe/xe_trace_guc.h
+++ b/drivers/gpu/drm/xe/xe_trace_guc.h
@@ -14,6 +14,7 @@
#include "xe_device_types.h"
#include "xe_guc_exec_queue_types.h"
+#include "xe_guc_engine_activity_types.h"
#define __dev_name_xe(xe) dev_name((xe)->drm.dev)
@@ -100,6 +101,54 @@ DEFINE_EVENT_PRINT(xe_guc_ctb, xe_guc_ctb_g2h,
);
+TRACE_EVENT(xe_guc_engine_activity,
+ TP_PROTO(struct xe_device *xe, struct engine_activity *ea, const char *name,
+ u16 instance),
+ TP_ARGS(xe, ea, name, instance),
+
+ TP_STRUCT__entry(
+ __string(dev, __dev_name_xe(xe))
+ __string(name, name)
+ __field(u32, global_change_num)
+ __field(u32, guc_tsc_frequency_hz)
+ __field(u32, lag_latency_usec)
+ __field(u16, instance)
+ __field(u16, change_num)
+ __field(u16, quanta_ratio)
+ __field(u32, last_update_tick)
+ __field(u64, active_ticks)
+ __field(u64, active)
+ __field(u64, total)
+ __field(u64, quanta)
+ __field(u64, last_cpu_ts)
+ ),
+
+ TP_fast_assign(
+ __assign_str(dev);
+ __assign_str(name);
+ __entry->global_change_num = ea->metadata.global_change_num;
+ __entry->guc_tsc_frequency_hz = ea->metadata.guc_tsc_frequency_hz;
+ __entry->lag_latency_usec = ea->metadata.lag_latency_usec;
+ __entry->instance = instance;
+ __entry->change_num = ea->activity.change_num;
+ __entry->quanta_ratio = ea->activity.quanta_ratio;
+ __entry->last_update_tick = ea->activity.last_update_tick;
+ __entry->active_ticks = ea->activity.active_ticks;
+ __entry->active = ea->active;
+ __entry->total = ea->total;
+ __entry->quanta = ea->quanta;
+ __entry->last_cpu_ts = ea->last_cpu_ts;
+ ),
+
+ TP_printk("dev=%s engine %s:%d Active=%llu, quanta=%llu, last_cpu_ts=%llu\n"
+ "Activity metadata: global_change_num=%u, guc_tsc_frequency_hz=%u lag_latency_usec=%u\n"
+ "Activity data: change_num=%u, quanta_ratio=0x%x, last_update_tick=%u, active_ticks=%llu\n",
+ __get_str(dev), __get_str(name), __entry->instance,
+ (__entry->active + __entry->total), __entry->quanta, __entry->last_cpu_ts,
+ __entry->global_change_num, __entry->guc_tsc_frequency_hz,
+ __entry->lag_latency_usec, __entry->change_num, __entry->quanta_ratio,
+ __entry->last_update_tick, __entry->active_ticks)
+);
#endif
/* This part must be outside protection */
--
2.47.1
next prev parent reply other threads:[~2025-02-11 9:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 10:09 [PATCH v6 0/8] PMU support for engine activity Riana Tauro
2025-02-11 10:09 ` [PATCH v6 1/8] drm/xe: Add engine activity support Riana Tauro
2025-02-11 10:09 ` Riana Tauro [this message]
2025-02-11 10:09 ` [PATCH v6 3/8] drm/xe/guc: Expose engine activity only for supported GuC version Riana Tauro
2025-02-13 18:08 ` Umesh Nerlige Ramappa
2025-02-11 10:09 ` [PATCH v6 4/8] drm/xe/xe_pmu: Add PMU support for engine activity Riana Tauro
2025-02-11 10:09 ` [PATCH v6 5/8] drm/xe/xe_pmu: Acquire forcewake on event init for engine events Riana Tauro
2025-02-12 23:49 ` Umesh Nerlige Ramappa
2025-02-11 10:09 ` [PATCH v6 6/8] drm/xe: Add support for per-function engine activity Riana Tauro
2025-02-11 10:09 ` [PATCH v6 7/8] drm/xe/xe_pmu: Add PMU support for per-function engine activity stats Riana Tauro
2025-02-11 10:09 ` [PATCH v6 8/8] drm/xe/pf: Enable " Riana Tauro
2025-02-11 10:48 ` ✓ CI.Patch_applied: success for PMU support for engine activity (rev2) Patchwork
2025-02-11 10:49 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-11 10:50 ` ✓ CI.KUnit: success " Patchwork
2025-02-11 11:19 ` ✓ CI.Build: " Patchwork
2025-02-11 11:21 ` ✗ CI.Hooks: failure " Patchwork
2025-02-11 11:22 ` ✗ CI.checksparse: warning " Patchwork
2025-02-11 11:42 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-11 19:01 ` ✗ 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=20250211100952.322303-3-riana.tauro@intel.com \
--to=riana.tauro@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=soham.purkait@intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
--cc=vinay.belgaumkar@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.