Patching of jump labels does not have to depend on any other init code,
so we should do it as soon as possible because static_keys cannot be
used before that.

If we find it does depend on something, the init case of patching should
be modified.

Signed-off-by: Radim Krčmář <rkrc...@redhat.com>
---
There should be no reason to use static_key_enabled() now, I'll remove
it from api in following series if there are no objections.

I would also feel a bit safer with disabled interrupts, but it might not
be required.

 init/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 63d3e8f..c84fbb9 100644
--- a/init/main.c
+++ b/init/main.c
@@ -489,6 +489,11 @@ asmlinkage void __init start_kernel(void)
         */
        boot_init_stack_canary();
 
+       /*
+        * Jump labels have undefined semantics before initialization
+        */
+       jump_label_init();
+
        cgroup_init_early();
 
        local_irq_disable();
@@ -518,7 +523,6 @@ asmlinkage void __init start_kernel(void)
                   __stop___param - __start___param,
                   -1, -1, &unknown_bootoption);
 
-       jump_label_init();
 
        /*
         * These use large bootmem allocations and must precede
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to