Merge tag 'trace-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt:
"Updates for tracing and bootconfig:
- Add support for "bool" type in synthetic events
- Add per instance tracing for bootconfig
- Support perf-style return probe ("SYMBOL%return") in kprobes and
uprobes
- Allow for kprobes to be enabled earlier in boot up
- Added tracepoint helper function to allow testing if tracepoints
are enabled in headers
- Synthetic events can now have dynamic strings (variable length)
- Various fixes and cleanups"
* tag 'trace-v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (58 commits)
tracing: support "bool" type in synthetic trace events
selftests/ftrace: Add test case for synthetic event syntax errors
tracing: Handle synthetic event array field type checking correctly
selftests/ftrace: Change synthetic event name for inter-event-combined test
tracing: Add synthetic event error logging
tracing: Check that the synthetic event and field names are legal
tracing: Move is_good_name() from trace_probe.h to trace.h
tracing: Don't show dynamic string internals in synthetic event description
tracing: Fix some typos in comments
tracing/boot: Add ftrace.instance.*.alloc_snapshot option
tracing: Fix race in trace_open and buffer resize call
tracing: Check return value of __create_val_fields() before using its result
tracing: Fix synthetic print fmt check for use of __get_str()
tracing: Remove a pointless assignment
ftrace: ftrace_global_list is renamed to ftrace_ops_list
ftrace: Format variable declarations of ftrace_allocate_records
ftrace: Simplify the calculation of page number for ftrace_page->records
ftrace: Simplify the dyn_ftrace->flags macro
ftrace: Simplify the hash calculation
ftrace: Use fls() to get the bits for dup_hash()
...
This commit is contained in:
@@ -53,4 +53,38 @@ struct bpf_raw_event_map {
|
||||
u32 writable_size;
|
||||
} __aligned(32);
|
||||
|
||||
/*
|
||||
* If a tracepoint needs to be called from a header file, it is not
|
||||
* recommended to call it directly, as tracepoints in header files
|
||||
* may cause side-effects and bloat the kernel. Instead, use
|
||||
* tracepoint_enabled() to test if the tracepoint is enabled, then if
|
||||
* it is, call a wrapper function defined in a C file that will then
|
||||
* call the tracepoint.
|
||||
*
|
||||
* For "trace_foo_bar()", you would need to create a wrapper function
|
||||
* in a C file to call trace_foo_bar():
|
||||
* void do_trace_foo_bar(args) { trace_foo_bar(args); }
|
||||
* Then in the header file, declare the tracepoint:
|
||||
* DECLARE_TRACEPOINT(foo_bar);
|
||||
* And call your wrapper:
|
||||
* static inline void some_inlined_function() {
|
||||
* [..]
|
||||
* if (tracepoint_enabled(foo_bar))
|
||||
* do_trace_foo_bar(args);
|
||||
* [..]
|
||||
* }
|
||||
*
|
||||
* Note: tracepoint_enabled(foo_bar) is equivalent to trace_foo_bar_enabled()
|
||||
* but is safe to have in headers, where trace_foo_bar_enabled() is not.
|
||||
*/
|
||||
#define DECLARE_TRACEPOINT(tp) \
|
||||
extern struct tracepoint __tracepoint_##tp
|
||||
|
||||
#ifdef CONFIG_TRACEPOINTS
|
||||
# define tracepoint_enabled(tp) \
|
||||
static_key_false(&(__tracepoint_##tp).key)
|
||||
#else
|
||||
# define tracepoint_enabled(tracepoint) false
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user