livepatch: Use the default ftrace_ops instead of REGS when ARGS is available
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 28 Oct 2020 21:15:27 +0000 (17:15 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 13 Nov 2020 17:15:28 +0000 (12:15 -0500)
commit2860cd8a235375df3c8ec8039d9fe5eb2f658b86
treefdc9022ea4057f4d410d7b907b158d7cbb8787e8
parent02a474ca266a47ea8f4d5a11f4ffa120f83730ad
livepatch: Use the default ftrace_ops instead of REGS when ARGS is available

When CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS is available, the ftrace call
will be able to set the ip of the calling function. This will improve the
performance of live kernel patching where it does not need all the regs to
be stored just to change the instruction pointer.

If all archs that support live kernel patching also support
HAVE_DYNAMIC_FTRACE_WITH_ARGS, then the architecture specific function
klp_arch_set_pc() could be made generic.

It is possible that an arch can support HAVE_DYNAMIC_FTRACE_WITH_ARGS but
not HAVE_DYNAMIC_FTRACE_WITH_REGS and then have access to live patching.

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: live-patching@vger.kernel.org
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/powerpc/include/asm/livepatch.h
arch/s390/include/asm/livepatch.h
arch/x86/include/asm/ftrace.h
arch/x86/include/asm/livepatch.h
arch/x86/kernel/ftrace_64.S
include/linux/ftrace.h
kernel/livepatch/Kconfig
kernel/livepatch/patch.c