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>
This commit is contained in:
Andy Ross 2018-04-12 12:10:10 -07:00 committed by Andrew Boie
commit eb258706e0

View file

@ -238,6 +238,9 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
_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 @@ FUNC_NORETURN void _Cstart(void)
__stack_chk_guard = (void *)sys_rand32_get();
#endif
#ifdef CONFIG_SMP
smp_init();
#endif
/* display boot banner */
switch_to_main_thread();