diff options
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r-- | include/linux/ftrace.h | 99 |
1 files changed, 68 insertions, 31 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index a7f8134c594e..915f4723fc8b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -95,10 +95,41 @@ stack_trace_sysctl(struct ctl_table *table, int write, | |||
95 | loff_t *ppos); | 95 | loff_t *ppos); |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | struct ftrace_func_command { | ||
99 | struct list_head list; | ||
100 | char *name; | ||
101 | int (*func)(char *func, char *cmd, | ||
102 | char *params, int enable); | ||
103 | }; | ||
104 | |||
98 | #ifdef CONFIG_DYNAMIC_FTRACE | 105 | #ifdef CONFIG_DYNAMIC_FTRACE |
99 | /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ | 106 | /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ |
100 | #include <asm/ftrace.h> | 107 | #include <asm/ftrace.h> |
101 | 108 | ||
109 | struct seq_file; | ||
110 | |||
111 | struct ftrace_probe_ops { | ||
112 | void (*func)(unsigned long ip, | ||
113 | unsigned long parent_ip, | ||
114 | void **data); | ||
115 | int (*callback)(unsigned long ip, void **data); | ||
116 | void (*free)(void **data); | ||
117 | int (*print)(struct seq_file *m, | ||
118 | unsigned long ip, | ||
119 | struct ftrace_probe_ops *ops, | ||
120 | void *data); | ||
121 | }; | ||
122 | |||
123 | extern int | ||
124 | register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
125 | void *data); | ||
126 | extern void | ||
127 | unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | ||
128 | void *data); | ||
129 | extern void | ||
130 | unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); | ||
131 | extern void unregister_ftrace_function_probe_all(char *glob); | ||
132 | |||
102 | enum { | 133 | enum { |
103 | FTRACE_FL_FREE = (1 << 0), | 134 | FTRACE_FL_FREE = (1 << 0), |
104 | FTRACE_FL_FAILED = (1 << 1), | 135 | FTRACE_FL_FAILED = (1 << 1), |
@@ -119,6 +150,9 @@ struct dyn_ftrace { | |||
119 | int ftrace_force_update(void); | 150 | int ftrace_force_update(void); |
120 | void ftrace_set_filter(unsigned char *buf, int len, int reset); | 151 | void ftrace_set_filter(unsigned char *buf, int len, int reset); |
121 | 152 | ||
153 | int register_ftrace_command(struct ftrace_func_command *cmd); | ||
154 | int unregister_ftrace_command(struct ftrace_func_command *cmd); | ||
155 | |||
122 | /* defined in arch */ | 156 | /* defined in arch */ |
123 | extern int ftrace_ip_converted(unsigned long ip); | 157 | extern int ftrace_ip_converted(unsigned long ip); |
124 | extern int ftrace_dyn_arch_init(void *data); | 158 | extern int ftrace_dyn_arch_init(void *data); |
@@ -126,6 +160,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func); | |||
126 | extern void ftrace_caller(void); | 160 | extern void ftrace_caller(void); |
127 | extern void ftrace_call(void); | 161 | extern void ftrace_call(void); |
128 | extern void mcount_call(void); | 162 | extern void mcount_call(void); |
163 | |||
164 | #ifndef FTRACE_ADDR | ||
165 | #define FTRACE_ADDR ((unsigned long)ftrace_caller) | ||
166 | #endif | ||
129 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 167 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
130 | extern void ftrace_graph_caller(void); | 168 | extern void ftrace_graph_caller(void); |
131 | extern int ftrace_enable_ftrace_graph_caller(void); | 169 | extern int ftrace_enable_ftrace_graph_caller(void); |
@@ -136,7 +174,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; } | |||
136 | #endif | 174 | #endif |
137 | 175 | ||
138 | /** | 176 | /** |
139 | * ftrace_make_nop - convert code into top | 177 | * ftrace_make_nop - convert code into nop |
140 | * @mod: module structure if called by module load initialization | 178 | * @mod: module structure if called by module load initialization |
141 | * @rec: the mcount call site record | 179 | * @rec: the mcount call site record |
142 | * @addr: the address that the call site should be calling | 180 | * @addr: the address that the call site should be calling |
@@ -198,6 +236,14 @@ extern void ftrace_enable_daemon(void); | |||
198 | # define ftrace_disable_daemon() do { } while (0) | 236 | # define ftrace_disable_daemon() do { } while (0) |
199 | # define ftrace_enable_daemon() do { } while (0) | 237 | # define ftrace_enable_daemon() do { } while (0) |
200 | static inline void ftrace_release(void *start, unsigned long size) { } | 238 | static inline void ftrace_release(void *start, unsigned long size) { } |
239 | static inline int register_ftrace_command(struct ftrace_func_command *cmd) | ||
240 | { | ||
241 | return -EINVAL; | ||
242 | } | ||
243 | static inline int unregister_ftrace_command(char *cmd_name) | ||
244 | { | ||
245 | return -EINVAL; | ||
246 | } | ||
201 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 247 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
202 | 248 | ||
203 | /* totally disable ftrace - can not re-enable after this */ | 249 | /* totally disable ftrace - can not re-enable after this */ |
@@ -298,6 +344,9 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | |||
298 | extern int | 344 | extern int |
299 | __ftrace_printk(unsigned long ip, const char *fmt, ...) | 345 | __ftrace_printk(unsigned long ip, const char *fmt, ...) |
300 | __attribute__ ((format (printf, 2, 3))); | 346 | __attribute__ ((format (printf, 2, 3))); |
347 | # define ftrace_vprintk(fmt, ap) __ftrace_printk(_THIS_IP_, fmt, ap) | ||
348 | extern int | ||
349 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | ||
301 | extern void ftrace_dump(void); | 350 | extern void ftrace_dump(void); |
302 | #else | 351 | #else |
303 | static inline void | 352 | static inline void |
@@ -313,6 +362,11 @@ ftrace_printk(const char *fmt, ...) | |||
313 | { | 362 | { |
314 | return 0; | 363 | return 0; |
315 | } | 364 | } |
365 | static inline int | ||
366 | ftrace_vprintk(const char *fmt, va_list ap) | ||
367 | { | ||
368 | return 0; | ||
369 | } | ||
316 | static inline void ftrace_dump(void) { } | 370 | static inline void ftrace_dump(void) { } |
317 | #endif | 371 | #endif |
318 | 372 | ||
@@ -327,36 +381,6 @@ ftrace_init_module(struct module *mod, | |||
327 | unsigned long *start, unsigned long *end) { } | 381 | unsigned long *start, unsigned long *end) { } |
328 | #endif | 382 | #endif |
329 | 383 | ||
330 | enum { | ||
331 | POWER_NONE = 0, | ||
332 | POWER_CSTATE = 1, | ||
333 | POWER_PSTATE = 2, | ||
334 | }; | ||
335 | |||
336 | struct power_trace { | ||
337 | #ifdef CONFIG_POWER_TRACER | ||
338 | ktime_t stamp; | ||
339 | ktime_t end; | ||
340 | int type; | ||
341 | int state; | ||
342 | #endif | ||
343 | }; | ||
344 | |||
345 | #ifdef CONFIG_POWER_TRACER | ||
346 | extern void trace_power_start(struct power_trace *it, unsigned int type, | ||
347 | unsigned int state); | ||
348 | extern void trace_power_mark(struct power_trace *it, unsigned int type, | ||
349 | unsigned int state); | ||
350 | extern void trace_power_end(struct power_trace *it); | ||
351 | #else | ||
352 | static inline void trace_power_start(struct power_trace *it, unsigned int type, | ||
353 | unsigned int state) { } | ||
354 | static inline void trace_power_mark(struct power_trace *it, unsigned int type, | ||
355 | unsigned int state) { } | ||
356 | static inline void trace_power_end(struct power_trace *it) { } | ||
357 | #endif | ||
358 | |||
359 | |||
360 | /* | 384 | /* |
361 | * Structure that defines an entry function trace. | 385 | * Structure that defines an entry function trace. |
362 | */ | 386 | */ |
@@ -516,4 +540,17 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
516 | 540 | ||
517 | #endif /* CONFIG_TRACING */ | 541 | #endif /* CONFIG_TRACING */ |
518 | 542 | ||
543 | |||
544 | #ifdef CONFIG_HW_BRANCH_TRACER | ||
545 | |||
546 | void trace_hw_branch(u64 from, u64 to); | ||
547 | void trace_hw_branch_oops(void); | ||
548 | |||
549 | #else /* CONFIG_HW_BRANCH_TRACER */ | ||
550 | |||
551 | static inline void trace_hw_branch(u64 from, u64 to) {} | ||
552 | static inline void trace_hw_branch_oops(void) {} | ||
553 | |||
554 | #endif /* CONFIG_HW_BRANCH_TRACER */ | ||
555 | |||
519 | #endif /* _LINUX_FTRACE_H */ | 556 | #endif /* _LINUX_FTRACE_H */ |