diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-06 22:30:20 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-06 22:30:20 +0100 |
commit | 22402cd0af685c1a5d067c87db3051db7fff7709 (patch) | |
tree | 4f06ef31f643be28f3d4c92821df36b8ff321d9b /include/trace | |
parent | Merge tag 'for-v4.4-important-fix' of git://git.kernel.org/pub/scm/linux/kern... (diff) | |
parent | tracefs: Fix refcount imbalance in start_creating() (diff) | |
download | linux-22402cd0af685c1a5d067c87db3051db7fff7709.tar.xz linux-22402cd0af685c1a5d067c87db3051db7fff7709.zip |
Merge tag 'trace-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracking updates from Steven Rostedt:
"Most of the changes are clean ups and small fixes. Some of them have
stable tags to them. I searched through my INBOX just as the merge
window opened and found lots of patches to pull. I ran them through
all my tests and they were in linux-next for a few days.
Features added this release:
----------------------------
- Module globbing. You can now filter function tracing to several
modules. # echo '*:mod:*snd*' > set_ftrace_filter (Dmitry Safonov)
- Tracer specific options are now visible even when the tracer is not
active. It was rather annoying that you can only see and modify
tracer options after enabling the tracer. Now they are in the
options/ directory even when the tracer is not active. Although
they are still only visible when the tracer is active in the
trace_options file.
- Trace options are now per instance (although some of the tracer
specific options are global)
- New tracefs file: set_event_pid. If any pid is added to this file,
then all events in the instance will filter out events that are not
part of this pid. sched_switch and sched_wakeup events handle next
and the wakee pids"
* tag 'trace-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (68 commits)
tracefs: Fix refcount imbalance in start_creating()
tracing: Put back comma for empty fields in boot string parsing
tracing: Apply tracer specific options from kernel command line.
tracing: Add some documentation about set_event_pid
ring_buffer: Remove unneeded smp_wmb() before wakeup of reader benchmark
tracing: Allow dumping traces without tracking trace started cpus
ring_buffer: Fix more races when terminating the producer in the benchmark
ring_buffer: Do no not complete benchmark reader too early
tracing: Remove redundant TP_ARGS redefining
tracing: Rename max_stack_lock to stack_trace_max_lock
tracing: Allow arch-specific stack tracer
recordmcount: arm64: Replace the ignored mcount call into nop
recordmcount: Fix endianness handling bug for nop_mcount
tracepoints: Fix documentation of RCU lockdep checks
tracing: ftrace_event_is_function() can return boolean
tracing: is_legal_op() can return boolean
ring-buffer: rb_event_is_commit() can return boolean
ring-buffer: rb_per_cpu_empty() can return boolean
ring_buffer: ring_buffer_empty{cpu}() can return boolean
ring-buffer: rb_is_reader_page() can return boolean
...
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/define_trace.h | 2 | ||||
-rw-r--r-- | include/trace/events/gpio.h | 4 | ||||
-rw-r--r-- | include/trace/perf.h | 258 | ||||
-rw-r--r-- | include/trace/trace_events.h | 258 |
4 files changed, 263 insertions, 259 deletions
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index 09b3880105a9..2d8639ea64d5 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -86,7 +86,7 @@ #undef DECLARE_TRACE #define DECLARE_TRACE(name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#ifdef TRACEPOINTS_ENABLED #include <trace/trace_events.h> #include <trace/perf.h> #endif diff --git a/include/trace/events/gpio.h b/include/trace/events/gpio.h index 927a8ad9e51b..2da73b92d47e 100644 --- a/include/trace/events/gpio.h +++ b/include/trace/events/gpio.h @@ -1,6 +1,10 @@ #undef TRACE_SYSTEM #define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif + #if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_GPIO_H diff --git a/include/trace/perf.h b/include/trace/perf.h index 1b5443cebedc..26486fcd74ce 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -1,261 +1,3 @@ -/* - * Stage 4 of the trace events. - * - * Override the macros in <trace/trace_events.h> to include the following: - * - * For those macros defined with TRACE_EVENT: - * - * static struct trace_event_call event_<call>; - * - * static void trace_event_raw_event_<call>(void *__data, proto) - * { - * struct trace_event_file *trace_file = __data; - * struct trace_event_call *event_call = trace_file->event_call; - * struct trace_event_data_offsets_<call> __maybe_unused __data_offsets; - * unsigned long eflags = trace_file->flags; - * enum event_trigger_type __tt = ETT_NONE; - * struct ring_buffer_event *event; - * struct trace_event_raw_<call> *entry; <-- defined in stage 1 - * struct ring_buffer *buffer; - * unsigned long irq_flags; - * int __data_size; - * int pc; - * - * if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) { - * if (eflags & EVENT_FILE_FL_TRIGGER_MODE) - * event_triggers_call(trace_file, NULL); - * if (eflags & EVENT_FILE_FL_SOFT_DISABLED) - * return; - * } - * - * local_save_flags(irq_flags); - * pc = preempt_count(); - * - * __data_size = trace_event_get_offsets_<call>(&__data_offsets, args); - * - * event = trace_event_buffer_lock_reserve(&buffer, trace_file, - * event_<call>->event.type, - * sizeof(*entry) + __data_size, - * irq_flags, pc); - * if (!event) - * return; - * entry = ring_buffer_event_data(event); - * - * { <assign>; } <-- Here we assign the entries by the __field and - * __array macros. - * - * if (eflags & EVENT_FILE_FL_TRIGGER_COND) - * __tt = event_triggers_call(trace_file, entry); - * - * if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, - * &trace_file->flags)) - * ring_buffer_discard_commit(buffer, event); - * else if (!filter_check_discard(trace_file, entry, buffer, event)) - * trace_buffer_unlock_commit(buffer, event, irq_flags, pc); - * - * if (__tt) - * event_triggers_post_call(trace_file, __tt); - * } - * - * static struct trace_event ftrace_event_type_<call> = { - * .trace = trace_raw_output_<call>, <-- stage 2 - * }; - * - * static char print_fmt_<call>[] = <TP_printk>; - * - * static struct trace_event_class __used event_class_<template> = { - * .system = "<system>", - * .define_fields = trace_event_define_fields_<call>, - * .fields = LIST_HEAD_INIT(event_class_##call.fields), - * .raw_init = trace_event_raw_init, - * .probe = trace_event_raw_event_##call, - * .reg = trace_event_reg, - * }; - * - * static struct trace_event_call event_<call> = { - * .class = event_class_<template>, - * { - * .tp = &__tracepoint_<call>, - * }, - * .event = &ftrace_event_type_<call>, - * .print_fmt = print_fmt_<call>, - * .flags = TRACE_EVENT_FL_TRACEPOINT, - * }; - * // its only safe to use pointers when doing linker tricks to - * // create an array. - * static struct trace_event_call __used - * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>; - * - */ - -#ifdef CONFIG_PERF_EVENTS - -#define _TRACE_PERF_PROTO(call, proto) \ - static notrace void \ - perf_trace_##call(void *__data, proto); - -#define _TRACE_PERF_INIT(call) \ - .perf_probe = perf_trace_##call, - -#else -#define _TRACE_PERF_PROTO(call, proto) -#define _TRACE_PERF_INIT(call) -#endif /* CONFIG_PERF_EVENTS */ - -#undef __entry -#define __entry entry - -#undef __field -#define __field(type, item) - -#undef __field_struct -#define __field_struct(type, item) - -#undef __array -#define __array(type, item, len) - -#undef __dynamic_array -#define __dynamic_array(type, item, len) \ - __entry->__data_loc_##item = __data_offsets.item; - -#undef __string -#define __string(item, src) __dynamic_array(char, item, -1) - -#undef __assign_str -#define __assign_str(dst, src) \ - strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); - -#undef __bitmask -#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) - -#undef __get_bitmask -#define __get_bitmask(field) (char *)__get_dynamic_array(field) - -#undef __assign_bitmask -#define __assign_bitmask(dst, src, nr_bits) \ - memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) - -#undef TP_fast_assign -#define TP_fast_assign(args...) args - -#undef __perf_addr -#define __perf_addr(a) (a) - -#undef __perf_count -#define __perf_count(c) (c) - -#undef __perf_task -#define __perf_task(t) (t) - -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ - \ -static notrace void \ -trace_event_raw_event_##call(void *__data, proto) \ -{ \ - struct trace_event_file *trace_file = __data; \ - struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\ - struct trace_event_buffer fbuffer; \ - struct trace_event_raw_##call *entry; \ - int __data_size; \ - \ - if (trace_trigger_soft_disabled(trace_file)) \ - return; \ - \ - __data_size = trace_event_get_offsets_##call(&__data_offsets, args); \ - \ - entry = trace_event_buffer_reserve(&fbuffer, trace_file, \ - sizeof(*entry) + __data_size); \ - \ - if (!entry) \ - return; \ - \ - tstruct \ - \ - { assign; } \ - \ - trace_event_buffer_commit(&fbuffer); \ -} -/* - * The ftrace_test_probe is compiled out, it is only here as a build time check - * to make sure that if the tracepoint handling changes, the ftrace probe will - * fail to compile unless it too is updated. - */ - -#undef DEFINE_EVENT -#define DEFINE_EVENT(template, call, proto, args) \ -static inline void ftrace_test_probe_##call(void) \ -{ \ - check_trace_callback_type_##call(trace_event_raw_event_##template); \ -} - -#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT(template, name, proto, args, print) - -#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) - -#undef __entry -#define __entry REC - -#undef __print_flags -#undef __print_symbolic -#undef __print_hex -#undef __get_dynamic_array -#undef __get_dynamic_array_len -#undef __get_str -#undef __get_bitmask -#undef __print_array - -#undef TP_printk -#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) - -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ -_TRACE_PERF_PROTO(call, PARAMS(proto)); \ -static char print_fmt_##call[] = print; \ -static struct trace_event_class __used __refdata event_class_##call = { \ - .system = TRACE_SYSTEM_STRING, \ - .define_fields = trace_event_define_fields_##call, \ - .fields = LIST_HEAD_INIT(event_class_##call.fields),\ - .raw_init = trace_event_raw_init, \ - .probe = trace_event_raw_event_##call, \ - .reg = trace_event_reg, \ - _TRACE_PERF_INIT(call) \ -}; - -#undef DEFINE_EVENT -#define DEFINE_EVENT(template, call, proto, args) \ - \ -static struct trace_event_call __used event_##call = { \ - .class = &event_class_##template, \ - { \ - .tp = &__tracepoint_##call, \ - }, \ - .event.funcs = &trace_event_type_funcs_##template, \ - .print_fmt = print_fmt_##template, \ - .flags = TRACE_EVENT_FL_TRACEPOINT, \ -}; \ -static struct trace_event_call __used \ -__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call - -#undef DEFINE_EVENT_PRINT -#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ - \ -static char print_fmt_##call[] = print; \ - \ -static struct trace_event_call __used event_##call = { \ - .class = &event_class_##template, \ - { \ - .tp = &__tracepoint_##call, \ - }, \ - .event.funcs = &trace_event_type_funcs_##call, \ - .print_fmt = print_fmt_##call, \ - .flags = TRACE_EVENT_FL_TRACEPOINT, \ -}; \ -static struct trace_event_call __used \ -__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call - -#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) #undef TRACE_SYSTEM_VAR diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 43be3b0e44d3..de996cf61053 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -506,3 +506,261 @@ static inline notrace int trace_event_get_offsets_##call( \ #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +/* + * Stage 4 of the trace events. + * + * Override the macros in <trace/trace_events.h> to include the following: + * + * For those macros defined with TRACE_EVENT: + * + * static struct trace_event_call event_<call>; + * + * static void trace_event_raw_event_<call>(void *__data, proto) + * { + * struct trace_event_file *trace_file = __data; + * struct trace_event_call *event_call = trace_file->event_call; + * struct trace_event_data_offsets_<call> __maybe_unused __data_offsets; + * unsigned long eflags = trace_file->flags; + * enum event_trigger_type __tt = ETT_NONE; + * struct ring_buffer_event *event; + * struct trace_event_raw_<call> *entry; <-- defined in stage 1 + * struct ring_buffer *buffer; + * unsigned long irq_flags; + * int __data_size; + * int pc; + * + * if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) { + * if (eflags & EVENT_FILE_FL_TRIGGER_MODE) + * event_triggers_call(trace_file, NULL); + * if (eflags & EVENT_FILE_FL_SOFT_DISABLED) + * return; + * } + * + * local_save_flags(irq_flags); + * pc = preempt_count(); + * + * __data_size = trace_event_get_offsets_<call>(&__data_offsets, args); + * + * event = trace_event_buffer_lock_reserve(&buffer, trace_file, + * event_<call>->event.type, + * sizeof(*entry) + __data_size, + * irq_flags, pc); + * if (!event) + * return; + * entry = ring_buffer_event_data(event); + * + * { <assign>; } <-- Here we assign the entries by the __field and + * __array macros. + * + * if (eflags & EVENT_FILE_FL_TRIGGER_COND) + * __tt = event_triggers_call(trace_file, entry); + * + * if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, + * &trace_file->flags)) + * ring_buffer_discard_commit(buffer, event); + * else if (!filter_check_discard(trace_file, entry, buffer, event)) + * trace_buffer_unlock_commit(buffer, event, irq_flags, pc); + * + * if (__tt) + * event_triggers_post_call(trace_file, __tt); + * } + * + * static struct trace_event ftrace_event_type_<call> = { + * .trace = trace_raw_output_<call>, <-- stage 2 + * }; + * + * static char print_fmt_<call>[] = <TP_printk>; + * + * static struct trace_event_class __used event_class_<template> = { + * .system = "<system>", + * .define_fields = trace_event_define_fields_<call>, + * .fields = LIST_HEAD_INIT(event_class_##call.fields), + * .raw_init = trace_event_raw_init, + * .probe = trace_event_raw_event_##call, + * .reg = trace_event_reg, + * }; + * + * static struct trace_event_call event_<call> = { + * .class = event_class_<template>, + * { + * .tp = &__tracepoint_<call>, + * }, + * .event = &ftrace_event_type_<call>, + * .print_fmt = print_fmt_<call>, + * .flags = TRACE_EVENT_FL_TRACEPOINT, + * }; + * // its only safe to use pointers when doing linker tricks to + * // create an array. + * static struct trace_event_call __used + * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>; + * + */ + +#ifdef CONFIG_PERF_EVENTS + +#define _TRACE_PERF_PROTO(call, proto) \ + static notrace void \ + perf_trace_##call(void *__data, proto); + +#define _TRACE_PERF_INIT(call) \ + .perf_probe = perf_trace_##call, + +#else +#define _TRACE_PERF_PROTO(call, proto) +#define _TRACE_PERF_INIT(call) +#endif /* CONFIG_PERF_EVENTS */ + +#undef __entry +#define __entry entry + +#undef __field +#define __field(type, item) + +#undef __field_struct +#define __field_struct(type, item) + +#undef __array +#define __array(type, item, len) + +#undef __dynamic_array +#define __dynamic_array(type, item, len) \ + __entry->__data_loc_##item = __data_offsets.item; + +#undef __string +#define __string(item, src) __dynamic_array(char, item, -1) + +#undef __assign_str +#define __assign_str(dst, src) \ + strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); + +#undef __bitmask +#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) + +#undef __get_bitmask +#define __get_bitmask(field) (char *)__get_dynamic_array(field) + +#undef __assign_bitmask +#define __assign_bitmask(dst, src, nr_bits) \ + memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) + +#undef TP_fast_assign +#define TP_fast_assign(args...) args + +#undef __perf_addr +#define __perf_addr(a) (a) + +#undef __perf_count +#define __perf_count(c) (c) + +#undef __perf_task +#define __perf_task(t) (t) + +#undef DECLARE_EVENT_CLASS +#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ + \ +static notrace void \ +trace_event_raw_event_##call(void *__data, proto) \ +{ \ + struct trace_event_file *trace_file = __data; \ + struct trace_event_data_offsets_##call __maybe_unused __data_offsets;\ + struct trace_event_buffer fbuffer; \ + struct trace_event_raw_##call *entry; \ + int __data_size; \ + \ + if (trace_trigger_soft_disabled(trace_file)) \ + return; \ + \ + __data_size = trace_event_get_offsets_##call(&__data_offsets, args); \ + \ + entry = trace_event_buffer_reserve(&fbuffer, trace_file, \ + sizeof(*entry) + __data_size); \ + \ + if (!entry) \ + return; \ + \ + tstruct \ + \ + { assign; } \ + \ + trace_event_buffer_commit(&fbuffer); \ +} +/* + * The ftrace_test_probe is compiled out, it is only here as a build time check + * to make sure that if the tracepoint handling changes, the ftrace probe will + * fail to compile unless it too is updated. + */ + +#undef DEFINE_EVENT +#define DEFINE_EVENT(template, call, proto, args) \ +static inline void ftrace_test_probe_##call(void) \ +{ \ + check_trace_callback_type_##call(trace_event_raw_event_##template); \ +} + +#undef DEFINE_EVENT_PRINT +#define DEFINE_EVENT_PRINT(template, name, proto, args, print) + +#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) + +#undef __entry +#define __entry REC + +#undef __print_flags +#undef __print_symbolic +#undef __print_hex +#undef __get_dynamic_array +#undef __get_dynamic_array_len +#undef __get_str +#undef __get_bitmask +#undef __print_array + +#undef TP_printk +#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) + +#undef DECLARE_EVENT_CLASS +#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ +_TRACE_PERF_PROTO(call, PARAMS(proto)); \ +static char print_fmt_##call[] = print; \ +static struct trace_event_class __used __refdata event_class_##call = { \ + .system = TRACE_SYSTEM_STRING, \ + .define_fields = trace_event_define_fields_##call, \ + .fields = LIST_HEAD_INIT(event_class_##call.fields),\ + .raw_init = trace_event_raw_init, \ + .probe = trace_event_raw_event_##call, \ + .reg = trace_event_reg, \ + _TRACE_PERF_INIT(call) \ +}; + +#undef DEFINE_EVENT +#define DEFINE_EVENT(template, call, proto, args) \ + \ +static struct trace_event_call __used event_##call = { \ + .class = &event_class_##template, \ + { \ + .tp = &__tracepoint_##call, \ + }, \ + .event.funcs = &trace_event_type_funcs_##template, \ + .print_fmt = print_fmt_##template, \ + .flags = TRACE_EVENT_FL_TRACEPOINT, \ +}; \ +static struct trace_event_call __used \ +__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call + +#undef DEFINE_EVENT_PRINT +#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ + \ +static char print_fmt_##call[] = print; \ + \ +static struct trace_event_call __used event_##call = { \ + .class = &event_class_##template, \ + { \ + .tp = &__tracepoint_##call, \ + }, \ + .event.funcs = &trace_event_type_funcs_##call, \ + .print_fmt = print_fmt_##call, \ + .flags = TRACE_EVENT_FL_TRACEPOINT, \ +}; \ +static struct trace_event_call __used \ +__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call + +#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |