]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Allow ftrace_replace_code() to be schedulable
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 5 Dec 2018 17:48:53 +0000 (12:48 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 10 Dec 2018 17:22:45 +0000 (12:22 -0500)
commit0d106d725bf0896c1f78fb91b49007206dffa9a8
treeb30fd0ba692ed630e5b1afe9e31b9a7f8aac4701
parent1735e79a7c8b7361cad90f0aa7a0eee4b1c0dc73
ftrace: Allow ftrace_replace_code() to be schedulable

The function ftrace_replace_code() is the ftrace engine that does the
work to modify all the nops into the calls to the function callback in
all the functions being traced.

The generic version which is normally called from stop machine, but an
architecture can implement a non stop machine version and still use the
generic ftrace_replace_code(). When an architecture does this,
ftrace_replace_code() may be called from a schedulable context, where
it can allow the code to be preemptible, and schedule out.

In order to allow an architecture to make ftrace_replace_code()
schedulable, a new command flag is added called:

 FTRACE_MAY_SLEEP

Which can be or'd to the command that is passed to
ftrace_modify_all_code() that calls ftrace_replace_code() and will have
it call cond_resched() in the loop that modifies the nops into the
calls to the ftrace trampolines.

Link: http://lkml.kernel.org/r/20181204192903.8193-1-anders.roxell@linaro.org
Link: http://lkml.kernel.org/r/20181205183303.828422192@goodmis.org
Reported-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/ftrace.h
kernel/trace/ftrace.c