[PATCH] arm: kernel: initialize jump labels before parsing early params

From: lirongqing

Date: Mon Jul 06 2026 - 02:17:00 EST


From: Li RongQing <lirongqing@xxxxxxxxx>

On ARM systems, static keys (jump labels) may be utilized within
the setup functions triggered by parse_early_param(). If these
subroutines attempt to enable or manipulate a static key before
jump_label_init() has been executed, it will result in a kernel
warning or an early boot panic (e.g., "static key used before
call to jump_label_init()").

Other architectures have faced identical boot order dependency issues.
For instance, commit ca829e05d3d4 ("powerpc/64: Init jump labels before
parse_early_param()") and commit 6070970db9fe ("m68k: Initialize jump
labels early during setup_arch()") explicitly relocated jump_label_init()
before the early parameter parsing.

Fix this by moving the call to jump_label_init() right before
parse_early_param() inside setup_arch(), ensuring that the jump
label subsystem is fully initialized and safe to use for all
early parameter handlers.

Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
---
arch/arm/kernel/setup.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0bfd66c..a928dcb 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,7 @@
#include <linux/compiler.h>
#include <linux/sort.h>
#include <linux/psci.h>
+#include <linux/jump_label.h>

#include <asm/unified.h>
#include <asm/cp15.h>
@@ -1135,6 +1136,7 @@ void __init setup_arch(char **cmdline_p)
early_fixmap_init();
early_ioremap_init();

+ jump_label_init();
parse_early_param();

#ifdef CONFIG_MMU
--
2.9.4