]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace/x86: Allow !CONFIG_PREEMPT dynamic ops to use allocated trampolines
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 3 Jul 2014 19:48:16 +0000 (15:48 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 11 Nov 2014 17:41:52 +0000 (12:41 -0500)
commite8c3f2734870c435c3a78c74c6331935f7477b09
treef508de25f865ead9162c4d5213874394ac06fdde
parent9c1a04b5ef1919c6125866810d0c00045be70575
ftrace/x86: Allow !CONFIG_PREEMPT dynamic ops to use allocated trampolines

When the static ftrace_ops (like function tracer) enables tracing, and it
is the only callback that is referencing a function, a trampoline is
dynamically allocated to the function that calls the callback directly
instead of calling a loop function that iterates over all the registered
ftrace ops (if more than one ops is registered).

But when it comes to dynamically allocated ftrace_ops, where they may be
freed, on a CONFIG_PREEMPT kernel there's no way to know when it is safe
to free the trampoline. If a task was preempted while executing on the
trampoline, there's currently no way to know when it will be off that
trampoline.

But this is not true when it comes to !CONFIG_PREEMPT. The current method
of calling schedule_on_each_cpu() will force tasks off the trampoline,
becaues they can not schedule while on it (kernel preemption is not
configured). That means it is safe to free a dynamically allocated
ftrace ops trampoline when CONFIG_PREEMPT is not configured.

Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Borislav Petkov <bp@suse.de>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
arch/x86/kernel/ftrace.c
kernel/trace/ftrace.c