From 6070970db9fed2a8badd00eee767ce3b2888baad Mon Sep 17 00:00:00 2001 From: Jean-Michel Hautbois Date: Wed, 16 Oct 2024 18:18:55 +0200 Subject: [PATCH] m68k: Initialize jump labels early during setup_arch() When using static keys early, e.g. by specifying "thread_backlog_napi" on the kernel command line: WARNING: CPU: 0 PID: 0 at include/linux/jump_label.h:322 setup_backlog_napi_threads+0x40/0xa0 static_key_enable(): static key '0x5ceec0' used before call to jump_label_init() The function jump_label_init() should be called from setup_arch() very early for proper functioning of jump label support. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/20241016-fix-jump-label-v1-1-eb74c5f68405@yoseli.org [geert: Add reproducer] Signed-off-by: Geert Uytterhoeven --- arch/m68k/kernel/setup_mm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c index 10310b04f77d8..15c1a595a1de0 100644 --- a/arch/m68k/kernel/setup_mm.c +++ b/arch/m68k/kernel/setup_mm.c @@ -249,7 +249,11 @@ void __init setup_arch(char **cmdline_p) process_uboot_commandline(&m68k_command_line[0], CL_SIZE); *cmdline_p = m68k_command_line; memcpy(boot_command_line, *cmdline_p, CL_SIZE); - + /* + * Initialise the static keys early as they may be enabled by the + * cpufeature code and early parameters. + */ + jump_label_init(); parse_early_param(); switch (m68k_machtype) { -- 2.47.3