From 38f00bd438cd392eaf3f6d603be98374ee1a93ac Mon Sep 17 00:00:00 2001 From: Enjia Mai Date: Sat, 15 Jan 2022 23:57:34 +0800 Subject: [PATCH] kernel: smp: change back the order of SMP thread and timer initialization Commit 3457118 changed the sequence of z_smp_thread_init() and smp_timer_init() in smp_init_top() subroutine, which initializes other BPs. In some boards (up_squared, acrn_ehl_crb) it will fail to work while SMP enabling. If the timer interrupt is enabled before the first thread was initialized. Now change back to its original order. Fixes #41835 Signed-off-by: Enjia Mai --- kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/smp.c b/kernel/smp.c index 505393b61f..87ad3b7926 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -84,9 +84,9 @@ static inline FUNC_NORETURN void smp_init_top(void *arg) { struct k_thread dummy_thread; - smp_timer_init(); (void)atomic_set(&ready_flag, 1); z_smp_thread_init(arg, &dummy_thread); + smp_timer_init(); z_swap_unlocked(); CODE_UNREACHABLE; /* LCOV_EXCL_LINE */