From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: gustavo.sousa@intel.com,
"Radhakrishna Sripada" <radhakrishna.sripada@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>
Subject: [PATCH v5 3/6] drm/xe/trace: Print device_id in xe_trace_bo events
Date: Thu, 6 Jun 2024 15:38:16 -0700 [thread overview]
Message-ID: <20240606223819.3545560-4-radhakrishna.sripada@intel.com> (raw)
In-Reply-To: <20240606223819.3545560-1-radhakrishna.sripada@intel.com>
In multi-gpu environments it is important to know the device
bo/vm belongs to. The tracing information includes the device_id
to indicate the device the event is associated with.
v2: Use variable sized variant to display dev name(Gustavo)
v3: Pass single argument to __assign_str to fix kunit error
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
---
drivers/gpu/drm/xe/xe_trace_bo.h | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_trace_bo.h b/drivers/gpu/drm/xe/xe_trace_bo.h
index c8bd746d9d41..4f45408c3cce 100644
--- a/drivers/gpu/drm/xe/xe_trace_bo.h
+++ b/drivers/gpu/drm/xe/xe_trace_bo.h
@@ -9,6 +9,7 @@
#if !defined(_XE_TRACE_BO_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _XE_TRACE_BO_H_
+#include <linux/string_helpers.h>
#include <linux/tracepoint.h>
#include <linux/types.h>
@@ -16,24 +17,31 @@
#include "xe_bo_types.h"
#include "xe_vm.h"
+#define __dev_name_bo(bo) dev_name(xe_bo_device((bo))->drm.dev)
+#define __dev_name_vm(vm) dev_name((vm)->xe->drm.dev)
+#define __dev_name_vma(vma) __dev_name_vm(xe_vma_vm(vma))
+
DECLARE_EVENT_CLASS(xe_bo,
TP_PROTO(struct xe_bo *bo),
TP_ARGS(bo),
TP_STRUCT__entry(
+ __string(dev, __dev_name_bo(bo))
__field(size_t, size)
__field(u32, flags)
__field(struct xe_vm *, vm)
),
TP_fast_assign(
+ __assign_str(dev);
__entry->size = bo->size;
__entry->flags = bo->flags;
__entry->vm = bo->vm;
),
- TP_printk("size=%zu, flags=0x%02x, vm=%p",
- __entry->size, __entry->flags, __entry->vm)
+ TP_printk("dev=%s, size=%zu, flags=0x%02x, vm=%p",
+ __get_str(dev), __entry->size,
+ __entry->flags, __entry->vm)
);
DEFINE_EVENT(xe_bo, xe_bo_cpu_fault,
@@ -50,7 +58,7 @@ TRACE_EVENT(xe_bo_move,
__field(size_t, size)
__field(u32, new_placement)
__field(u32, old_placement)
- __array(char, device_id, 12)
+ __string(device_id, __dev_name_bo(bo))
__field(bool, move_lacks_source)
),
@@ -59,13 +67,13 @@ TRACE_EVENT(xe_bo_move,
__entry->size = bo->size;
__entry->new_placement = new_placement;
__entry->old_placement = old_placement;
- strscpy(__entry->device_id, dev_name(xe_bo_device(__entry->bo)->drm.dev), 12);
+ __assign_str(device_id);
__entry->move_lacks_source = move_lacks_source;
),
TP_printk("move_lacks_source:%s, migrate object %p [size %zu] from %s to %s device_id:%s",
__entry->move_lacks_source ? "yes" : "no", __entry->bo, __entry->size,
xe_mem_type_to_name[__entry->old_placement],
- xe_mem_type_to_name[__entry->new_placement], __entry->device_id)
+ xe_mem_type_to_name[__entry->new_placement], __get_str(device_id))
);
DECLARE_EVENT_CLASS(xe_vma,
@@ -73,6 +81,7 @@ DECLARE_EVENT_CLASS(xe_vma,
TP_ARGS(vma),
TP_STRUCT__entry(
+ __string(dev, __dev_name_vma(vma))
__field(struct xe_vma *, vma)
__field(u32, asid)
__field(u64, start)
@@ -81,6 +90,7 @@ DECLARE_EVENT_CLASS(xe_vma,
),
TP_fast_assign(
+ __assign_str(dev);
__entry->vma = vma;
__entry->asid = xe_vma_vm(vma)->usm.asid;
__entry->start = xe_vma_start(vma);
@@ -88,8 +98,8 @@ DECLARE_EVENT_CLASS(xe_vma,
__entry->ptr = xe_vma_userptr(vma);
),
- TP_printk("vma=%p, asid=0x%05x, start=0x%012llx, end=0x%012llx, userptr=0x%012llx,",
- __entry->vma, __entry->asid, __entry->start,
+ TP_printk("dev=%s, vma=%p, asid=0x%05x, start=0x%012llx, end=0x%012llx, userptr=0x%012llx,",
+ __get_str(dev), __entry->vma, __entry->asid, __entry->start,
__entry->end, __entry->ptr)
)
@@ -173,17 +183,19 @@ DECLARE_EVENT_CLASS(xe_vm,
TP_ARGS(vm),
TP_STRUCT__entry(
+ __string(dev, __dev_name_vm(vm))
__field(struct xe_vm *, vm)
__field(u32, asid)
),
TP_fast_assign(
+ __assign_str(dev);
__entry->vm = vm;
__entry->asid = vm->usm.asid;
),
- TP_printk("vm=%p, asid=0x%05x", __entry->vm,
- __entry->asid)
+ TP_printk("dev=%s, vm=%p, asid=0x%05x", __get_str(dev),
+ __entry->vm, __entry->asid)
);
DEFINE_EVENT(xe_vm, xe_vm_kill,
--
2.34.1
next prev parent reply other threads:[~2024-06-06 22:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 22:38 [PATCH v5 0/6] Tracing cleanup and add mmio tracing Radhakrishna Sripada
2024-06-06 22:38 ` [PATCH v5 1/6] drm/xe/trace: Extract bo, vm, vma traces Radhakrishna Sripada
2024-06-06 22:38 ` [PATCH v5 2/6] drm/xe/trace: Extract guc related traces Radhakrishna Sripada
2024-06-06 22:38 ` Radhakrishna Sripada [this message]
2024-06-07 13:23 ` [PATCH v5 3/6] drm/xe/trace: Print device_id in xe_trace_bo events Gustavo Sousa
2024-06-06 22:38 ` [PATCH v5 4/6] drm/xe/trace: Print device_id in xe_trace_guc events Radhakrishna Sripada
2024-06-07 13:50 ` Gustavo Sousa
2024-06-06 22:38 ` [PATCH v5 5/6] drm/xe/trace: Print device_id in xe_trace events Radhakrishna Sripada
2024-06-07 14:35 ` Gustavo Sousa
2024-06-06 22:38 ` [PATCH v5 6/6] drm/xe: Add reg read/write trace Radhakrishna Sripada
2024-06-07 14:52 ` Gustavo Sousa
2024-06-06 22:45 ` ✓ CI.Patch_applied: success for Tracing cleanup and add mmio tracing (rev3) Patchwork
2024-06-06 22:45 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-06 22:46 ` ✓ CI.KUnit: success " Patchwork
2024-06-06 22:58 ` ✓ CI.Build: " Patchwork
2024-06-06 23:00 ` ✓ CI.Hooks: " Patchwork
2024-06-06 23:02 ` ✓ CI.checksparse: " Patchwork
2024-06-06 23:44 ` ✓ CI.BAT: " Patchwork
2024-06-07 8:37 ` ✗ 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=20240606223819.3545560-4-radhakrishna.sripada@intel.com \
--to=radhakrishna.sripada@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=ville.syrjala@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