aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h103
1 files changed, 87 insertions, 16 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 28c15c2ebc22..5ac697065a48 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -25,8 +25,11 @@ enum trace_type {
25 TRACE_BRANCH, 25 TRACE_BRANCH,
26 TRACE_BOOT_CALL, 26 TRACE_BOOT_CALL,
27 TRACE_BOOT_RET, 27 TRACE_BOOT_RET,
28 TRACE_FN_RET, 28 TRACE_GRAPH_RET,
29 TRACE_GRAPH_ENT,
29 TRACE_USER_STACK, 30 TRACE_USER_STACK,
31 TRACE_BTS,
32 TRACE_POWER,
30 33
31 __TRACE_LAST_TYPE 34 __TRACE_LAST_TYPE
32}; 35};
@@ -55,14 +58,16 @@ struct ftrace_entry {
55 unsigned long parent_ip; 58 unsigned long parent_ip;
56}; 59};
57 60
61/* Function call entry */
62struct ftrace_graph_ent_entry {
63 struct trace_entry ent;
64 struct ftrace_graph_ent graph_ent;
65};
66
58/* Function return entry */ 67/* Function return entry */
59struct ftrace_ret_entry { 68struct ftrace_graph_ret_entry {
60 struct trace_entry ent; 69 struct trace_entry ent;
61 unsigned long ip; 70 struct ftrace_graph_ret ret;
62 unsigned long parent_ip;
63 unsigned long long calltime;
64 unsigned long long rettime;
65 unsigned long overrun;
66}; 71};
67extern struct tracer boot_tracer; 72extern struct tracer boot_tracer;
68 73
@@ -112,6 +117,7 @@ struct userstack_entry {
112struct print_entry { 117struct print_entry {
113 struct trace_entry ent; 118 struct trace_entry ent;
114 unsigned long ip; 119 unsigned long ip;
120 int depth;
115 char buf[]; 121 char buf[];
116}; 122};
117 123
@@ -153,6 +159,17 @@ struct trace_branch {
153 char correct; 159 char correct;
154}; 160};
155 161
162struct bts_entry {
163 struct trace_entry ent;
164 unsigned long from;
165 unsigned long to;
166};
167
168struct trace_power {
169 struct trace_entry ent;
170 struct power_trace state_data;
171};
172
156/* 173/*
157 * trace_flag_type is an enumeration that holds different 174 * trace_flag_type is an enumeration that holds different
158 * states when a trace occurs. These are: 175 * states when a trace occurs. These are:
@@ -257,7 +274,12 @@ extern void __ftrace_bad_type(void);
257 IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\ 274 IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\
258 IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\ 275 IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\
259 IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \ 276 IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \
260 IF_ASSIGN(var, ent, struct ftrace_ret_entry, TRACE_FN_RET);\ 277 IF_ASSIGN(var, ent, struct ftrace_graph_ent_entry, \
278 TRACE_GRAPH_ENT); \
279 IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \
280 TRACE_GRAPH_RET); \
281 IF_ASSIGN(var, ent, struct bts_entry, TRACE_BTS);\
282 IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \
261 __ftrace_bad_type(); \ 283 __ftrace_bad_type(); \
262 } while (0) 284 } while (0)
263 285
@@ -311,6 +333,7 @@ struct tracer {
311 int (*selftest)(struct tracer *trace, 333 int (*selftest)(struct tracer *trace,
312 struct trace_array *tr); 334 struct trace_array *tr);
313#endif 335#endif
336 void (*print_header)(struct seq_file *m);
314 enum print_line_t (*print_line)(struct trace_iterator *iter); 337 enum print_line_t (*print_line)(struct trace_iterator *iter);
315 /* If you handled the flag setting, return 0 */ 338 /* If you handled the flag setting, return 0 */
316 int (*set_flag)(u32 old_flags, u32 bit, int set); 339 int (*set_flag)(u32 old_flags, u32 bit, int set);
@@ -388,8 +411,12 @@ void trace_function(struct trace_array *tr,
388 unsigned long ip, 411 unsigned long ip,
389 unsigned long parent_ip, 412 unsigned long parent_ip,
390 unsigned long flags, int pc); 413 unsigned long flags, int pc);
391void 414
392trace_function_return(struct ftrace_retfunc *trace); 415void trace_graph_return(struct ftrace_graph_ret *trace);
416int trace_graph_entry(struct ftrace_graph_ent *trace);
417void trace_bts(struct trace_array *tr,
418 unsigned long from,
419 unsigned long to);
393 420
394void tracing_start_cmdline_record(void); 421void tracing_start_cmdline_record(void);
395void tracing_stop_cmdline_record(void); 422void tracing_stop_cmdline_record(void);
@@ -431,6 +458,7 @@ struct tracer_switch_ops {
431 struct tracer_switch_ops *next; 458 struct tracer_switch_ops *next;
432}; 459};
433 460
461char *trace_find_cmdline(int pid);
434#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ 462#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
435 463
436#ifdef CONFIG_DYNAMIC_FTRACE 464#ifdef CONFIG_DYNAMIC_FTRACE
@@ -471,20 +499,63 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip,
471extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 499extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
472 size_t cnt); 500 size_t cnt);
473extern long ns2usecs(cycle_t nsec); 501extern long ns2usecs(cycle_t nsec);
474extern int trace_vprintk(unsigned long ip, const char *fmt, va_list args); 502extern int
503trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args);
475 504
476extern unsigned long trace_flags; 505extern unsigned long trace_flags;
477 506
478/* Standard output formatting function used for function return traces */ 507/* Standard output formatting function used for function return traces */
479#ifdef CONFIG_FUNCTION_RET_TRACER 508#ifdef CONFIG_FUNCTION_GRAPH_TRACER
480extern enum print_line_t print_return_function(struct trace_iterator *iter); 509extern enum print_line_t print_graph_function(struct trace_iterator *iter);
510
511#ifdef CONFIG_DYNAMIC_FTRACE
512/* TODO: make this variable */
513#define FTRACE_GRAPH_MAX_FUNCS 32
514extern int ftrace_graph_count;
515extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS];
516
517static inline int ftrace_graph_addr(unsigned long addr)
518{
519 int i;
520
521 if (!ftrace_graph_count || test_tsk_trace_graph(current))
522 return 1;
523
524 for (i = 0; i < ftrace_graph_count; i++) {
525 if (addr == ftrace_graph_funcs[i])
526 return 1;
527 }
528
529 return 0;
530}
481#else 531#else
532static inline int ftrace_trace_addr(unsigned long addr)
533{
534 return 1;
535}
536static inline int ftrace_graph_addr(unsigned long addr)
537{
538 return 1;
539}
540#endif /* CONFIG_DYNAMIC_FTRACE */
541
542#else /* CONFIG_FUNCTION_GRAPH_TRACER */
482static inline enum print_line_t 543static inline enum print_line_t
483print_return_function(struct trace_iterator *iter) 544print_graph_function(struct trace_iterator *iter)
484{ 545{
485 return TRACE_TYPE_UNHANDLED; 546 return TRACE_TYPE_UNHANDLED;
486} 547}
487#endif 548#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
549
550extern struct pid *ftrace_pid_trace;
551
552static inline int ftrace_trace_task(struct task_struct *task)
553{
554 if (!ftrace_pid_trace)
555 return 1;
556
557 return test_tsk_trace_trace(task);
558}
488 559
489/* 560/*
490 * trace_iterator_flags is an enumeration that defines bit 561 * trace_iterator_flags is an enumeration that defines bit