ftrace: Have function tracing start in early boot up

Register the function tracer right after the tracing buffers are initialized
in early boot up. This will allow function tracing to begin early if it is
enabled via the kernel command line.
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 9afecfbb
...@@ -8036,6 +8036,9 @@ __init static int tracer_alloc_buffers(void) ...@@ -8036,6 +8036,9 @@ __init static int tracer_alloc_buffers(void)
register_tracer(&nop_trace); register_tracer(&nop_trace);
/* Function tracing may start here (via kernel command line) */
init_function_trace();
/* All seems OK, enable tracing */ /* All seems OK, enable tracing */
tracing_disabled = 0; tracing_disabled = 0;
......
...@@ -896,6 +896,7 @@ int using_ftrace_ops_list_func(void); ...@@ -896,6 +896,7 @@ int using_ftrace_ops_list_func(void);
void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d_tracer); void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d_tracer);
void ftrace_init_tracefs_toplevel(struct trace_array *tr, void ftrace_init_tracefs_toplevel(struct trace_array *tr,
struct dentry *d_tracer); struct dentry *d_tracer);
int init_function_trace(void);
#else #else
static inline int ftrace_trace_task(struct trace_array *tr) static inline int ftrace_trace_task(struct trace_array *tr)
{ {
...@@ -914,6 +915,7 @@ ftrace_init_global_array_ops(struct trace_array *tr) { } ...@@ -914,6 +915,7 @@ ftrace_init_global_array_ops(struct trace_array *tr) { }
static inline void ftrace_reset_array_ops(struct trace_array *tr) { } static inline void ftrace_reset_array_ops(struct trace_array *tr) { }
static inline void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d) { } static inline void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d) { }
static inline void ftrace_init_tracefs_toplevel(struct trace_array *tr, struct dentry *d) { } static inline void ftrace_init_tracefs_toplevel(struct trace_array *tr, struct dentry *d) { }
static inline int init_function_trace(void) { return 0; }
/* ftace_func_t type is not defined, use macro instead of static inline */ /* ftace_func_t type is not defined, use macro instead of static inline */
#define ftrace_init_array_ops(tr, func) do { } while (0) #define ftrace_init_array_ops(tr, func) do { } while (0)
#endif /* CONFIG_FUNCTION_TRACER */ #endif /* CONFIG_FUNCTION_TRACER */
......
...@@ -687,9 +687,8 @@ static inline int init_func_cmd_traceon(void) ...@@ -687,9 +687,8 @@ static inline int init_func_cmd_traceon(void)
} }
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
static __init int init_function_trace(void) __init int init_function_trace(void)
{ {
init_func_cmd_traceon(); init_func_cmd_traceon();
return register_tracer(&function_trace); return register_tracer(&function_trace);
} }
core_initcall(init_function_trace);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment