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.h99
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
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>
101 108
109struct seq_file;
110
111struct 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
123extern int
124register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
125 void *data);
126extern void
127unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
128 void *data);
129extern void
130unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
131extern void unregister_ftrace_function_probe_all(char *glob);
132
102enum { 133enum {
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 {
119int ftrace_force_update(void); 150int ftrace_force_update(void);
120void ftrace_set_filter(unsigned char *buf, int len, int reset); 151void ftrace_set_filter(unsigned char *buf, int len, int reset);
121 152
153int register_ftrace_command(struct ftrace_func_command *cmd);
154int unregister_ftrace_command(struct ftrace_func_command *cmd);
155
122/* defined in arch */ 156/* defined in arch */
123extern int ftrace_ip_converted(unsigned long ip); 157extern int ftrace_ip_converted(unsigned long ip);
124extern int ftrace_dyn_arch_init(void *data); 158extern int ftrace_dyn_arch_init(void *data);
@@ -126,6 +160,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func);
126extern void ftrace_caller(void); 160extern void ftrace_caller(void);
127extern void ftrace_call(void); 161extern void ftrace_call(void);
128extern void mcount_call(void); 162extern 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
130extern void ftrace_graph_caller(void); 168extern void ftrace_graph_caller(void);
131extern int ftrace_enable_ftrace_graph_caller(void); 169extern 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)
200static inline void ftrace_release(void *start, unsigned long size) { } 238static inline void ftrace_release(void *start, unsigned long size) { }
239static inline int register_ftrace_command(struct ftrace_func_command *cmd)
240{
241 return -EINVAL;
242}
243static 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);
298extern int 344extern 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)
348extern int
349__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
301extern void ftrace_dump(void); 350extern void ftrace_dump(void);
302#else 351#else
303static inline void 352static inline void
@@ -313,6 +362,11 @@ ftrace_printk(const char *fmt, ...)
313{ 362{
314 return 0; 363 return 0;
315} 364}
365static inline int
366ftrace_vprintk(const char *fmt, va_list ap)
367{
368 return 0;
369}
316static inline void ftrace_dump(void) { } 370static 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
330enum {
331 POWER_NONE = 0,
332 POWER_CSTATE = 1,
333 POWER_PSTATE = 2,
334};
335
336struct 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
346extern void trace_power_start(struct power_trace *it, unsigned int type,
347 unsigned int state);
348extern void trace_power_mark(struct power_trace *it, unsigned int type,
349 unsigned int state);
350extern void trace_power_end(struct power_trace *it);
351#else
352static inline void trace_power_start(struct power_trace *it, unsigned int type,
353 unsigned int state) { }
354static inline void trace_power_mark(struct power_trace *it, unsigned int type,
355 unsigned int state) { }
356static 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
546void trace_hw_branch(u64 from, u64 to);
547void trace_hw_branch_oops(void);
548
549#else /* CONFIG_HW_BRANCH_TRACER */
550
551static inline void trace_hw_branch(u64 from, u64 to) {}
552static 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 */