Symbols are needed for tools to describe instruction addresses. Pages allocated for ftrace's purposes need symbols to be created for them. Add such symbols to be visible via /proc/kallsyms. Example on x86 with CONFIG_DYNAMIC_FTRACE=y # echo function > /sys/kernel/debug/tracing/current_tracer # cat /proc/kallsyms | grep '\[__builtin__ftrace\]' ffffffffc0238000 t ftrace_trampoline [__builtin__ftrace] Note: This patch adds "__builtin__ftrace" as a module name in /proc/kallsyms for symbols for pages allocated for ftrace's purposes, even though "__builtin__ftrace" is not a module.
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -58,9 +58,6 @@ struct ftrace_direct_func; · 57 unmodified lines | |||
| 58 | const char * | 58 | const char * |
| 59 | ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, | 59 | ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, |
| 60 | unsigned long *off, char **modname, char *sym); | 60 | unsigned long *off, char **modname, char *sym); |
| 61 | int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, | ||
| 62 | char *type, char *name, | ||
| 63 | char *module_name, int *exported); | ||
| 64 | #else | 61 | #else |
| 65 | static inline const char * | 62 | static inline const char * |
| 66 | ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, | 63 | ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, |
| @@ -68,6 +65,13 @@ ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, · 1 unmodified line | |||
| 68 | { | 65 | { |
| 69 | return NULL; | 66 | return NULL; |
| 70 | } | 67 | } |
| 68 | #endif | ||
| 69 | |||
| 70 | #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE) | ||
| 71 | int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, | ||
| 72 | char *type, char *name, | ||
| 73 | char *module_name, int *exported); | ||
| 74 | #else | ||
| 71 | static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, | 75 | static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value, |
| 72 | char *type, char *name, | 76 | char *type, char *name, |
| 73 | char *module_name, int *exported) | 77 | char *module_name, int *exported) |
| @@ -76,7 +80,6 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val · 2 unmodified lines | |||
| 76 | } | 80 | } |
| 77 | #endif | 81 | #endif |
| 78 | 82 | ||
| 79 | |||
| 80 | #ifdef CONFIG_FUNCTION_TRACER | 83 | #ifdef CONFIG_FUNCTION_TRACER |
| 81 | 84 | ||
| 82 | extern int ftrace_enabled; | 85 | extern int ftrace_enabled; |
| @@ -207,6 +210,7 @@ struct ftrace_ops { · 124 unmodified lines | |||
| 207 | struct ftrace_ops_hash old_hash; | 210 | struct ftrace_ops_hash old_hash; |
| 208 | unsigned long trampoline; | 211 | unsigned long trampoline; |
| 209 | unsigned long trampoline_size; | 212 | unsigned long trampoline_size; |
| 213 | struct list_head list; | ||
| 210 | #endif | 214 | #endif |
| 211 | }; | 215 | }; |
| 212 | 216 | ||