diff options
Diffstat (limited to 'kernel/trace/trace.h')
| -rw-r--r-- | kernel/trace/trace.h | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4df6a77eb196..d1ce0bec1b3f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -34,7 +34,6 @@ enum trace_type { | |||
| 34 | TRACE_GRAPH_RET, | 34 | TRACE_GRAPH_RET, |
| 35 | TRACE_GRAPH_ENT, | 35 | TRACE_GRAPH_ENT, |
| 36 | TRACE_USER_STACK, | 36 | TRACE_USER_STACK, |
| 37 | TRACE_HW_BRANCHES, | ||
| 38 | TRACE_KMEM_ALLOC, | 37 | TRACE_KMEM_ALLOC, |
| 39 | TRACE_KMEM_FREE, | 38 | TRACE_KMEM_FREE, |
| 40 | TRACE_BLK, | 39 | TRACE_BLK, |
| @@ -103,29 +102,17 @@ struct syscall_trace_exit { | |||
| 103 | long ret; | 102 | long ret; |
| 104 | }; | 103 | }; |
| 105 | 104 | ||
| 106 | struct kprobe_trace_entry { | 105 | struct kprobe_trace_entry_head { |
| 107 | struct trace_entry ent; | 106 | struct trace_entry ent; |
| 108 | unsigned long ip; | 107 | unsigned long ip; |
| 109 | int nargs; | ||
| 110 | unsigned long args[]; | ||
| 111 | }; | 108 | }; |
| 112 | 109 | ||
| 113 | #define SIZEOF_KPROBE_TRACE_ENTRY(n) \ | 110 | struct kretprobe_trace_entry_head { |
| 114 | (offsetof(struct kprobe_trace_entry, args) + \ | ||
| 115 | (sizeof(unsigned long) * (n))) | ||
| 116 | |||
| 117 | struct kretprobe_trace_entry { | ||
| 118 | struct trace_entry ent; | 111 | struct trace_entry ent; |
| 119 | unsigned long func; | 112 | unsigned long func; |
| 120 | unsigned long ret_ip; | 113 | unsigned long ret_ip; |
| 121 | int nargs; | ||
| 122 | unsigned long args[]; | ||
| 123 | }; | 114 | }; |
| 124 | 115 | ||
| 125 | #define SIZEOF_KRETPROBE_TRACE_ENTRY(n) \ | ||
| 126 | (offsetof(struct kretprobe_trace_entry, args) + \ | ||
| 127 | (sizeof(unsigned long) * (n))) | ||
| 128 | |||
| 129 | /* | 116 | /* |
| 130 | * trace_flag_type is an enumeration that holds different | 117 | * trace_flag_type is an enumeration that holds different |
| 131 | * states when a trace occurs. These are: | 118 | * states when a trace occurs. These are: |
| @@ -229,7 +216,6 @@ extern void __ftrace_bad_type(void); | |||
| 229 | TRACE_GRAPH_ENT); \ | 216 | TRACE_GRAPH_ENT); \ |
| 230 | IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ | 217 | IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ |
| 231 | TRACE_GRAPH_RET); \ | 218 | TRACE_GRAPH_RET); \ |
| 232 | IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ | ||
| 233 | IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ | 219 | IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ |
| 234 | TRACE_KMEM_ALLOC); \ | 220 | TRACE_KMEM_ALLOC); \ |
| 235 | IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ | 221 | IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ |
| @@ -378,6 +364,9 @@ void trace_function(struct trace_array *tr, | |||
| 378 | unsigned long ip, | 364 | unsigned long ip, |
| 379 | unsigned long parent_ip, | 365 | unsigned long parent_ip, |
| 380 | unsigned long flags, int pc); | 366 | unsigned long flags, int pc); |
| 367 | void trace_default_header(struct seq_file *m); | ||
| 368 | void print_trace_header(struct seq_file *m, struct trace_iterator *iter); | ||
| 369 | int trace_empty(struct trace_iterator *iter); | ||
| 381 | 370 | ||
| 382 | void trace_graph_return(struct ftrace_graph_ret *trace); | 371 | void trace_graph_return(struct ftrace_graph_ret *trace); |
| 383 | int trace_graph_entry(struct ftrace_graph_ent *trace); | 372 | int trace_graph_entry(struct ftrace_graph_ent *trace); |
| @@ -396,9 +385,10 @@ extern int process_new_ksym_entry(char *ksymname, int op, unsigned long addr); | |||
| 396 | 385 | ||
| 397 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); | 386 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); |
| 398 | 387 | ||
| 388 | extern unsigned long tracing_thresh; | ||
| 389 | |||
| 399 | #ifdef CONFIG_TRACER_MAX_TRACE | 390 | #ifdef CONFIG_TRACER_MAX_TRACE |
| 400 | extern unsigned long tracing_max_latency; | 391 | extern unsigned long tracing_max_latency; |
| 401 | extern unsigned long tracing_thresh; | ||
| 402 | 392 | ||
| 403 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | 393 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); |
| 404 | void update_max_tr_single(struct trace_array *tr, | 394 | void update_max_tr_single(struct trace_array *tr, |
| @@ -466,8 +456,6 @@ extern int trace_selftest_startup_sysprof(struct tracer *trace, | |||
| 466 | struct trace_array *tr); | 456 | struct trace_array *tr); |
| 467 | extern int trace_selftest_startup_branch(struct tracer *trace, | 457 | extern int trace_selftest_startup_branch(struct tracer *trace, |
| 468 | struct trace_array *tr); | 458 | struct trace_array *tr); |
| 469 | extern int trace_selftest_startup_hw_branches(struct tracer *trace, | ||
| 470 | struct trace_array *tr); | ||
| 471 | extern int trace_selftest_startup_ksym(struct tracer *trace, | 459 | extern int trace_selftest_startup_ksym(struct tracer *trace, |
| 472 | struct trace_array *tr); | 460 | struct trace_array *tr); |
| 473 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ | 461 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
| @@ -490,13 +478,34 @@ extern int trace_clock_id; | |||
| 490 | 478 | ||
| 491 | /* Standard output formatting function used for function return traces */ | 479 | /* Standard output formatting function used for function return traces */ |
| 492 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 480 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 493 | extern enum print_line_t print_graph_function(struct trace_iterator *iter); | 481 | |
| 482 | /* Flag options */ | ||
| 483 | #define TRACE_GRAPH_PRINT_OVERRUN 0x1 | ||
| 484 | #define TRACE_GRAPH_PRINT_CPU 0x2 | ||
| 485 | #define TRACE_GRAPH_PRINT_OVERHEAD 0x4 | ||
| 486 | #define TRACE_GRAPH_PRINT_PROC 0x8 | ||
| 487 | #define TRACE_GRAPH_PRINT_DURATION 0x10 | ||
| 488 | #define TRACE_GRAPH_PRINT_ABS_TIME 0x20 | ||
| 489 | |||
| 490 | extern enum print_line_t | ||
| 491 | print_graph_function_flags(struct trace_iterator *iter, u32 flags); | ||
| 492 | extern void print_graph_headers_flags(struct seq_file *s, u32 flags); | ||
| 494 | extern enum print_line_t | 493 | extern enum print_line_t |
| 495 | trace_print_graph_duration(unsigned long long duration, struct trace_seq *s); | 494 | trace_print_graph_duration(unsigned long long duration, struct trace_seq *s); |
| 495 | extern void graph_trace_open(struct trace_iterator *iter); | ||
| 496 | extern void graph_trace_close(struct trace_iterator *iter); | ||
| 497 | extern int __trace_graph_entry(struct trace_array *tr, | ||
| 498 | struct ftrace_graph_ent *trace, | ||
| 499 | unsigned long flags, int pc); | ||
| 500 | extern void __trace_graph_return(struct trace_array *tr, | ||
| 501 | struct ftrace_graph_ret *trace, | ||
| 502 | unsigned long flags, int pc); | ||
| 503 | |||
| 496 | 504 | ||
| 497 | #ifdef CONFIG_DYNAMIC_FTRACE | 505 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 498 | /* TODO: make this variable */ | 506 | /* TODO: make this variable */ |
| 499 | #define FTRACE_GRAPH_MAX_FUNCS 32 | 507 | #define FTRACE_GRAPH_MAX_FUNCS 32 |
| 508 | extern int ftrace_graph_filter_enabled; | ||
| 500 | extern int ftrace_graph_count; | 509 | extern int ftrace_graph_count; |
| 501 | extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS]; | 510 | extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS]; |
| 502 | 511 | ||
| @@ -504,7 +513,7 @@ static inline int ftrace_graph_addr(unsigned long addr) | |||
| 504 | { | 513 | { |
| 505 | int i; | 514 | int i; |
| 506 | 515 | ||
| 507 | if (!ftrace_graph_count || test_tsk_trace_graph(current)) | 516 | if (!ftrace_graph_filter_enabled) |
| 508 | return 1; | 517 | return 1; |
| 509 | 518 | ||
| 510 | for (i = 0; i < ftrace_graph_count; i++) { | 519 | for (i = 0; i < ftrace_graph_count; i++) { |
| @@ -522,7 +531,7 @@ static inline int ftrace_graph_addr(unsigned long addr) | |||
| 522 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 531 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 523 | #else /* CONFIG_FUNCTION_GRAPH_TRACER */ | 532 | #else /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 524 | static inline enum print_line_t | 533 | static inline enum print_line_t |
| 525 | print_graph_function(struct trace_iterator *iter) | 534 | print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
| 526 | { | 535 | { |
| 527 | return TRACE_TYPE_UNHANDLED; | 536 | return TRACE_TYPE_UNHANDLED; |
| 528 | } | 537 | } |
| @@ -549,7 +558,7 @@ static inline int ftrace_trace_task(struct task_struct *task) | |||
| 549 | * struct trace_parser - servers for reading the user input separated by spaces | 558 | * struct trace_parser - servers for reading the user input separated by spaces |
| 550 | * @cont: set if the input is not complete - no final space char was found | 559 | * @cont: set if the input is not complete - no final space char was found |
| 551 | * @buffer: holds the parsed user input | 560 | * @buffer: holds the parsed user input |
| 552 | * @idx: user input lenght | 561 | * @idx: user input length |
| 553 | * @size: buffer size | 562 | * @size: buffer size |
| 554 | */ | 563 | */ |
| 555 | struct trace_parser { | 564 | struct trace_parser { |
| @@ -791,7 +800,8 @@ extern const char *__stop___trace_bprintk_fmt[]; | |||
| 791 | 800 | ||
| 792 | #undef FTRACE_ENTRY | 801 | #undef FTRACE_ENTRY |
| 793 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ | 802 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ |
| 794 | extern struct ftrace_event_call event_##call; | 803 | extern struct ftrace_event_call \ |
| 804 | __attribute__((__aligned__(4))) event_##call; | ||
| 795 | #undef FTRACE_ENTRY_DUP | 805 | #undef FTRACE_ENTRY_DUP |
| 796 | #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \ | 806 | #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \ |
| 797 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) | 807 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) |
