s390/smp: call smp_reinit_ipl_cpu() before scheduler is available
authorAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 1 Sep 2022 08:33:51 +0000 (10:33 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 14 Sep 2022 14:46:00 +0000 (16:46 +0200)
Currently smp_reinit_ipl_cpu() is a pre-SMP early initcall.
That ensures no CPU is running in parallel, but still not
enough to assume the code is exclusive, since the scheduling
is already available.

Move the function call to arch_call_rest_init() callback
to ensure no thread could be preempted and allow lockless
allocation of the kernel page tables. That is needed to
allow a follow-up rework of the absolute lowcore access
mechanism.

Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/smp.h
arch/s390/kernel/setup.c
arch/s390/kernel/smp.c

index 7f5d4763357b433c51f902c0c38c66d41fd33562..59cd27255f38bbb0a6d858ae9e3022e03aac2f36 100644 (file)
@@ -58,6 +58,7 @@ static inline void smp_cpus_done(unsigned int max_cpus)
 {
 }
 
+extern int smp_reinit_ipl_cpu(void);
 extern int smp_rescan_cpus(void);
 extern void __noreturn cpu_die(void);
 extern void __cpu_die(unsigned int cpu);
index bbd4bde4f65d3eb760df9857695ee58847c4012f..063f0512a64aebc68cb19cdf4785e674acea0b4f 100644 (file)
@@ -395,6 +395,7 @@ void __init arch_call_rest_init(void)
 {
        unsigned long stack;
 
+       smp_reinit_ipl_cpu();
        stack = stack_alloc();
        if (!stack)
                panic("Couldn't allocate kernel stack");
index 30c91d56593374fcb8b43a1be5a5fe6eefa00a3c..0e8e5546933fa96978d6d71e76a82d7c5b2a0efc 100644 (file)
@@ -1256,7 +1256,7 @@ static __always_inline void set_new_lowcore(struct lowcore *lc)
                : "memory", "cc");
 }
 
-static int __init smp_reinit_ipl_cpu(void)
+int __init smp_reinit_ipl_cpu(void)
 {
        unsigned long async_stack, nodat_stack, mcck_stack;
        struct lowcore *lc, *lc_ipl;
@@ -1291,4 +1291,3 @@ static int __init smp_reinit_ipl_cpu(void)
 
        return 0;
 }
-early_initcall(smp_reinit_ipl_cpu);