SMP: Minor SMP-related clean-up/improvements

This commit is contained in:
Gregory Nutt 2016-02-11 12:18:54 -06:00
parent 49227fa554
commit ddbc948895
5 changed files with 19 additions and 33 deletions

2
arch

@ -1 +1 @@
Subproject commit 7451a16948db82ad2a75723df73160357d816577
Subproject commit cf3c8382fa36d28b1f153536368cfb07adfbb286

@ -1 +1 @@
Subproject commit 81a10b64ed544684bb975e218e09ab5bc8aaf445
Subproject commit 600d77e8b4631a67a6099b35a6959b6099b4a42b

View File

@ -256,6 +256,15 @@ config SMP_NCPUS
This value identifies the number of CPUs support by the processor
that will be used for SMP.
config SMP_IDLETHREAD_STACKSIZE
int "CPU IDLE stack size"
default 2048
---help---
Each CPU will have its own IDLE stack. System initialization occurs
on CPU0 and uses CONFIG_IDLETHREAD_STACKSIZE which will probably be
larger than is generally needed. This setting provides the STACK
size for the IDLE task on CPUS 1 through (CONFIG_SMP_NCPUS-1).
endif # SMP
choice

View File

@ -40,14 +40,12 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
# include "sched/sched.h"
# include "init/init.h"
#include "init/init.h"
#ifdef CONFIG_SMP
@ -72,22 +70,7 @@
int os_idletask(int argc, FAR char *argv[])
{
FAR struct tcb_s *rtcb = this_task();
irqstate_t flags;
int cpu = this_cpu();
/* Make sure that this thread is assigned to the current CPU */
DEBUGASSERT(rtcb->cpu == cpu);
/* REVISIT: disabling interrupts is not sufficient protection */
flags = irqsave();
rtcb->flags |= TCB_FLAG_CPU_ASSIGNED;
rtcb->cpu = cpu;
irqrestore(flags);
/* Then enter the IDLE loop */
/* Enter the IDLE loop */
sdbg("CPU%d: Beginning Idle Loop\n");
for (; ; )

View File

@ -300,20 +300,16 @@ uint8_t g_os_initstate; /* See enum os_initstate_e */
* initialization task is responsible for bringing up the rest of the system.
*/
static FAR struct task_tcb_s g_idletcb;
static struct task_tcb_s g_idletcb;
/* This is the name of the idle task */
static FAR const char g_idlename[] = "Idle Task";
static const char g_idlename[] = "Idle Task";
/* This the IDLE idle threads argument list. */
static FAR char *g_idleargv[2];
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -336,6 +332,7 @@ static FAR char *g_idleargv[2];
void os_start(void)
{
FAR dq_queue_t *tasklist;
int i;
slldbg("Entry\n");
@ -438,14 +435,11 @@ void os_start(void)
/* Then add the idle task's TCB to the head of the ready to run list */
#ifdef CONFIG_SMP
/* Use the list a ready-to-run tasks assigned to CPU0 */
dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_assignedtasks[0]);
tasklist = TLIST_HEAD(TSTATE_TASK_RUNNING, 0);
#else
/* Use the common, unassigned ready-to-run list */
dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_readytorun);
tasklist = TLIST_HEAD(TSTATE_TASK_RUNNING);
#endif
dq_addfirst((FAR dq_entry_t *)&g_idletcb, tasklist);
/* Initialize the processor-specific portion of the TCB */