2018-08-16 22:26:55 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2009-09-13 06:17:15 +07:00
|
|
|
/*
|
|
|
|
* This file defines the trace event structures that go into the ring
|
|
|
|
* buffer directly. They are created via macros so that changes for them
|
|
|
|
* appear in the format file. Using macros will automate this process.
|
|
|
|
*
|
|
|
|
* The macro used to create a ftrace data structure is:
|
|
|
|
*
|
|
|
|
* FTRACE_ENTRY( name, struct_name, id, structure, print )
|
|
|
|
*
|
|
|
|
* @name: the name used the event name, as well as the name of
|
|
|
|
* the directory that holds the format file.
|
|
|
|
*
|
|
|
|
* @struct_name: the name of the structure that is created.
|
|
|
|
*
|
|
|
|
* @id: The event identifier that is used to detect what event
|
|
|
|
* this is from the ring buffer.
|
|
|
|
*
|
|
|
|
* @structure: the structure layout
|
|
|
|
*
|
|
|
|
* - __field( type, item )
|
|
|
|
* This is equivalent to declaring
|
|
|
|
* type item;
|
|
|
|
* in the structure.
|
|
|
|
* - __array( type, item, size )
|
|
|
|
* This is equivalent to declaring
|
|
|
|
* type item[size];
|
|
|
|
* in the structure.
|
|
|
|
*
|
2009-09-13 06:22:23 +07:00
|
|
|
* * for structures within structures, the format of the internal
|
2011-03-31 08:57:33 +07:00
|
|
|
* structure is laid out. This allows the internal structure
|
2009-09-13 06:22:23 +07:00
|
|
|
* to be deciphered for the format file. Although these macros
|
|
|
|
* may become out of sync with the internal structure, they
|
|
|
|
* will create a compile error if it happens. Since the
|
|
|
|
* internel structures are just tracing helpers, this is not
|
|
|
|
* an issue.
|
|
|
|
*
|
|
|
|
* When an internal structure is used, it should use:
|
|
|
|
*
|
|
|
|
* __field_struct( type, item )
|
|
|
|
*
|
|
|
|
* instead of __field. This will prevent it from being shown in
|
|
|
|
* the output file. The fields in the structure should use.
|
|
|
|
*
|
|
|
|
* __field_desc( type, container, item )
|
|
|
|
* __array_desc( type, container, item, len )
|
|
|
|
*
|
|
|
|
* type, item and len are the same as __field and __array, but
|
|
|
|
* container is added. This is the name of the item in
|
|
|
|
* __field_struct that this is describing.
|
|
|
|
*
|
|
|
|
*
|
2009-09-13 06:17:15 +07:00
|
|
|
* @print: the print format shown to users in the format file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-02 02:38:34 +07:00
|
|
|
* Function trace entry - function address and parent function address:
|
2009-09-13 06:17:15 +07:00
|
|
|
*/
|
2012-02-15 21:51:52 +07:00
|
|
|
FTRACE_ENTRY_REG(function, ftrace_entry,
|
2009-09-13 06:17:15 +07:00
|
|
|
|
|
|
|
TRACE_FN,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2019-10-25 03:26:59 +07:00
|
|
|
__field_fn( unsigned long, ip )
|
|
|
|
__field_fn( unsigned long, parent_ip )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2019-02-09 23:19:19 +07:00
|
|
|
F_printk(" %ps <-- %ps",
|
|
|
|
(void *)__entry->ip, (void *)__entry->parent_ip),
|
2012-02-15 21:51:52 +07:00
|
|
|
|
|
|
|
perf_ftrace_event_register
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/* Function call entry */
|
2016-06-29 17:56:48 +07:00
|
|
|
FTRACE_ENTRY_PACKED(funcgraph_entry, ftrace_graph_ent_entry,
|
2009-09-13 06:17:15 +07:00
|
|
|
|
|
|
|
TRACE_GRAPH_ENT,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_struct( struct ftrace_graph_ent, graph_ent )
|
|
|
|
__field_desc( unsigned long, graph_ent, func )
|
|
|
|
__field_desc( int, graph_ent, depth )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2019-10-25 03:26:59 +07:00
|
|
|
F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/* Function return entry */
|
2016-06-29 17:56:48 +07:00
|
|
|
FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry,
|
2009-09-13 06:17:15 +07:00
|
|
|
|
|
|
|
TRACE_GRAPH_RET,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_struct( struct ftrace_graph_ret, ret )
|
|
|
|
__field_desc( unsigned long, ret, func )
|
2019-10-25 03:26:59 +07:00
|
|
|
__field_desc( unsigned long, ret, overrun )
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_desc( unsigned long long, ret, calltime)
|
|
|
|
__field_desc( unsigned long long, ret, rettime )
|
|
|
|
__field_desc( int, ret, depth )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2019-02-09 23:19:19 +07:00
|
|
|
F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",
|
|
|
|
(void *)__entry->func, __entry->depth,
|
2009-09-14 14:51:39 +07:00
|
|
|
__entry->calltime, __entry->rettime,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->depth)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Context switch trace entry - which task (and prio) we switched from/to:
|
|
|
|
*
|
|
|
|
* This is used for both wakeup and context switches. We only want
|
|
|
|
* to create one structure, but we need two outputs for it.
|
|
|
|
*/
|
|
|
|
#define FTRACE_CTX_FIELDS \
|
|
|
|
__field( unsigned int, prev_pid ) \
|
2010-12-04 07:13:19 +07:00
|
|
|
__field( unsigned int, next_pid ) \
|
|
|
|
__field( unsigned int, next_cpu ) \
|
2009-09-13 06:17:15 +07:00
|
|
|
__field( unsigned char, prev_prio ) \
|
|
|
|
__field( unsigned char, prev_state ) \
|
|
|
|
__field( unsigned char, next_prio ) \
|
2010-12-04 07:13:19 +07:00
|
|
|
__field( unsigned char, next_state )
|
2009-09-13 06:17:15 +07:00
|
|
|
|
|
|
|
FTRACE_ENTRY(context_switch, ctx_switch_entry,
|
|
|
|
|
|
|
|
TRACE_CTX,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
FTRACE_CTX_FIELDS
|
|
|
|
),
|
|
|
|
|
2009-09-14 14:51:39 +07:00
|
|
|
F_printk("%u:%u:%u ==> %u:%u:%u [%03u]",
|
2009-09-13 06:17:15 +07:00
|
|
|
__entry->prev_pid, __entry->prev_prio, __entry->prev_state,
|
|
|
|
__entry->next_pid, __entry->next_prio, __entry->next_state,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->next_cpu)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FTRACE_ENTRY_DUP only creates the format file, it will not
|
|
|
|
* create another structure.
|
|
|
|
*/
|
|
|
|
FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry,
|
|
|
|
|
|
|
|
TRACE_WAKE,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
FTRACE_CTX_FIELDS
|
|
|
|
),
|
|
|
|
|
|
|
|
F_printk("%u:%u:%u ==+ %u:%u:%u [%03u]",
|
|
|
|
__entry->prev_pid, __entry->prev_prio, __entry->prev_state,
|
|
|
|
__entry->next_pid, __entry->next_prio, __entry->next_state,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->next_cpu)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stack-trace entry:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define FTRACE_STACK_ENTRIES 8
|
|
|
|
|
|
|
|
FTRACE_ENTRY(kernel_stack, stack_entry,
|
|
|
|
|
|
|
|
TRACE_STACK,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2011-07-15 03:36:53 +07:00
|
|
|
__field( int, size )
|
2014-09-25 03:14:12 +07:00
|
|
|
__array( unsigned long, caller, FTRACE_STACK_ENTRIES )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2019-02-09 23:19:19 +07:00
|
|
|
F_printk("\t=> %ps\n\t=> %ps\n\t=> %ps\n"
|
|
|
|
"\t=> %ps\n\t=> %ps\n\t=> %ps\n"
|
|
|
|
"\t=> %ps\n\t=> %ps\n",
|
|
|
|
(void *)__entry->caller[0], (void *)__entry->caller[1],
|
|
|
|
(void *)__entry->caller[2], (void *)__entry->caller[3],
|
|
|
|
(void *)__entry->caller[4], (void *)__entry->caller[5],
|
2019-10-25 03:26:59 +07:00
|
|
|
(void *)__entry->caller[6], (void *)__entry->caller[7])
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
FTRACE_ENTRY(user_stack, userstack_entry,
|
|
|
|
|
|
|
|
TRACE_USER_STACK,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned int, tgid )
|
|
|
|
__array( unsigned long, caller, FTRACE_STACK_ENTRIES )
|
|
|
|
),
|
|
|
|
|
2019-02-09 23:19:19 +07:00
|
|
|
F_printk("\t=> %ps\n\t=> %ps\n\t=> %ps\n"
|
|
|
|
"\t=> %ps\n\t=> %ps\n\t=> %ps\n"
|
|
|
|
"\t=> %ps\n\t=> %ps\n",
|
|
|
|
(void *)__entry->caller[0], (void *)__entry->caller[1],
|
|
|
|
(void *)__entry->caller[2], (void *)__entry->caller[3],
|
|
|
|
(void *)__entry->caller[4], (void *)__entry->caller[5],
|
2019-10-25 03:26:59 +07:00
|
|
|
(void *)__entry->caller[6], (void *)__entry->caller[7])
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* trace_printk entry:
|
|
|
|
*/
|
|
|
|
FTRACE_ENTRY(bprint, bprint_entry,
|
|
|
|
|
|
|
|
TRACE_BPRINT,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned long, ip )
|
|
|
|
__field( const char *, fmt )
|
|
|
|
__dynamic_array( u32, buf )
|
|
|
|
),
|
|
|
|
|
2015-03-12 10:13:57 +07:00
|
|
|
F_printk("%ps: %s",
|
2019-10-25 03:26:59 +07:00
|
|
|
(void *)__entry->ip, __entry->fmt)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
2018-05-10 01:17:48 +07:00
|
|
|
FTRACE_ENTRY_REG(print, print_entry,
|
2009-09-13 06:17:15 +07:00
|
|
|
|
|
|
|
TRACE_PRINT,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned long, ip )
|
|
|
|
__dynamic_array( char, buf )
|
|
|
|
),
|
|
|
|
|
2015-03-12 10:13:57 +07:00
|
|
|
F_printk("%ps: %s",
|
2013-03-09 09:02:34 +07:00
|
|
|
(void *)__entry->ip, __entry->buf),
|
|
|
|
|
2018-05-10 01:17:48 +07:00
|
|
|
ftrace_event_register
|
2013-03-09 09:02:34 +07:00
|
|
|
);
|
|
|
|
|
2016-07-07 02:25:08 +07:00
|
|
|
FTRACE_ENTRY(raw_data, raw_data_entry,
|
|
|
|
|
|
|
|
TRACE_RAW_DATA,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned int, id )
|
|
|
|
__dynamic_array( char, buf )
|
|
|
|
),
|
|
|
|
|
|
|
|
F_printk("id:%04x %08x",
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->id, (int)__entry->buf[0])
|
2016-07-07 02:25:08 +07:00
|
|
|
);
|
|
|
|
|
2013-03-09 09:02:34 +07:00
|
|
|
FTRACE_ENTRY(bputs, bputs_entry,
|
|
|
|
|
|
|
|
TRACE_BPUTS,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned long, ip )
|
|
|
|
__field( const char *, str )
|
|
|
|
),
|
|
|
|
|
2015-03-12 10:13:57 +07:00
|
|
|
F_printk("%ps: %s",
|
2019-10-25 03:26:59 +07:00
|
|
|
(void *)__entry->ip, __entry->str)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,
|
|
|
|
|
|
|
|
TRACE_MMIO_RW,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_struct( struct mmiotrace_rw, rw )
|
|
|
|
__field_desc( resource_size_t, rw, phys )
|
|
|
|
__field_desc( unsigned long, rw, value )
|
|
|
|
__field_desc( unsigned long, rw, pc )
|
2019-10-25 03:26:59 +07:00
|
|
|
__field_desc( int, rw, map_id )
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_desc( unsigned char, rw, opcode )
|
|
|
|
__field_desc( unsigned char, rw, width )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2009-09-14 14:51:39 +07:00
|
|
|
F_printk("%lx %lx %lx %d %x %x",
|
|
|
|
(unsigned long)__entry->phys, __entry->value, __entry->pc,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->map_id, __entry->opcode, __entry->width)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,
|
|
|
|
|
|
|
|
TRACE_MMIO_MAP,
|
|
|
|
|
|
|
|
F_STRUCT(
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_struct( struct mmiotrace_map, map )
|
|
|
|
__field_desc( resource_size_t, map, phys )
|
|
|
|
__field_desc( unsigned long, map, virt )
|
|
|
|
__field_desc( unsigned long, map, len )
|
2019-10-25 03:26:59 +07:00
|
|
|
__field_desc( int, map, map_id )
|
2009-09-13 06:22:23 +07:00
|
|
|
__field_desc( unsigned char, map, opcode )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2009-09-14 14:51:39 +07:00
|
|
|
F_printk("%lx %lx %lx %d %x",
|
|
|
|
(unsigned long)__entry->phys, __entry->virt, __entry->len,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->map_id, __entry->opcode)
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
#define TRACE_FUNC_SIZE 30
|
|
|
|
#define TRACE_FILE_SIZE 20
|
|
|
|
|
|
|
|
FTRACE_ENTRY(branch, trace_branch,
|
|
|
|
|
|
|
|
TRACE_BRANCH,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( unsigned int, line )
|
|
|
|
__array( char, func, TRACE_FUNC_SIZE+1 )
|
|
|
|
__array( char, file, TRACE_FILE_SIZE+1 )
|
|
|
|
__field( char, correct )
|
2017-01-19 20:57:41 +07:00
|
|
|
__field( char, constant )
|
2009-09-13 06:17:15 +07:00
|
|
|
),
|
|
|
|
|
2017-01-19 20:57:41 +07:00
|
|
|
F_printk("%u:%s:%s (%u)%s",
|
2009-09-13 06:17:15 +07:00
|
|
|
__entry->line,
|
2017-01-19 20:57:41 +07:00
|
|
|
__entry->func, __entry->file, __entry->correct,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->constant ? " CONSTANT" : "")
|
2009-09-13 06:17:15 +07:00
|
|
|
);
|
|
|
|
|
2016-06-23 23:45:36 +07:00
|
|
|
|
|
|
|
FTRACE_ENTRY(hwlat, hwlat_entry,
|
|
|
|
|
|
|
|
TRACE_HWLAT,
|
|
|
|
|
|
|
|
F_STRUCT(
|
|
|
|
__field( u64, duration )
|
|
|
|
__field( u64, outer_duration )
|
2016-08-04 23:49:53 +07:00
|
|
|
__field( u64, nmi_total_ts )
|
2017-05-09 05:59:13 +07:00
|
|
|
__field_struct( struct timespec64, timestamp )
|
|
|
|
__field_desc( s64, timestamp, tv_sec )
|
2016-06-23 23:45:36 +07:00
|
|
|
__field_desc( long, timestamp, tv_nsec )
|
2016-08-04 23:49:53 +07:00
|
|
|
__field( unsigned int, nmi_count )
|
2016-06-23 23:45:36 +07:00
|
|
|
__field( unsigned int, seqnum )
|
2020-02-13 00:21:03 +07:00
|
|
|
__field( unsigned int, count )
|
2016-06-23 23:45:36 +07:00
|
|
|
),
|
|
|
|
|
2020-02-13 00:21:03 +07:00
|
|
|
F_printk("cnt:%u\tts:%010llu.%010lu\tinner:%llu\touter:%llu\tcount:%d\tnmi-ts:%llu\tnmi-count:%u\n",
|
2016-06-23 23:45:36 +07:00
|
|
|
__entry->seqnum,
|
|
|
|
__entry->tv_sec,
|
|
|
|
__entry->tv_nsec,
|
|
|
|
__entry->duration,
|
2016-08-04 23:49:53 +07:00
|
|
|
__entry->outer_duration,
|
2020-02-13 00:21:03 +07:00
|
|
|
__entry->count,
|
2016-08-04 23:49:53 +07:00
|
|
|
__entry->nmi_total_ts,
|
2019-10-25 03:26:59 +07:00
|
|
|
__entry->nmi_count)
|
2016-06-23 23:45:36 +07:00
|
|
|
);
|