From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [GIT PULL] Static calls for v5.10
Date: Mon, 12 Oct 2020 17:55:42 +0200 [thread overview]
Message-ID: <20201012155542.GA3557765@gmail.com> (raw)
Linus,
Please pull the latest core/static_call git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-static_call-2020-10-12
# HEAD: 69e0ad37c9f32d5aa1beb02aab4ec0cd055be013 static_call: Fix return type of static_call_init
This tree introduces static_call(), which is the idea of static_branch()
applied to indirect function calls. Remove a data load (indirection) by
modifying the text.
They give the flexibility of function pointers, but with better
performance. (This is especially important for cases where
retpolines would otherwise be used, as retpolines can be pretty
slow.)
API overview:
DECLARE_STATIC_CALL(name, func);
DEFINE_STATIC_CALL(name, func);
DEFINE_STATIC_CALL_NULL(name, typename);
static_call(name)(args...);
static_call_cond(name)(args...);
static_call_update(name, func);
x86 is supported via text patching, otherwise basic indirect calls are used,
with function pointers.
There's a second variant using inline code patching, inspired by jump-labels,
implemented on x86 as well.
The new APIs are utilized in the x86 perf code, a heavy user of function pointers,
where static calls speed up the PMU handler by 4.2% (!).
The generic implementation is not really excercised on other architectures,
outside of the trivial test_static_call_init() self-test.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Thanks,
Ingo
------------------>
Josh Poimboeuf (5):
compiler.h: Make __ADDRESSABLE() symbol truly unique
static_call: Add basic static call infrastructure
static_call: Add inline static call infrastructure
x86/static_call: Add out-of-line static call implementation
x86/static_call: Add inline static call implementation for x86-64
Nathan Chancellor (1):
static_call: Fix return type of static_call_init
Peter Zijlstra (12):
notifier: Fix broken error handling pattern
module: Fix up module_notifier return values
module: Properly propagate MODULE_STATE_COMING failure
jump_label,module: Fix module lifetime for __jump_label_mod_text_reserved()
static_call: Avoid kprobes on inline static_call()s
static_call: Add simple self-test for static calls
x86/alternatives: Teach text_poke_bp() to emulate RET
static_call: Add static_call_cond()
static_call: Handle tail-calls
static_call: Add some validation
static_call: Allow early init
x86/perf, static_call: Optimize x86_pmu methods
Steven Rostedt (VMware) (2):
tracepoint: Optimize using static_call()
tracepoint: Fix out of sync data passing by static caller
peterz@infradead.org (1):
tracepoint: Fix overly long tracepoint names
arch/Kconfig | 13 +
arch/x86/Kconfig | 4 +-
arch/x86/events/core.c | 134 ++++++---
arch/x86/include/asm/static_call.h | 40 +++
arch/x86/include/asm/text-patching.h | 19 ++
arch/x86/kernel/Makefile | 1 +
arch/x86/kernel/alternative.c | 5 +
arch/x86/kernel/kprobes/opt.c | 4 +-
arch/x86/kernel/setup.c | 2 +
arch/x86/kernel/static_call.c | 98 +++++++
arch/x86/kernel/vmlinux.lds.S | 1 +
drivers/oprofile/buffer_sync.c | 4 +-
include/asm-generic/vmlinux.lds.h | 13 +
include/linux/compiler.h | 2 +-
include/linux/module.h | 5 +
include/linux/notifier.h | 15 +-
include/linux/static_call.h | 298 ++++++++++++++++++++
include/linux/static_call_types.h | 35 +++
include/linux/tracepoint-defs.h | 5 +
include/linux/tracepoint.h | 86 ++++--
include/trace/define_trace.h | 14 +-
kernel/Makefile | 1 +
kernel/cpu_pm.c | 48 ++--
kernel/jump_label.c | 10 +-
kernel/kprobes.c | 2 +
kernel/module.c | 15 +-
kernel/notifier.c | 144 ++++++----
kernel/power/hibernate.c | 39 ++-
kernel/power/main.c | 8 +-
kernel/power/power.h | 3 +-
kernel/power/suspend.c | 14 +-
kernel/power/user.c | 14 +-
kernel/static_call.c | 482 ++++++++++++++++++++++++++++++++
kernel/trace/bpf_trace.c | 8 +-
kernel/trace/trace.c | 2 +-
kernel/trace/trace_events.c | 2 +-
kernel/trace/trace_printk.c | 4 +-
kernel/tracepoint.c | 39 ++-
tools/include/linux/static_call_types.h | 35 +++
tools/objtool/check.c | 138 +++++++++
tools/objtool/check.h | 1 +
tools/objtool/elf.c | 8 +-
tools/objtool/elf.h | 3 +-
tools/objtool/objtool.h | 1 +
tools/objtool/orc_gen.c | 4 +-
tools/objtool/sync-check.sh | 1 +
tools/power/pm-graph/sleepgraph.py | 2 +-
47 files changed, 1585 insertions(+), 241 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/include/linux/static_call_types.h
next reply other threads:[~2020-10-12 15:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 15:55 Ingo Molnar [this message]
2020-10-12 21:25 ` [GIT PULL] Static calls for v5.10 pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201012155542.GA3557765@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).