diff options
Diffstat (limited to 'include/linux/ftrace.h')
| -rw-r--r-- | include/linux/ftrace.h | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index a3d46151be19..703eb53cfa2b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/kallsyms.h> | 9 | #include <linux/kallsyms.h> |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_FTRACE | 11 | #ifdef CONFIG_FUNCTION_TRACER |
| 12 | 12 | ||
| 13 | extern int ftrace_enabled; | 13 | extern int ftrace_enabled; |
| 14 | extern int | 14 | extern int |
| @@ -36,16 +36,14 @@ void clear_ftrace_function(void); | |||
| 36 | 36 | ||
| 37 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 37 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
| 38 | 38 | ||
| 39 | #else /* !CONFIG_FTRACE */ | 39 | #else /* !CONFIG_FUNCTION_TRACER */ |
| 40 | # define register_ftrace_function(ops) do { } while (0) | 40 | # define register_ftrace_function(ops) do { } while (0) |
| 41 | # define unregister_ftrace_function(ops) do { } while (0) | 41 | # define unregister_ftrace_function(ops) do { } while (0) |
| 42 | # define clear_ftrace_function(ops) do { } while (0) | 42 | # define clear_ftrace_function(ops) do { } while (0) |
| 43 | static inline void ftrace_kill_atomic(void) { } | 43 | static inline void ftrace_kill(void) { } |
| 44 | #endif /* CONFIG_FTRACE */ | 44 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_DYNAMIC_FTRACE | 46 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 47 | # define FTRACE_HASHBITS 10 | ||
| 48 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) | ||
| 49 | 47 | ||
| 50 | enum { | 48 | enum { |
| 51 | FTRACE_FL_FREE = (1 << 0), | 49 | FTRACE_FL_FREE = (1 << 0), |
| @@ -58,9 +56,9 @@ enum { | |||
| 58 | }; | 56 | }; |
| 59 | 57 | ||
| 60 | struct dyn_ftrace { | 58 | struct dyn_ftrace { |
| 61 | struct hlist_node node; | 59 | struct list_head list; |
| 62 | unsigned long ip; /* address of mcount call-site */ | 60 | unsigned long ip; /* address of mcount call-site */ |
| 63 | unsigned long flags; | 61 | unsigned long flags; |
| 64 | }; | 62 | }; |
| 65 | 63 | ||
| 66 | int ftrace_force_update(void); | 64 | int ftrace_force_update(void); |
| @@ -71,14 +69,33 @@ extern int ftrace_ip_converted(unsigned long ip); | |||
| 71 | extern unsigned char *ftrace_nop_replace(void); | 69 | extern unsigned char *ftrace_nop_replace(void); |
| 72 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | 70 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); |
| 73 | extern int ftrace_dyn_arch_init(void *data); | 71 | extern int ftrace_dyn_arch_init(void *data); |
| 74 | extern int ftrace_mcount_set(unsigned long *data); | ||
| 75 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
| 76 | unsigned char *new_code); | ||
| 77 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | 72 | extern int ftrace_update_ftrace_func(ftrace_func_t func); |
| 78 | extern void ftrace_caller(void); | 73 | extern void ftrace_caller(void); |
| 79 | extern void ftrace_call(void); | 74 | extern void ftrace_call(void); |
| 80 | extern void mcount_call(void); | 75 | extern void mcount_call(void); |
| 81 | 76 | ||
| 77 | /** | ||
| 78 | * ftrace_modify_code - modify code segment | ||
| 79 | * @ip: the address of the code segment | ||
| 80 | * @old_code: the contents of what is expected to be there | ||
| 81 | * @new_code: the code to patch in | ||
| 82 | * | ||
| 83 | * This is a very sensitive operation and great care needs | ||
| 84 | * to be taken by the arch. The operation should carefully | ||
| 85 | * read the location, check to see if what is read is indeed | ||
| 86 | * what we expect it to be, and then on success of the compare, | ||
| 87 | * it should write to the location. | ||
| 88 | * | ||
| 89 | * Return must be: | ||
| 90 | * 0 on success | ||
| 91 | * -EFAULT on error reading the location | ||
| 92 | * -EINVAL on a failed compare of the contents | ||
| 93 | * -EPERM on error writing to the location | ||
| 94 | * Any other value will be considered a failure. | ||
| 95 | */ | ||
| 96 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
| 97 | unsigned char *new_code); | ||
| 98 | |||
| 82 | extern int skip_trace(unsigned long ip); | 99 | extern int skip_trace(unsigned long ip); |
| 83 | 100 | ||
| 84 | extern void ftrace_release(void *start, unsigned long size); | 101 | extern void ftrace_release(void *start, unsigned long size); |
| @@ -97,11 +114,10 @@ static inline void ftrace_release(void *start, unsigned long size) { } | |||
| 97 | 114 | ||
| 98 | /* totally disable ftrace - can not re-enable after this */ | 115 | /* totally disable ftrace - can not re-enable after this */ |
| 99 | void ftrace_kill(void); | 116 | void ftrace_kill(void); |
| 100 | void ftrace_kill_atomic(void); | ||
| 101 | 117 | ||
| 102 | static inline void tracer_disable(void) | 118 | static inline void tracer_disable(void) |
| 103 | { | 119 | { |
| 104 | #ifdef CONFIG_FTRACE | 120 | #ifdef CONFIG_FUNCTION_TRACER |
| 105 | ftrace_enabled = 0; | 121 | ftrace_enabled = 0; |
| 106 | #endif | 122 | #endif |
| 107 | } | 123 | } |
| @@ -113,7 +129,7 @@ static inline void tracer_disable(void) | |||
| 113 | */ | 129 | */ |
| 114 | static inline int __ftrace_enabled_save(void) | 130 | static inline int __ftrace_enabled_save(void) |
| 115 | { | 131 | { |
| 116 | #ifdef CONFIG_FTRACE | 132 | #ifdef CONFIG_FUNCTION_TRACER |
| 117 | int saved_ftrace_enabled = ftrace_enabled; | 133 | int saved_ftrace_enabled = ftrace_enabled; |
| 118 | ftrace_enabled = 0; | 134 | ftrace_enabled = 0; |
| 119 | return saved_ftrace_enabled; | 135 | return saved_ftrace_enabled; |
| @@ -124,7 +140,7 @@ static inline int __ftrace_enabled_save(void) | |||
| 124 | 140 | ||
| 125 | static inline void __ftrace_enabled_restore(int enabled) | 141 | static inline void __ftrace_enabled_restore(int enabled) |
| 126 | { | 142 | { |
| 127 | #ifdef CONFIG_FTRACE | 143 | #ifdef CONFIG_FUNCTION_TRACER |
| 128 | ftrace_enabled = enabled; | 144 | ftrace_enabled = enabled; |
| 129 | #endif | 145 | #endif |
| 130 | } | 146 | } |
