|
66 | 66 |
|
67 | 67 | static struct ftrace_ops ftrace_list_end __read_mostly = { |
68 | 68 | .func = ftrace_stub, |
| 69 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE, |
69 | 70 | }; |
70 | 71 |
|
71 | 72 | /* ftrace_enabled is a method to turn ftrace on or off */ |
@@ -221,12 +222,13 @@ static void update_ftrace_function(void) |
221 | 222 |
|
222 | 223 | /* |
223 | 224 | * If we are at the end of the list and this ops is |
224 | | - * not dynamic and the arch supports passing ops, then have the |
225 | | - * mcount trampoline call the function directly. |
| 225 | + * recursion safe and not dynamic and the arch supports passing ops, |
| 226 | + * then have the mcount trampoline call the function directly. |
226 | 227 | */ |
227 | 228 | if (ftrace_ops_list == &ftrace_list_end || |
228 | 229 | (ftrace_ops_list->next == &ftrace_list_end && |
229 | 230 | !(ftrace_ops_list->flags & FTRACE_OPS_FL_DYNAMIC) && |
| 231 | + (ftrace_ops_list->flags & FTRACE_OPS_FL_RECURSION_SAFE) && |
230 | 232 | !FTRACE_FORCE_LIST_FUNC)) { |
231 | 233 | /* Set the ftrace_ops that the arch callback uses */ |
232 | 234 | if (ftrace_ops_list == &global_ops) |
@@ -867,6 +869,7 @@ static void unregister_ftrace_profiler(void) |
867 | 869 | #else |
868 | 870 | static struct ftrace_ops ftrace_profile_ops __read_mostly = { |
869 | 871 | .func = function_profile_call, |
| 872 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE, |
870 | 873 | }; |
871 | 874 |
|
872 | 875 | static int register_ftrace_profiler(void) |
@@ -1049,6 +1052,7 @@ static struct ftrace_ops global_ops = { |
1049 | 1052 | .func = ftrace_stub, |
1050 | 1053 | .notrace_hash = EMPTY_HASH, |
1051 | 1054 | .filter_hash = EMPTY_HASH, |
| 1055 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE, |
1052 | 1056 | }; |
1053 | 1057 |
|
1054 | 1058 | static DEFINE_MUTEX(ftrace_regex_lock); |
@@ -3967,6 +3971,7 @@ void __init ftrace_init(void) |
3967 | 3971 |
|
3968 | 3972 | static struct ftrace_ops global_ops = { |
3969 | 3973 | .func = ftrace_stub, |
| 3974 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE, |
3970 | 3975 | }; |
3971 | 3976 |
|
3972 | 3977 | static int __init ftrace_nodyn_init(void) |
@@ -4023,6 +4028,7 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip, |
4023 | 4028 |
|
4024 | 4029 | static struct ftrace_ops control_ops = { |
4025 | 4030 | .func = ftrace_ops_control_func, |
| 4031 | + .flags = FTRACE_OPS_FL_RECURSION_SAFE, |
4026 | 4032 | }; |
4027 | 4033 |
|
4028 | 4034 | static inline void |
|
0 commit comments