v2: - fix STATIC_CALL_TRAMP() macro by using __PASTE() [Ard] - rename optimized/unoptimized -> inline/out-of-line [Ard] - tweak arch interfaces for PLT and add key->tramp field [Ard] - rename 'poison' to 'defuse' and do it after all sites have been patched [Ard] - fix .init handling [Ard, Steven] - add CONFIG_HAVE_STATIC_CALL [Steven] - make interfaces more consistent across configs to allow tracepoints to use them [Steven] - move __ADDRESSABLE() to static_call() macro [Steven] - prevent 2-byte jumps [Steven] - add offset to asm-offsets.c instead of hard coding key->func offset - add kernel_text_address() sanity check - make __ADDRESSABLE() symbols truly unique
TODO: - port Ard's arm64 patches to the new arch interfaces - tracepoint performance testing -------------------- These patches are related to two similar patch sets from Ard and Steve: - https://lkml.kernel.org/r/[email protected] - https://lkml.kernel.org/r/[email protected] The code is also heavily inspired by the jump label code, as some of the concepts are very similar. There are three separate implementations, depending on what the arch supports: 1) CONFIG_HAVE_STATIC_CALL_INLINE: patched call sites - requires objtool and a small amount of arch code 2) CONFIG_HAVE_STATIC_CALL_OUTLINE: patched trampolines - requires a small amount of arch code 3) If no arch support, fall back to regular function pointers Josh Poimboeuf (4): compiler.h: Make __ADDRESSABLE() symbol truly unique static_call: Add static call infrastructure x86/static_call: Add out-of-line static call implementation x86/static_call: Add inline static call implementation for x86-64 arch/Kconfig | 10 + arch/x86/Kconfig | 4 +- arch/x86/include/asm/static_call.h | 52 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/asm-offsets.c | 6 + arch/x86/kernel/static_call.c | 78 ++++ include/asm-generic/vmlinux.lds.h | 11 + include/linux/compiler.h | 2 +- include/linux/module.h | 10 + include/linux/static_call.h | 202 ++++++++++ include/linux/static_call_types.h | 19 + kernel/Makefile | 1 + kernel/module.c | 5 + kernel/static_call.c | 350 ++++++++++++++++++ tools/objtool/Makefile | 3 +- tools/objtool/check.c | 126 ++++++- tools/objtool/check.h | 2 + tools/objtool/elf.h | 1 + .../objtool/include/linux/static_call_types.h | 19 + tools/objtool/sync-check.sh | 1 + 20 files changed, 899 insertions(+), 4 deletions(-) create mode 100644 arch/x86/include/asm/static_call.h create mode 100644 arch/x86/kernel/static_call.c create mode 100644 include/linux/static_call.h create mode 100644 include/linux/static_call_types.h create mode 100644 kernel/static_call.c create mode 100644 tools/objtool/include/linux/static_call_types.h -- 2.17.2

