aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h123
1 files changed, 92 insertions, 31 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index fdb2a89ae543..847bb3c48dd0 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -95,6 +95,13 @@ stack_trace_sysctl(struct ctl_table *table, int write,
95 loff_t *ppos); 95 loff_t *ppos);
96#endif 96#endif
97 97
98struct 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>
@@ -102,6 +109,30 @@ stack_trace_sysctl(struct ctl_table *table, int write,
102int ftrace_arch_code_modify_prepare(void); 109int ftrace_arch_code_modify_prepare(void);
103int ftrace_arch_code_modify_post_process(void); 110int ftrace_arch_code_modify_post_process(void);
104 111
112struct seq_file;
113
114struct ftrace_probe_ops {
115 void (*func)(unsigned long ip,
116 unsigned long parent_ip,
117 void **data);
118 int (*callback)(unsigned long ip, void **data);
119 void (*free)(void **data);
120 int (*print)(struct seq_file *m,
121 unsigned long ip,
122 struct ftrace_probe_ops *ops,
123 void *data);
124};
125
126extern int
127register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
128 void *data);
129extern void
130unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
131 void *data);
132extern void
133unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
134extern void unregister_ftrace_function_probe_all(char *glob);
135
105enum { 136enum {
106 FTRACE_FL_FREE = (1 << 0), 137 FTRACE_FL_FREE = (1 << 0),
107 FTRACE_FL_FAILED = (1 << 1), 138 FTRACE_FL_FAILED = (1 << 1),
@@ -122,6 +153,9 @@ struct dyn_ftrace {
122int ftrace_force_update(void); 153int ftrace_force_update(void);
123void ftrace_set_filter(unsigned char *buf, int len, int reset); 154void ftrace_set_filter(unsigned char *buf, int len, int reset);
124 155
156int register_ftrace_command(struct ftrace_func_command *cmd);
157int unregister_ftrace_command(struct ftrace_func_command *cmd);
158
125/* defined in arch */ 159/* defined in arch */
126extern int ftrace_ip_converted(unsigned long ip); 160extern int ftrace_ip_converted(unsigned long ip);
127extern int ftrace_dyn_arch_init(void *data); 161extern int ftrace_dyn_arch_init(void *data);
@@ -129,6 +163,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func);
129extern void ftrace_caller(void); 163extern void ftrace_caller(void);
130extern void ftrace_call(void); 164extern void ftrace_call(void);
131extern void mcount_call(void); 165extern void mcount_call(void);
166
167#ifndef FTRACE_ADDR
168#define FTRACE_ADDR ((unsigned long)ftrace_caller)
169#endif
132#ifdef CONFIG_FUNCTION_GRAPH_TRACER 170#ifdef CONFIG_FUNCTION_GRAPH_TRACER
133extern void ftrace_graph_caller(void); 171extern void ftrace_graph_caller(void);
134extern int ftrace_enable_ftrace_graph_caller(void); 172extern int ftrace_enable_ftrace_graph_caller(void);
@@ -139,7 +177,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
139#endif 177#endif
140 178
141/** 179/**
142 * ftrace_make_nop - convert code into top 180 * ftrace_make_nop - convert code into nop
143 * @mod: module structure if called by module load initialization 181 * @mod: module structure if called by module load initialization
144 * @rec: the mcount call site record 182 * @rec: the mcount call site record
145 * @addr: the address that the call site should be calling 183 * @addr: the address that the call site should be calling
@@ -201,6 +239,14 @@ extern void ftrace_enable_daemon(void);
201# define ftrace_disable_daemon() do { } while (0) 239# define ftrace_disable_daemon() do { } while (0)
202# define ftrace_enable_daemon() do { } while (0) 240# define ftrace_enable_daemon() do { } while (0)
203static inline void ftrace_release(void *start, unsigned long size) { } 241static inline void ftrace_release(void *start, unsigned long size) { }
242static inline int register_ftrace_command(struct ftrace_func_command *cmd)
243{
244 return -EINVAL;
245}
246static inline int unregister_ftrace_command(char *cmd_name)
247{
248 return -EINVAL;
249}
204#endif /* CONFIG_DYNAMIC_FTRACE */ 250#endif /* CONFIG_DYNAMIC_FTRACE */
205 251
206/* totally disable ftrace - can not re-enable after this */ 252/* totally disable ftrace - can not re-enable after this */
@@ -301,6 +347,9 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
301extern int 347extern int
302__ftrace_printk(unsigned long ip, const char *fmt, ...) 348__ftrace_printk(unsigned long ip, const char *fmt, ...)
303 __attribute__ ((format (printf, 2, 3))); 349 __attribute__ ((format (printf, 2, 3)));
350# define ftrace_vprintk(fmt, ap) __ftrace_printk(_THIS_IP_, fmt, ap)
351extern int
352__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
304extern void ftrace_dump(void); 353extern void ftrace_dump(void);
305#else 354#else
306static inline void 355static inline void
@@ -316,6 +365,11 @@ ftrace_printk(const char *fmt, ...)
316{ 365{
317 return 0; 366 return 0;
318} 367}
368static inline int
369ftrace_vprintk(const char *fmt, va_list ap)
370{
371 return 0;
372}
319static inline void ftrace_dump(void) { } 373static inline void ftrace_dump(void) { }
320#endif 374#endif
321 375
@@ -330,36 +384,6 @@ ftrace_init_module(struct module *mod,
330 unsigned long *start, unsigned long *end) { } 384 unsigned long *start, unsigned long *end) { }
331#endif 385#endif
332 386
333enum {
334 POWER_NONE = 0,
335 POWER_CSTATE = 1,
336 POWER_PSTATE = 2,
337};
338
339struct power_trace {
340#ifdef CONFIG_POWER_TRACER
341 ktime_t stamp;
342 ktime_t end;
343 int type;
344 int state;
345#endif
346};
347
348#ifdef CONFIG_POWER_TRACER
349extern void trace_power_start(struct power_trace *it, unsigned int type,
350 unsigned int state);
351extern void trace_power_mark(struct power_trace *it, unsigned int type,
352 unsigned int state);
353extern void trace_power_end(struct power_trace *it);
354#else
355static inline void trace_power_start(struct power_trace *it, unsigned int type,
356 unsigned int state) { }
357static inline void trace_power_mark(struct power_trace *it, unsigned int type,
358 unsigned int state) { }
359static inline void trace_power_end(struct power_trace *it) { }
360#endif
361
362
363/* 387/*
364 * Structure that defines an entry function trace. 388 * Structure that defines an entry function trace.
365 */ 389 */
@@ -383,6 +407,30 @@ struct ftrace_graph_ret {
383#ifdef CONFIG_FUNCTION_GRAPH_TRACER 407#ifdef CONFIG_FUNCTION_GRAPH_TRACER
384 408
385/* 409/*
410 * Stack of return addresses for functions
411 * of a thread.
412 * Used in struct thread_info
413 */
414struct ftrace_ret_stack {
415 unsigned long ret;
416 unsigned long func;
417 unsigned long long calltime;
418};
419
420/*
421 * Primary handler of a function return.
422 * It relays on ftrace_return_to_handler.
423 * Defined in entry_32/64.S
424 */
425extern void return_to_handler(void);
426
427extern int
428ftrace_push_return_trace(unsigned long ret, unsigned long long time,
429 unsigned long func, int *depth);
430extern void
431ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
432
433/*
386 * Sometimes we don't want to trace a function with the function 434 * Sometimes we don't want to trace a function with the function
387 * graph tracer but we want them to keep traced by the usual function 435 * graph tracer but we want them to keep traced by the usual function
388 * tracer if the function graph tracer is not configured. 436 * tracer if the function graph tracer is not configured.
@@ -495,4 +543,17 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
495 543
496#endif /* CONFIG_TRACING */ 544#endif /* CONFIG_TRACING */
497 545
546
547#ifdef CONFIG_HW_BRANCH_TRACER
548
549void trace_hw_branch(u64 from, u64 to);
550void trace_hw_branch_oops(void);
551
552#else /* CONFIG_HW_BRANCH_TRACER */
553
554static inline void trace_hw_branch(u64 from, u64 to) {}
555static inline void trace_hw_branch_oops(void) {}
556
557#endif /* CONFIG_HW_BRANCH_TRACER */
558
498#endif /* _LINUX_FTRACE_H */ 559#endif /* _LINUX_FTRACE_H */