sched/idle: disable sched when idle call nx_bringup

Because idle task will call mm_malloc to create some task
and will take sem of mm. But if smp enable, the sem of mm may be
taken by other cpu, so idle may be block because take this sem and crash.

Change-Id: I22f0233ef6c59a1b81607d4389e68f8646c89395
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2021-06-03 20:57:10 +08:00 committed by Xiang Xiao
parent 669619a06a
commit 198b85d233
1 changed files with 11 additions and 0 deletions

View File

@ -759,6 +759,13 @@ void nx_start(void)
syslog_initialize();
/* Disables context switching beacuse we need take the memory manager
* semaphore on this CPU so that it will not be available on the other
* CPUs until we have finished initialization.
*/
sched_lock();
#ifdef CONFIG_SMP
/* Start all CPUs *********************************************************/
@ -782,6 +789,10 @@ void nx_start(void)
DEBUGVERIFY(nx_bringup());
/* Let other threads have access to the memory manager */
sched_unlock();
/* The IDLE Loop **********************************************************/
/* When control is return to this point, the system is idle. */