Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/trace: Print device_id in xe_trace_guc events

In multi-gpu environments it is important to know the device
guc txn 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
v4: Minor formatting tweaks

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240607182943.3572524-5-radhakrishna.sripada@intel.com

authored by

Radhakrishna Sripada and committed by
Matt Roper
3cba2f1d 3432f26e

+33 -25
+6 -5
drivers/gpu/drm/xe/xe_guc_ct.c
··· 571 571 /* Update descriptor */ 572 572 desc_write(xe, h2g, tail, h2g->info.tail); 573 573 574 - trace_xe_guc_ctb_h2g(gt->info.id, *(action - 1), full_len, 574 + trace_xe_guc_ctb_h2g(xe, gt->info.id, *(action - 1), full_len, 575 575 desc_read(xe, h2g, head), h2g->info.tail); 576 576 577 577 return 0; ··· 684 684 u32 g2h_len, u32 num_g2h, 685 685 struct g2h_fence *g2h_fence) 686 686 { 687 + struct xe_device *xe = ct_to_xe(ct); 687 688 struct xe_gt *gt = ct_to_gt(ct); 688 689 struct drm_printer p = xe_gt_info_printer(gt); 689 690 unsigned int sleep_period_ms = 1; ··· 712 711 if (sleep_period_ms == 1024) 713 712 goto broken; 714 713 715 - trace_xe_guc_ct_h2g_flow_control(h2g->info.head, h2g->info.tail, 714 + trace_xe_guc_ct_h2g_flow_control(xe, h2g->info.head, h2g->info.tail, 716 715 h2g->info.size, 717 716 h2g->info.space, 718 717 len + GUC_CTB_HDR_LEN); ··· 724 723 struct xe_device *xe = ct_to_xe(ct); 725 724 struct guc_ctb *g2h = &ct->ctbs.g2h; 726 725 727 - trace_xe_guc_ct_g2h_flow_control(g2h->info.head, 726 + trace_xe_guc_ct_g2h_flow_control(xe, g2h->info.head, 728 727 desc_read(xe, g2h, tail), 729 728 g2h->info.size, 730 729 g2h->info.space, ··· 1214 1213 g2h->info.head = (head + avail) % g2h->info.size; 1215 1214 desc_write(xe, g2h, head, g2h->info.head); 1216 1215 1217 - trace_xe_guc_ctb_g2h(ct_to_gt(ct)->info.id, action, len, 1218 - g2h->info.head, tail); 1216 + trace_xe_guc_ctb_g2h(xe, ct_to_gt(ct)->info.id, 1217 + action, len, g2h->info.head, tail); 1219 1218 1220 1219 return len; 1221 1220 }
+27 -20
drivers/gpu/drm/xe/xe_trace_guc.h
··· 12 12 #include <linux/tracepoint.h> 13 13 #include <linux/types.h> 14 14 15 + #include "xe_device_types.h" 15 16 #include "xe_guc_exec_queue_types.h" 16 17 18 + #define __dev_name_xe(xe) dev_name((xe)->drm.dev) 19 + 17 20 DECLARE_EVENT_CLASS(xe_guc_ct_flow_control, 18 - TP_PROTO(u32 _head, u32 _tail, u32 size, u32 space, u32 len), 19 - TP_ARGS(_head, _tail, size, space, len), 21 + TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len), 22 + TP_ARGS(xe, _head, _tail, size, space, len), 20 23 21 24 TP_STRUCT__entry( 25 + __string(dev, __dev_name_xe(xe)) 22 26 __field(u32, _head) 23 27 __field(u32, _tail) 24 28 __field(u32, size) ··· 31 27 ), 32 28 33 29 TP_fast_assign( 30 + __assign_str(dev); 34 31 __entry->_head = _head; 35 32 __entry->_tail = _tail; 36 33 __entry->size = size; ··· 39 34 __entry->len = len; 40 35 ), 41 36 42 - TP_printk("h2g flow control: head=%u, tail=%u, size=%u, space=%u, len=%u", 43 - __entry->_head, __entry->_tail, __entry->size, 37 + TP_printk("h2g flow control: dev=%s, head=%u, tail=%u, size=%u, space=%u, len=%u", 38 + __get_str(dev), __entry->_head, __entry->_tail, __entry->size, 44 39 __entry->space, __entry->len) 45 40 ); 46 41 47 42 DEFINE_EVENT(xe_guc_ct_flow_control, xe_guc_ct_h2g_flow_control, 48 - TP_PROTO(u32 _head, u32 _tail, u32 size, u32 space, u32 len), 49 - TP_ARGS(_head, _tail, size, space, len) 43 + TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len), 44 + TP_ARGS(xe, _head, _tail, size, space, len) 50 45 ); 51 46 52 47 DEFINE_EVENT_PRINT(xe_guc_ct_flow_control, xe_guc_ct_g2h_flow_control, 53 - TP_PROTO(u32 _head, u32 _tail, u32 size, u32 space, u32 len), 54 - TP_ARGS(_head, _tail, size, space, len), 48 + TP_PROTO(struct xe_device *xe, u32 _head, u32 _tail, u32 size, u32 space, u32 len), 49 + TP_ARGS(xe, _head, _tail, size, space, len), 55 50 56 - TP_printk("g2h flow control: head=%u, tail=%u, size=%u, space=%u, len=%u", 57 - __entry->_head, __entry->_tail, __entry->size, 51 + TP_printk("g2h flow control: dev=%s, head=%u, tail=%u, size=%u, space=%u, len=%u", 52 + __get_str(dev), __entry->_head, __entry->_tail, __entry->size, 58 53 __entry->space, __entry->len) 59 54 ); 60 55 61 56 DECLARE_EVENT_CLASS(xe_guc_ctb, 62 - TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 63 - TP_ARGS(gt_id, action, len, _head, tail), 57 + TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 58 + TP_ARGS(xe, gt_id, action, len, _head, tail), 64 59 65 60 TP_STRUCT__entry( 61 + __string(dev, __dev_name_xe(xe)) 66 62 __field(u8, gt_id) 67 63 __field(u32, action) 68 64 __field(u32, len) ··· 72 66 ), 73 67 74 68 TP_fast_assign( 69 + __assign_str(dev); 75 70 __entry->gt_id = gt_id; 76 71 __entry->action = action; 77 72 __entry->len = len; ··· 80 73 __entry->_head = _head; 81 74 ), 82 75 83 - TP_printk("gt%d: H2G CTB: action=0x%x, len=%d, tail=%d, head=%d\n", 84 - __entry->gt_id, __entry->action, __entry->len, 76 + TP_printk("H2G CTB: dev=%s, gt%d: action=0x%x, len=%d, tail=%d, head=%d\n", 77 + __get_str(dev), __entry->gt_id, __entry->action, __entry->len, 85 78 __entry->tail, __entry->_head) 86 79 ); 87 80 88 81 DEFINE_EVENT(xe_guc_ctb, xe_guc_ctb_h2g, 89 - TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 90 - TP_ARGS(gt_id, action, len, _head, tail) 82 + TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 83 + TP_ARGS(xe, gt_id, action, len, _head, tail) 91 84 ); 92 85 93 86 DEFINE_EVENT_PRINT(xe_guc_ctb, xe_guc_ctb_g2h, 94 - TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 95 - TP_ARGS(gt_id, action, len, _head, tail), 87 + TP_PROTO(struct xe_device *xe, u8 gt_id, u32 action, u32 len, u32 _head, u32 tail), 88 + TP_ARGS(xe, gt_id, action, len, _head, tail), 96 89 97 - TP_printk("gt%d: G2H CTB: action=0x%x, len=%d, tail=%d, head=%d\n", 98 - __entry->gt_id, __entry->action, __entry->len, 90 + TP_printk("G2H CTB: dev=%s, gt%d: action=0x%x, len=%d, tail=%d, head=%d\n", 91 + __get_str(dev), __entry->gt_id, __entry->action, __entry->len, 99 92 __entry->tail, __entry->_head) 100 93 101 94 );