Skip to content

Commit

Permalink
kernel: Move SMP initialization to start of main thread
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Andy Ross authored and andrewboie committed May 2, 2018
1 parent d171568 commit eb25870
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kernel/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit eb25870

Please sign in to comment.