OSDN Git Service

static_call: Allow early init
authorPeter Zijlstra <peterz@infradead.org>
Tue, 18 Aug 2020 13:57:51 +0000 (15:57 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 1 Sep 2020 07:58:06 +0000 (09:58 +0200)
commita945c8345ec0decb2f1a7f19a8c5e60bcb1dd1eb
tree11d4ff482c11945ef30fe5c88493a2b49202ad27
parent6c3fce794e9d2a5ce3a948962d0808a459c40a84
static_call: Allow early init

In order to use static_call() to wire up x86_pmu, we need to
initialize earlier, specifically before memory allocation works; copy
some of the tricks from jump_label to enable this.

Primarily we overload key->next to store a sites pointer when there
are no modules, this avoids having to use kmalloc() to initialize the
sites and allows us to run much earlier.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20200818135805.220737930@infradead.org
arch/x86/kernel/setup.c
arch/x86/kernel/static_call.c
include/linux/static_call.h
kernel/static_call.c