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)
commitea806eb3eab35528b578a061b2c4b28f0f92c465
tree2004cf417ab559434f4e42f0e34b7b112328f546
parent128161f47bc3797b0d068da13e311770685d6e4f
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