mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Add more trace coverage to amdxdna job handling and mailbox receive processing to make driver execution easier to debug. Extend the xdna_job trace event to record the command opcode in addition to the job sequence number. Use the enhanced tracepoint in the job run, sent-to-device, signaled-fence, and job-free paths so that trace output can be correlated with the command being executed. Also add debug-point tracing when a command is received through the submit ioctl path, and add a trace event when the mailbox RX worker runs. These changes improve visibility into job lifetime transitions and mailbox activity, which helps debug command flow and scheduler issues. Signed-off-by: Max Zhen <max.zhen@amd.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Link: https://patch.msgid.link/20260421181502.1970263-1-lizhi.hou@amd.com
116 lines
3.1 KiB
C
116 lines
3.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2023-2024, Advanced Micro Devices, Inc.
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM amdxdna
|
|
|
|
#if !defined(_TRACE_AMDXDNA_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_AMDXDNA_H
|
|
|
|
#include <drm/gpu_scheduler.h>
|
|
#include <linux/tracepoint.h>
|
|
|
|
TRACE_EVENT(amdxdna_debug_point,
|
|
TP_PROTO(const char *name, u64 number, const char *str),
|
|
|
|
TP_ARGS(name, number, str),
|
|
|
|
TP_STRUCT__entry(__string(name, name)
|
|
__field(u64, number)
|
|
__string(str, str)),
|
|
|
|
TP_fast_assign(__assign_str(name);
|
|
__entry->number = number;
|
|
__assign_str(str);),
|
|
|
|
TP_printk("%s:%llu %s", __get_str(name), __entry->number,
|
|
__get_str(str))
|
|
);
|
|
|
|
TRACE_EVENT(xdna_job,
|
|
TP_PROTO(struct drm_sched_job *sched_job, const char *name,
|
|
const char *str, u64 seq, u32 op),
|
|
|
|
TP_ARGS(sched_job, name, str, seq, op),
|
|
|
|
TP_STRUCT__entry(__string(name, name)
|
|
__string(str, str)
|
|
__field(u64, fence_context)
|
|
__field(u64, fence_seqno)
|
|
__field(u64, seq)
|
|
__field(u32, op)),
|
|
|
|
TP_fast_assign(__assign_str(name);
|
|
__assign_str(str);
|
|
__entry->fence_context = sched_job->s_fence->finished.context;
|
|
__entry->fence_seqno = sched_job->s_fence->finished.seqno;
|
|
__entry->seq = seq;
|
|
__entry->op = op;),
|
|
|
|
TP_printk("fence=(context:%llu, seqno:%llu), %s seq#:%llu %s, op=%u",
|
|
__entry->fence_context, __entry->fence_seqno,
|
|
__get_str(name), __entry->seq,
|
|
__get_str(str),
|
|
__entry->op)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xdna_mbox_msg,
|
|
TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 msg_id),
|
|
|
|
TP_ARGS(name, chann_id, opcode, msg_id),
|
|
|
|
TP_STRUCT__entry(__string(name, name)
|
|
__field(u32, chann_id)
|
|
__field(u32, opcode)
|
|
__field(u32, msg_id)),
|
|
|
|
TP_fast_assign(__assign_str(name);
|
|
__entry->chann_id = chann_id;
|
|
__entry->opcode = opcode;
|
|
__entry->msg_id = msg_id;),
|
|
|
|
TP_printk("%s.%d id 0x%x opcode 0x%x", __get_str(name),
|
|
__entry->chann_id, __entry->msg_id, __entry->opcode)
|
|
);
|
|
|
|
DEFINE_EVENT(xdna_mbox_msg, mbox_set_tail,
|
|
TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 id),
|
|
TP_ARGS(name, chann_id, opcode, id)
|
|
);
|
|
|
|
DEFINE_EVENT(xdna_mbox_msg, mbox_set_head,
|
|
TP_PROTO(char *name, u8 chann_id, u32 opcode, u32 id),
|
|
TP_ARGS(name, chann_id, opcode, id)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xdna_mbox_name_id,
|
|
TP_PROTO(char *name, int irq),
|
|
|
|
TP_ARGS(name, irq),
|
|
|
|
TP_STRUCT__entry(__string(name, name)
|
|
__field(int, irq)),
|
|
|
|
TP_fast_assign(__assign_str(name);
|
|
__entry->irq = irq;),
|
|
|
|
TP_printk("%s.%d", __get_str(name), __entry->irq)
|
|
);
|
|
|
|
DEFINE_EVENT(xdna_mbox_name_id, mbox_irq_handle,
|
|
TP_PROTO(char *name, int irq),
|
|
TP_ARGS(name, irq)
|
|
);
|
|
|
|
DEFINE_EVENT(xdna_mbox_name_id, mbox_rx_worker,
|
|
TP_PROTO(char *name, int irq),
|
|
TP_ARGS(name, irq)
|
|
);
|
|
|
|
#endif /* !defined(_TRACE_AMDXDNA_H) || defined(TRACE_HEADER_MULTI_READ) */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|