]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace: Add a helper function to modify_ftrace_direct() to allow arch optimization
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Sun, 17 Nov 2019 22:04:15 +0000 (17:04 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 18 Nov 2019 16:42:09 +0000 (11:42 -0500)
commit48b66dc30af5ec621b882d47b3c679577f0ca102
tree2004cf417ab559434f4e42f0e34b7b112328f546
parenta91d07157a5ef439ab1ab197dd60c46221f69537
ftrace: Add a helper function to modify_ftrace_direct() to allow arch optimization

If a direct ftrace callback is at a location that does not have any other
ftrace helpers attached to it, it is possible to simply just change the
text to call the new caller (if the architecture supports it). But this
requires special architecture code. Currently, modify_ftrace_direct() uses a
trick to add a stub ftrace callback to the location forcing it to call the
ftrace iterator. Then it can change the direct helper to call the new
function in C, and then remove the stub. Removing the stub will have the
location now call the new location that the direct helper is using.

The new helper function does the registering the stub trick, but is a weak
function, allowing an architecture to override it to do something a bit more
direct.

Link: https://lore.kernel.org/r/20191115215125.mbqv7taqnx376yed@ast-mbp.dhcp.thefacebook.com
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
include/linux/ftrace.h
kernel/trace/ftrace.c