kernel: Move SMP initialization to start of main thread
The smp_init() call was too early. Device and subsystem
initialization doesn't happen until after the main thread starts
running. Starting extra CPUs and allowing them to schedule threads
before their drivers are alive is a bad idea, even if it works in a
unit test.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
diff --git a/kernel/init.c b/kernel/init.c
index 0786a43..7f2a36b 100644
--- a/kernel/init.c
+++ b/kernel/init.c
@@ -238,6 +238,9 @@
_init_static_threads();
+#ifdef CONFIG_SMP
+ smp_init();
+#endif
#ifdef CONFIG_BOOT_TIME_MEASUREMENT
/* record timestamp for kernel's _main() function */
@@ -441,10 +444,6 @@
__stack_chk_guard = (void *)sys_rand32_get();
#endif
-#ifdef CONFIG_SMP
- smp_init();
-#endif
-
/* display boot banner */
switch_to_main_thread();