SMP: Idle thread must be assigned to a CPU
This commit is contained in:
parent
89bea6917c
commit
0a7e136a5a
@ -46,14 +46,11 @@
|
|||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
|
||||||
|
# include "sched/sched.h"
|
||||||
# include "init/init.h"
|
# include "init/init.h"
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -75,6 +72,23 @@
|
|||||||
|
|
||||||
int os_idletask(int argc, FAR char *argv[])
|
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 */
|
||||||
|
|
||||||
sdbg("CPU%d: Beginning Idle Loop\n");
|
sdbg("CPU%d: Beginning Idle Loop\n");
|
||||||
for (; ; )
|
for (; ; )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user