This is a note to let you know that I've just added the patch titled ftrace: Synchronize setting function_trace_op with ftrace_trace_function to the 3.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ftrace-synchronize-setting-function_trace_op-with-ftrace_trace_function.patch and it can be found in the queue-3.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From rostedt@xxxxxxxxxxx Tue Feb 18 14:18:27 2014 From: Steven Rostedt <rostedt@xxxxxxxxxxx> Date: Tue, 11 Feb 2014 14:49:07 -0500 Subject: ftrace: Synchronize setting function_trace_op with ftrace_trace_function To: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>, stable@xxxxxxxxxxxxxxx, stable-commits@xxxxxxxxxxxxxxx Message-ID: <20140211144907.7384158e@xxxxxxxxxxxxxxxxxx> From: Steven Rostedt <rostedt@xxxxxxxxxxx> commit 405e1d834807e51b2ebd3dea81cb51e53fb61504 upstream. [ Partial commit backported to 3.4. The ftrace_sync() code by this is required for other fixes that 3.4 needs. ] ftrace_trace_function is a variable that holds what function will be called directly by the assembly code (mcount). If just a single function is registered and it handles recursion itself, then the assembly will call that function directly without any helper function. It also passes in the ftrace_op that was registered with the callback. The ftrace_op to send is stored in the function_trace_op variable. The ftrace_trace_function and function_trace_op needs to be coordinated such that the called callback wont be called with the wrong ftrace_op, otherwise bad things can happen if it expected a different op. Luckily, there's no callback that doesn't use the helper functions that requires this. But there soon will be and this needs to be fixed. Use a set_function_trace_op to store the ftrace_op to set the function_trace_op to when it is safe to do so (during the update function within the breakpoint or stop machine calls). Or if dynamic ftrace is not being used (static tracing) then we have to do a bit more synchronization when the ftrace_trace_function is set as that takes affect immediately (as oppose to dynamic ftrace doing it with the modification of the trampoline). Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/trace/ftrace.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -222,6 +222,23 @@ static void update_global_ops(void) global_ops.func = func; } +static void ftrace_sync(struct work_struct *work) +{ + /* + * This function is just a stub to implement a hard force + * of synchronize_sched(). This requires synchronizing + * tasks even in userspace and idle. + * + * Yes, function tracing is rude. + */ +} + +static void ftrace_sync_ipi(void *data) +{ + /* Probably not needed, but do it anyway */ + smp_rmb(); +} + static void update_ftrace_function(void) { ftrace_func_t func; Patches currently in stable-queue which might be from rostedt@xxxxxxxxxxx are queue-3.4/ftrace-have-function-graph-only-trace-based-on-global_ops-filters.patch queue-3.4/ftrace-synchronize-setting-function_trace_op-with-ftrace_trace_function.patch queue-3.4/ftrace-fix-synchronization-location-disabling-and-freeing-ftrace_ops.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html