mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 13:18:50 +08:00
SMP: os_start needs to hold the KMM semaphore to prevent threads from allocating memory until the bring-up is complete
This commit is contained in:
parent
8ea1bc3188
commit
fc842d740a
1 changed files with 18 additions and 0 deletions
|
@ -726,7 +726,18 @@ void os_start(void)
|
|||
#ifdef CONFIG_SMP
|
||||
/* Start all CPUs *********************************************************/
|
||||
|
||||
/* A few basic sanity checks */
|
||||
|
||||
DEBUGASSERT(this_cpu() == 0 && CONFIG_MAX_TASKS > CONFIG_SMP_NCPUS);
|
||||
|
||||
/* Take the memory manager semaphore on this CPU so that it will not be
|
||||
* available on the other CPUs until we have finished initialization.
|
||||
*/
|
||||
|
||||
DEBUGVERIFY(kmm_trysemaphore());
|
||||
|
||||
/* Then start the other CPUs */
|
||||
|
||||
DEBUGVERIFY(os_smpstart());
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
@ -740,6 +751,13 @@ void os_start(void)
|
|||
|
||||
DEBUGVERIFY(os_bringup());
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Let other threads have access to the memory manager */
|
||||
|
||||
kmm_givesemaphore();
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
/* The IDLE Loop **********************************************************/
|
||||
/* When control is return to this point, the system is idle. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue