2018-08-16 15:26:55 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2008-12-24 04:24:12 +00:00
|
|
|
#ifndef __TRACE_EVENTS_H
|
|
|
|
#define __TRACE_EVENTS_H
|
|
|
|
|
tracing: make trace_seq operations available for core kernel
In the process to make TRACE_EVENT macro work for modules, the trace_seq
operations must be available for core kernel code.
These operations are quite useful and can be used for other implementations.
The main idea is that we create a trace_seq handle that acts very much
like the seq_file handle.
struct trace_seq *s = kmalloc(sizeof(*s, GFP_KERNEL);
trace_seq_init(s);
trace_seq_printf(s, "some data %d\n", variable);
printk("%s", s->buffer);
The main use is to allow a top level function call several other functions
that may store printf like data into the buffer. Then at the end, the top
level function can process all the data with any method it would like to.
It could be passed to userspace, output via printk or even use seq_file:
trace_seq_to_user(s, ubuf, cnt);
seq_puts(m, s->buffer);
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2009-04-11 16:59:57 +00:00
|
|
|
#include <linux/trace_seq.h>
|
2008-12-24 04:24:12 +00:00
|
|
|
#include "trace.h"
|
|
|
|
|
2013-03-09 02:02:34 +00:00
|
|
|
extern enum print_line_t
|
|
|
|
trace_print_bputs_msg_only(struct trace_iterator *iter);
|
2009-03-19 16:20:38 +00:00
|
|
|
extern enum print_line_t
|
|
|
|
trace_print_bprintk_msg_only(struct trace_iterator *iter);
|
|
|
|
extern enum print_line_t
|
|
|
|
trace_print_printk_msg_only(struct trace_iterator *iter);
|
|
|
|
|
2009-03-06 16:21:49 +00:00
|
|
|
extern int
|
2008-12-24 04:24:12 +00:00
|
|
|
seq_print_ip_sym(struct trace_seq *s, unsigned long ip,
|
|
|
|
unsigned long sym_flags);
|
|
|
|
|
2020-11-06 02:32:46 +00:00
|
|
|
extern void trace_seq_print_sym(struct trace_seq *s, unsigned long address, bool offset);
|
2009-03-23 13:12:23 +00:00
|
|
|
extern int trace_print_context(struct trace_iterator *iter);
|
|
|
|
extern int trace_print_lat_context(struct trace_iterator *iter);
|
2023-03-28 18:51:56 +00:00
|
|
|
extern enum print_line_t print_event_fields(struct trace_iterator *iter,
|
|
|
|
struct trace_event *event);
|
2009-02-02 22:29:21 +00:00
|
|
|
|
2009-05-18 11:35:34 +00:00
|
|
|
extern void trace_event_read_lock(void);
|
|
|
|
extern void trace_event_read_unlock(void);
|
2009-03-23 13:12:23 +00:00
|
|
|
extern struct trace_event *ftrace_find_event(int type);
|
2008-12-24 04:24:12 +00:00
|
|
|
|
2009-03-23 13:12:23 +00:00
|
|
|
extern enum print_line_t trace_nop_print(struct trace_iterator *iter,
|
2010-04-22 22:46:14 +00:00
|
|
|
int flags, struct trace_event *event);
|
2009-09-11 18:24:13 +00:00
|
|
|
extern int
|
|
|
|
trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry);
|
2008-12-24 04:24:13 +00:00
|
|
|
|
2009-06-09 21:29:07 +00:00
|
|
|
/* used by module unregistering */
|
2015-05-05 13:39:12 +00:00
|
|
|
extern int __unregister_trace_event(struct trace_event *event);
|
2013-03-11 07:14:03 +00:00
|
|
|
extern struct rw_semaphore trace_event_sem;
|
2009-06-09 21:29:07 +00:00
|
|
|
|
2014-11-12 15:29:54 +00:00
|
|
|
#define SEQ_PUT_FIELD(s, x) \
|
|
|
|
trace_seq_putmem(s, &(x), sizeof(x))
|
|
|
|
|
|
|
|
#define SEQ_PUT_HEX_FIELD(s, x) \
|
|
|
|
trace_seq_putmem_hex(s, &(x), sizeof(x))
|
2008-12-24 04:24:13 +00:00
|
|
|
|
ftrace: Add print_function_args()
Add a function to decode argument types with the help of BTF. Will
be used to display arguments in the function and function graph
tracer.
It can only handle simply arguments and up to FTRACE_REGS_MAX_ARGS number
of arguments. When it hits a max, it will print ", ...":
page_to_skb(vi=0xffff8d53842dc980, rq=0xffff8d53843a0800, page=0xfffffc2e04337c00, offset=6160, len=64, truesize=1536, ...)
And if it hits an argument that is not recognized, it will print the raw
value and the type of argument it is:
make_vfsuid(idmap=0xffffffff87f99db8, fs_userns=0xffffffff87e543c0, kuid=0x0 (STRUCT))
__pti_set_user_pgtbl(pgdp=0xffff8d5384ab47f8, pgd=0x110e74067 (STRUCT))
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Guo Ren <guoren@kernel.org>
Cc: Donglin Peng <dolinux.peng@gmail.com>
Cc: Zheng Yejian <zhengyejian@huaweicloud.com>
Link: https://lore.kernel.org/20250227185822.639418500@goodmis.org
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Co-developed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-02-27 18:58:05 +00:00
|
|
|
#ifdef CONFIG_FUNCTION_TRACE_ARGS
|
|
|
|
void print_function_args(struct trace_seq *s, unsigned long *args,
|
|
|
|
unsigned long func);
|
|
|
|
#else
|
|
|
|
static inline void print_function_args(struct trace_seq *s, unsigned long *args,
|
|
|
|
unsigned long func) {
|
|
|
|
trace_seq_puts(s, "()");
|
|
|
|
}
|
|
|
|
#endif
|
2008-12-24 04:24:12 +00:00
|
|
|
#endif
|
|
|
|
|