User: Password:
|
|
Subscribe / Log in / New account

[PATCH v2 0/4] Static calls

Thread information [Search the linux-kernel archive]
 Josh Poimboeuf [this message]
 ` [PATCH v2 1/4] compiler.h: Make __ADDRESSABLE() symbol truly unique Josh Poimboeuf
   ` Ard Biesheuvel
 ` [PATCH v2 2/4] static_call: Add static call infrastructure Josh Poimboeuf
 ` [PATCH v2 3/4] x86/static_call: Add out-of-line static call implementation Josh Poimboeuf
   ` Peter Zijlstra
     ` Steven Rostedt
 ` [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Josh Poimboeuf
   ` Peter Zijlstra
     ` Josh Poimboeuf
       ` Josh Poimboeuf
         ` Peter Zijlstra
         ` Peter Zijlstra
           ` Josh Poimboeuf
             ` Peter Zijlstra
               ` Peter Zijlstra
               ` Andy Lutomirski
                 ` Peter Zijlstra
                   ` Josh Poimboeuf
                   ` Andy Lutomirski
                     ` Peter Zijlstra
                       ` Jiri Kosina
                       ` Josh Poimboeuf
                         ` Peter Zijlstra
                           ` Andy Lutomirski
                             ` Josh Poimboeuf
                               ` Peter Zijlstra
                                 ` Josh Poimboeuf
                                   ` Peter Zijlstra
                                     ` Andy Lutomirski
                                       ` Josh Poimboeuf
                             ` Peter Zijlstra
                               ` Steven Rostedt
                                 ` Steven Rostedt
                                   ` Andy Lutomirski
                                     ` Josh Poimboeuf
                                       ` Andy Lutomirski
                                     ` Steven Rostedt
                               ` Josh Poimboeuf
                         ` Linus Torvalds
                           ` Steven Rostedt
                           ` Andy Lutomirski
                             ` Peter Zijlstra
                               ` Andy Lutomirski
                                 ` Jiri Kosina
                             ` Steven Rostedt
                               ` Linus Torvalds
                                 ` Steven Rostedt
                                   ` Linus Torvalds
                                     ` Linus Torvalds
                                     ` Steven Rostedt
                                       ` Linus Torvalds
                                         ` Steven Rostedt
                                           ` Linus Torvalds
                                             ` Linus Torvalds
                                               ` Linus Torvalds
                                                 ` Pavel Machek
                                                   ` Linus Torvalds
                                               ` Steven Rostedt
                                               ` Andy Lutomirski
                                                 ` Josh Poimboeuf
                                                   ` Josh Poimboeuf
                                                   ` Linus Torvalds
                                                     ` Josh Poimboeuf
                                                       ` David Laight
                                                         ` Josh Poimboeuf
                                                     ` Josh Poimboeuf
                                                   ` Andy Lutomirski
                                                     ` Josh Poimboeuf
                                                       ` Linus Torvalds
                                                         ` Andy Lutomirski
                                                           ` Steven Rostedt
                                                             ` Andy Lutomirski
                                                               ` Steven Rostedt
                                                               ` Jiri Kosina
                                                           ` Josh Poimboeuf
                                             ` Steven Rostedt
                                               ` Josh Poimboeuf
                                                 ` Steven Rostedt
                                                 ` Rasmus Villemoes
                                                   ` Josh Poimboeuf
                                               ` Linus Torvalds
                                                 ` Andy Lutomirski
                                                 ` Steven Rostedt
                                             ` Josh Poimboeuf
                                     ` Andy Lutomirski
                                       ` Linus Torvalds
                                       ` Steven Rostedt
                             ` Linus Torvalds
                               ` Andy Lutomirski
       ` Andy Lutomirski
         ` Josh Poimboeuf
           ` Peter Zijlstra
   ` Peter Zijlstra
     ` Ard Biesheuvel
       ` Andy Lutomirski
       ` Peter Zijlstra
         ` Josh Poimboeuf
 ` [PATCH v2 0/4] Static calls Josh Poimboeuf
 ` Steven Rostedt
   ` Josh Poimboeuf
     ` Steven Rostedt
 ` Steven Rostedt
   ` Andy Lutomirski
     ` Josh Poimboeuf
       ` Andy Lutomirski
 ` Edward Cree
   ` Edward Cree
   ` Josh Poimboeuf
     ` Nadav Amit
       ` Edward Cree
         ` [RFC/WIP PATCH 0/2] dynamic calls Edward Cree
           ` [RFC PATCH 1/2] static_call: fix out-of-line static call implementation Edward Cree
           ` [RFC PATCH 2/2] net: core: rather hacky PoC implementation of dynamic calls Edward Cree
         ` [PATCH v2 0/4] Static calls Nadav Amit
           ` Edward Cree
             ` Nadav Amit
               ` Edward Cree
                 ` Nadav Amit
 ` Pavel Machek

From:  Josh Poimboeuf <jpoimboe-AT-redhat.com>
To:  x86-AT-kernel.org
Subject:  [PATCH v2 0/4] Static calls
Date:  Mon, 26 Nov 2018 07:54:56 -0600
Message-ID:  <cover.1543200841.git.jpoimboe@redhat.com>
Cc:  linux-kernel-AT-vger.kernel.org, Ard Biesheuvel <ard.biesheuvel-AT-linaro.org>, Andy Lutomirski <luto-AT-kernel.org>, Steven Rostedt <rostedt-AT-goodmis.org>, Peter Zijlstra <peterz-AT-infradead.org>, Ingo Molnar <mingo-AT-kernel.org>, Thomas Gleixner <tglx-AT-linutronix.de>, Linus Torvalds <torvalds-AT-linux-foundation.org>, Masami Hiramatsu <mhiramat-AT-kernel.org>, Jason Baron <jbaron-AT-akamai.com>, Jiri Kosina <jkosina-AT-suse.cz>, David Laight <David.Laight-AT-ACULAB.COM>, Borislav Petkov <bp-AT-alien8.de>, Julia Cartwright <julia-AT-ni.com>, Jessica Yu <jeyu-AT-kernel.org>, "H. Peter Anvin" <hpa-AT-zytor.com>

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/20181005081333.15018-1-ard.bies...
- https://lkml.kernel.org/r/20181006015110.653946300@goodmi...

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



Copyright © 2019, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds