diff options
Diffstat (limited to 'kernel/trace/trace.h')
| -rw-r--r-- | kernel/trace/trace.h | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 2e29d7ba5a52..9e82551dd566 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -190,7 +190,22 @@ struct trace_array { | |||
| 190 | */ | 190 | */ |
| 191 | struct trace_buffer max_buffer; | 191 | struct trace_buffer max_buffer; |
| 192 | bool allocated_snapshot; | 192 | bool allocated_snapshot; |
| 193 | unsigned long max_latency; | ||
| 193 | #endif | 194 | #endif |
| 195 | /* | ||
| 196 | * max_lock is used to protect the swapping of buffers | ||
| 197 | * when taking a max snapshot. The buffers themselves are | ||
| 198 | * protected by per_cpu spinlocks. But the action of the swap | ||
| 199 | * needs its own lock. | ||
| 200 | * | ||
| 201 | * This is defined as a arch_spinlock_t in order to help | ||
| 202 | * with performance when lockdep debugging is enabled. | ||
| 203 | * | ||
| 204 | * It is also used in other places outside the update_max_tr | ||
| 205 | * so it needs to be defined outside of the | ||
| 206 | * CONFIG_TRACER_MAX_TRACE. | ||
| 207 | */ | ||
| 208 | arch_spinlock_t max_lock; | ||
| 194 | int buffer_disabled; | 209 | int buffer_disabled; |
| 195 | #ifdef CONFIG_FTRACE_SYSCALLS | 210 | #ifdef CONFIG_FTRACE_SYSCALLS |
| 196 | int sys_refcount_enter; | 211 | int sys_refcount_enter; |
| @@ -237,6 +252,9 @@ static inline struct trace_array *top_trace_array(void) | |||
| 237 | { | 252 | { |
| 238 | struct trace_array *tr; | 253 | struct trace_array *tr; |
| 239 | 254 | ||
| 255 | if (list_empty(ftrace_trace_arrays.prev)) | ||
| 256 | return NULL; | ||
| 257 | |||
| 240 | tr = list_entry(ftrace_trace_arrays.prev, | 258 | tr = list_entry(ftrace_trace_arrays.prev, |
| 241 | typeof(*tr), list); | 259 | typeof(*tr), list); |
| 242 | WARN_ON(!(tr->flags & TRACE_ARRAY_FL_GLOBAL)); | 260 | WARN_ON(!(tr->flags & TRACE_ARRAY_FL_GLOBAL)); |
| @@ -323,7 +341,6 @@ struct tracer_flags { | |||
| 323 | * @stop: called when tracing is paused (echo 0 > tracing_enabled) | 341 | * @stop: called when tracing is paused (echo 0 > tracing_enabled) |
| 324 | * @open: called when the trace file is opened | 342 | * @open: called when the trace file is opened |
| 325 | * @pipe_open: called when the trace_pipe file is opened | 343 | * @pipe_open: called when the trace_pipe file is opened |
| 326 | * @wait_pipe: override how the user waits for traces on trace_pipe | ||
| 327 | * @close: called when the trace file is released | 344 | * @close: called when the trace file is released |
| 328 | * @pipe_close: called when the trace_pipe file is released | 345 | * @pipe_close: called when the trace_pipe file is released |
| 329 | * @read: override the default read callback on trace_pipe | 346 | * @read: override the default read callback on trace_pipe |
| @@ -342,7 +359,6 @@ struct tracer { | |||
| 342 | void (*stop)(struct trace_array *tr); | 359 | void (*stop)(struct trace_array *tr); |
| 343 | void (*open)(struct trace_iterator *iter); | 360 | void (*open)(struct trace_iterator *iter); |
| 344 | void (*pipe_open)(struct trace_iterator *iter); | 361 | void (*pipe_open)(struct trace_iterator *iter); |
| 345 | void (*wait_pipe)(struct trace_iterator *iter); | ||
| 346 | void (*close)(struct trace_iterator *iter); | 362 | void (*close)(struct trace_iterator *iter); |
| 347 | void (*pipe_close)(struct trace_iterator *iter); | 363 | void (*pipe_close)(struct trace_iterator *iter); |
| 348 | ssize_t (*read)(struct trace_iterator *iter, | 364 | ssize_t (*read)(struct trace_iterator *iter, |
| @@ -416,13 +432,7 @@ enum { | |||
| 416 | TRACE_FTRACE_IRQ_BIT, | 432 | TRACE_FTRACE_IRQ_BIT, |
| 417 | TRACE_FTRACE_SIRQ_BIT, | 433 | TRACE_FTRACE_SIRQ_BIT, |
| 418 | 434 | ||
| 419 | /* GLOBAL_BITs must be greater than FTRACE_BITs */ | 435 | /* INTERNAL_BITs must be greater than FTRACE_BITs */ |
| 420 | TRACE_GLOBAL_BIT, | ||
| 421 | TRACE_GLOBAL_NMI_BIT, | ||
| 422 | TRACE_GLOBAL_IRQ_BIT, | ||
| 423 | TRACE_GLOBAL_SIRQ_BIT, | ||
| 424 | |||
| 425 | /* INTERNAL_BITs must be greater than GLOBAL_BITs */ | ||
| 426 | TRACE_INTERNAL_BIT, | 436 | TRACE_INTERNAL_BIT, |
| 427 | TRACE_INTERNAL_NMI_BIT, | 437 | TRACE_INTERNAL_NMI_BIT, |
| 428 | TRACE_INTERNAL_IRQ_BIT, | 438 | TRACE_INTERNAL_IRQ_BIT, |
| @@ -449,9 +459,6 @@ enum { | |||
| 449 | #define TRACE_FTRACE_START TRACE_FTRACE_BIT | 459 | #define TRACE_FTRACE_START TRACE_FTRACE_BIT |
| 450 | #define TRACE_FTRACE_MAX ((1 << (TRACE_FTRACE_START + TRACE_CONTEXT_BITS)) - 1) | 460 | #define TRACE_FTRACE_MAX ((1 << (TRACE_FTRACE_START + TRACE_CONTEXT_BITS)) - 1) |
| 451 | 461 | ||
| 452 | #define TRACE_GLOBAL_START TRACE_GLOBAL_BIT | ||
| 453 | #define TRACE_GLOBAL_MAX ((1 << (TRACE_GLOBAL_START + TRACE_CONTEXT_BITS)) - 1) | ||
| 454 | |||
| 455 | #define TRACE_LIST_START TRACE_INTERNAL_BIT | 462 | #define TRACE_LIST_START TRACE_INTERNAL_BIT |
| 456 | #define TRACE_LIST_MAX ((1 << (TRACE_LIST_START + TRACE_CONTEXT_BITS)) - 1) | 463 | #define TRACE_LIST_MAX ((1 << (TRACE_LIST_START + TRACE_CONTEXT_BITS)) - 1) |
| 457 | 464 | ||
| @@ -560,8 +567,6 @@ void trace_init_global_iter(struct trace_iterator *iter); | |||
| 560 | 567 | ||
| 561 | void tracing_iter_reset(struct trace_iterator *iter, int cpu); | 568 | void tracing_iter_reset(struct trace_iterator *iter, int cpu); |
| 562 | 569 | ||
| 563 | void poll_wait_pipe(struct trace_iterator *iter); | ||
| 564 | |||
| 565 | void tracing_sched_switch_trace(struct trace_array *tr, | 570 | void tracing_sched_switch_trace(struct trace_array *tr, |
| 566 | struct task_struct *prev, | 571 | struct task_struct *prev, |
| 567 | struct task_struct *next, | 572 | struct task_struct *next, |
| @@ -608,8 +613,6 @@ extern unsigned long nsecs_to_usecs(unsigned long nsecs); | |||
| 608 | extern unsigned long tracing_thresh; | 613 | extern unsigned long tracing_thresh; |
| 609 | 614 | ||
| 610 | #ifdef CONFIG_TRACER_MAX_TRACE | 615 | #ifdef CONFIG_TRACER_MAX_TRACE |
| 611 | extern unsigned long tracing_max_latency; | ||
| 612 | |||
| 613 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | 616 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); |
| 614 | void update_max_tr_single(struct trace_array *tr, | 617 | void update_max_tr_single(struct trace_array *tr, |
| 615 | struct task_struct *tsk, int cpu); | 618 | struct task_struct *tsk, int cpu); |
| @@ -724,6 +727,8 @@ extern unsigned long trace_flags; | |||
| 724 | #define TRACE_GRAPH_PRINT_PROC 0x8 | 727 | #define TRACE_GRAPH_PRINT_PROC 0x8 |
| 725 | #define TRACE_GRAPH_PRINT_DURATION 0x10 | 728 | #define TRACE_GRAPH_PRINT_DURATION 0x10 |
| 726 | #define TRACE_GRAPH_PRINT_ABS_TIME 0x20 | 729 | #define TRACE_GRAPH_PRINT_ABS_TIME 0x20 |
| 730 | #define TRACE_GRAPH_PRINT_IRQS 0x40 | ||
| 731 | #define TRACE_GRAPH_PRINT_TAIL 0x80 | ||
| 727 | #define TRACE_GRAPH_PRINT_FILL_SHIFT 28 | 732 | #define TRACE_GRAPH_PRINT_FILL_SHIFT 28 |
| 728 | #define TRACE_GRAPH_PRINT_FILL_MASK (0x3 << TRACE_GRAPH_PRINT_FILL_SHIFT) | 733 | #define TRACE_GRAPH_PRINT_FILL_MASK (0x3 << TRACE_GRAPH_PRINT_FILL_SHIFT) |
| 729 | 734 | ||
| @@ -823,6 +828,10 @@ extern int ftrace_is_dead(void); | |||
| 823 | int ftrace_create_function_files(struct trace_array *tr, | 828 | int ftrace_create_function_files(struct trace_array *tr, |
| 824 | struct dentry *parent); | 829 | struct dentry *parent); |
| 825 | void ftrace_destroy_function_files(struct trace_array *tr); | 830 | void ftrace_destroy_function_files(struct trace_array *tr); |
| 831 | void ftrace_init_global_array_ops(struct trace_array *tr); | ||
| 832 | void ftrace_init_array_ops(struct trace_array *tr, ftrace_func_t func); | ||
| 833 | void ftrace_reset_array_ops(struct trace_array *tr); | ||
| 834 | int using_ftrace_ops_list_func(void); | ||
| 826 | #else | 835 | #else |
| 827 | static inline int ftrace_trace_task(struct task_struct *task) | 836 | static inline int ftrace_trace_task(struct task_struct *task) |
| 828 | { | 837 | { |
| @@ -836,6 +845,11 @@ ftrace_create_function_files(struct trace_array *tr, | |||
| 836 | return 0; | 845 | return 0; |
| 837 | } | 846 | } |
| 838 | static inline void ftrace_destroy_function_files(struct trace_array *tr) { } | 847 | static inline void ftrace_destroy_function_files(struct trace_array *tr) { } |
| 848 | static inline __init void | ||
| 849 | ftrace_init_global_array_ops(struct trace_array *tr) { } | ||
| 850 | static inline void ftrace_reset_array_ops(struct trace_array *tr) { } | ||
| 851 | /* ftace_func_t type is not defined, use macro instead of static inline */ | ||
| 852 | #define ftrace_init_array_ops(tr, func) do { } while (0) | ||
| 839 | #endif /* CONFIG_FUNCTION_TRACER */ | 853 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 840 | 854 | ||
| 841 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE) | 855 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE) |
