Commit e6435e96 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

ftrace: Copy ops private to global_ops private

If global_ops function is being called directly, instead of the global_ops
list function, set the global_ops private to be the same as the ops private
that's being called directly.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent b7e00a6c
...@@ -244,7 +244,11 @@ static void control_ops_free(struct ftrace_ops *ops) ...@@ -244,7 +244,11 @@ static void control_ops_free(struct ftrace_ops *ops)
static void update_global_ops(void) static void update_global_ops(void)
{ {
ftrace_func_t func; ftrace_func_t func = ftrace_global_list_func;
void *private = NULL;
/* The list has its own recursion protection. */
global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
/* /*
* If there's only one function registered, then call that * If there's only one function registered, then call that
...@@ -254,23 +258,17 @@ static void update_global_ops(void) ...@@ -254,23 +258,17 @@ static void update_global_ops(void)
if (ftrace_global_list == &ftrace_list_end || if (ftrace_global_list == &ftrace_list_end ||
ftrace_global_list->next == &ftrace_list_end) { ftrace_global_list->next == &ftrace_list_end) {
func = ftrace_global_list->func; func = ftrace_global_list->func;
private = ftrace_global_list->private;
/* /*
* As we are calling the function directly. * As we are calling the function directly.
* If it does not have recursion protection, * If it does not have recursion protection,
* the function_trace_op needs to be updated * the function_trace_op needs to be updated
* accordingly. * accordingly.
*/ */
if (ftrace_global_list->flags & FTRACE_OPS_FL_RECURSION_SAFE) if (!(ftrace_global_list->flags & FTRACE_OPS_FL_RECURSION_SAFE))
global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
else
global_ops.flags &= ~FTRACE_OPS_FL_RECURSION_SAFE; global_ops.flags &= ~FTRACE_OPS_FL_RECURSION_SAFE;
} else {
func = ftrace_global_list_func;
/* The list has its own recursion protection. */
global_ops.flags |= FTRACE_OPS_FL_RECURSION_SAFE;
} }
/* If we filter on pids, update to use the pid function */ /* If we filter on pids, update to use the pid function */
if (!list_empty(&ftrace_pids)) { if (!list_empty(&ftrace_pids)) {
set_ftrace_pid_function(func); set_ftrace_pid_function(func);
...@@ -278,6 +276,7 @@ static void update_global_ops(void) ...@@ -278,6 +276,7 @@ static void update_global_ops(void)
} }
global_ops.func = func; global_ops.func = func;
global_ops.private = private;
} }
static void ftrace_sync(struct work_struct *work) static void ftrace_sync(struct work_struct *work)
......
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