mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
sched/init: initialize all idle thread's tl_task
since this patch forget to initialize the idle tls info:
commit 50c08bf45b
Author: Huang Qi <huangqi3@xiaomi.com>
Date: Tue Jun 29 16:01:02 2021 +0800
libc: Move pthread_key_destructor to task_info_s
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If7d0c0118323fa3dcf44081d675cd57b14eba75a
This commit is contained in:
committed by
Masayuki Ishikawa
parent
bd74dc2b88
commit
a5ac4463c2
@@ -34,7 +34,6 @@
|
|||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/sched.h>
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/sched_note.h>
|
#include <nuttx/sched_note.h>
|
||||||
#include <nuttx/tls.h>
|
|
||||||
|
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
@@ -113,31 +112,7 @@ int nx_smp_start(void)
|
|||||||
int ret;
|
int ret;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
/* Create a stack for all CPU IDLE threads (except CPU0 which already has
|
/* Start all of the other CPUs. CPU0 is already running. */
|
||||||
* a stack).
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (cpu = 1; cpu < CONFIG_SMP_NCPUS; cpu++)
|
|
||||||
{
|
|
||||||
FAR struct tcb_s *tcb = current_task(cpu);
|
|
||||||
DEBUGASSERT(tcb != NULL);
|
|
||||||
|
|
||||||
ret = up_cpu_idlestack(cpu, tcb, CONFIG_IDLETHREAD_STACKSIZE);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
serr("ERROR: Failed to allocate stack for CPU%d\n", cpu);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the processor-specific portion of the TCB */
|
|
||||||
|
|
||||||
up_initial_state(tcb);
|
|
||||||
up_stack_frame(tcb, sizeof(struct task_info_s));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Then start all of the other CPUs after we have completed the memory
|
|
||||||
* allocations. CPU0 is already running.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (cpu = 1; cpu < CONFIG_SMP_NCPUS; cpu++)
|
for (cpu = 1; cpu < CONFIG_SMP_NCPUS; cpu++)
|
||||||
{
|
{
|
||||||
|
|||||||
+37
-24
@@ -475,16 +475,6 @@ void nx_start(void)
|
|||||||
/* Mark the idle task as the running task */
|
/* Mark the idle task as the running task */
|
||||||
|
|
||||||
g_running_tasks[i] = &g_idletcb[i].cmn;
|
g_running_tasks[i] = &g_idletcb[i].cmn;
|
||||||
|
|
||||||
/* Initialize the 1st processor-specific portion of the TCB
|
|
||||||
* Note: other idle thread get initialized in nx_smpstart
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
up_initial_state(&g_idletcb[i].cmn);
|
|
||||||
up_stack_frame(&g_idletcb[i].cmn, sizeof(struct task_info_s));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Task lists are initialized */
|
/* Task lists are initialized */
|
||||||
@@ -566,8 +556,11 @@ void nx_start(void)
|
|||||||
g_pidhash[i].pid = INVALID_PROCESS_ID;
|
g_pidhash[i].pid = INVALID_PROCESS_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IDLE Group Initialization **********************************************/
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
||||||
{
|
{
|
||||||
|
FAR struct tls_info_s *info;
|
||||||
int hashndx;
|
int hashndx;
|
||||||
|
|
||||||
/* Assign the process ID(s) of ZERO to the idle task(s) */
|
/* Assign the process ID(s) of ZERO to the idle task(s) */
|
||||||
@@ -575,6 +568,39 @@ void nx_start(void)
|
|||||||
hashndx = PIDHASH(i);
|
hashndx = PIDHASH(i);
|
||||||
g_pidhash[hashndx].tcb = &g_idletcb[i].cmn;
|
g_pidhash[hashndx].tcb = &g_idletcb[i].cmn;
|
||||||
g_pidhash[hashndx].pid = i;
|
g_pidhash[hashndx].pid = i;
|
||||||
|
|
||||||
|
/* Allocate the IDLE group */
|
||||||
|
|
||||||
|
DEBUGVERIFY(group_allocate(&g_idletcb[i], g_idletcb[i].cmn.flags));
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* Create a stack for all CPU IDLE threads (except CPU0 which already
|
||||||
|
* has a stack).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
DEBUGVERIFY(up_cpu_idlestack(i, &g_idletcb[i].cmn,
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initialize the processor-specific portion of the TCB */
|
||||||
|
|
||||||
|
up_initial_state(&g_idletcb[i].cmn);
|
||||||
|
|
||||||
|
/* Initialize the thread local storage */
|
||||||
|
|
||||||
|
info = up_stack_frame(&g_idletcb[i].cmn, sizeof(struct tls_info_s));
|
||||||
|
DEBUGASSERT(info == g_idletcb[i].cmn.stack_alloc_ptr);
|
||||||
|
info->tl_task = g_idletcb[i].cmn.group->tg_info;
|
||||||
|
|
||||||
|
/* Complete initialization of the IDLE group. Suppress retention
|
||||||
|
* of child status in the IDLE group.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DEBUGVERIFY(group_initialize(&g_idletcb[i]));
|
||||||
|
g_idletcb[i].cmn.group->tg_flags = GROUP_FLAG_NOCLDWAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_lastpid = CONFIG_SMP_NCPUS - 1;
|
g_lastpid = CONFIG_SMP_NCPUS - 1;
|
||||||
@@ -703,20 +729,14 @@ void nx_start(void)
|
|||||||
binfmt_initialize();
|
binfmt_initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* IDLE Group Initialization **********************************************/
|
|
||||||
|
|
||||||
/* Announce that the CPU0 IDLE task has started */
|
/* Announce that the CPU0 IDLE task has started */
|
||||||
|
|
||||||
sched_note_start(&g_idletcb[0].cmn);
|
sched_note_start(&g_idletcb[0].cmn);
|
||||||
|
|
||||||
/* Initialize the IDLE group for the IDLE task of each CPU */
|
/* Initialize stdio for the IDLE task of each CPU */
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
for (i = 0; i < CONFIG_SMP_NCPUS; i++)
|
||||||
{
|
{
|
||||||
/* Allocate the IDLE group */
|
|
||||||
|
|
||||||
DEBUGVERIFY(group_allocate(&g_idletcb[i], g_idletcb[i].cmn.flags));
|
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
/* Clone stdout, stderr, stdin from the CPU0 IDLE task. */
|
/* Clone stdout, stderr, stdin from the CPU0 IDLE task. */
|
||||||
@@ -732,13 +752,6 @@ void nx_start(void)
|
|||||||
|
|
||||||
DEBUGVERIFY(group_setupidlefiles(&g_idletcb[i]));
|
DEBUGVERIFY(group_setupidlefiles(&g_idletcb[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete initialization of the IDLE group. Suppress retention
|
|
||||||
* of child status in the IDLE group.
|
|
||||||
*/
|
|
||||||
|
|
||||||
DEBUGVERIFY(group_initialize(&g_idletcb[i]));
|
|
||||||
g_idletcb[i].cmn.group->tg_flags = GROUP_FLAG_NOCLDWAIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start SYSLOG ***********************************************************/
|
/* Start SYSLOG ***********************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user