SMP: Setting bit for wrong CPU. Assertion has cause false alarm crashes..

This commit is contained in:
Gregory Nutt 2016-02-18 12:31:21 -06:00
parent 7d9287958f
commit 1780000777
3 changed files with 11 additions and 8 deletions

2
arch

@ -1 +1 @@
Subproject commit bd833ac25f0f982a372d8d9df5e1634a6eb21b32
Subproject commit 5a6306b76aa6656c56f5c19cbf18757a295ee1bc

View File

@ -216,7 +216,9 @@ enum tstate_e
};
typedef enum tstate_e tstate_t;
/* The following definitions are determined by tstate_t */
/* The following definitions are determined by tstate_t. Ordering of values
* in the enumeration is important!
*/
#define FIRST_READY_TO_RUN_STATE TSTATE_TASK_READYTORUN
#define LAST_READY_TO_RUN_STATE TSTATE_TASK_RUNNING

View File

@ -275,7 +275,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
switched = sched_addprioritized(btcb, tasklist);
/* If the selected task was the g_assignedtasks[] list, then a context
* swith will occur.
* switch will occur.
*/
if (switched)
@ -304,12 +304,12 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
if (btcb->lockcount > 0)
{
spin_setbit(&g_cpu_lockset, this_cpu(), &g_cpu_locksetlock,
spin_setbit(&g_cpu_lockset, cpu, &g_cpu_locksetlock,
&g_cpu_schedlock);
}
else
{
spin_clrbit(&g_cpu_lockset, this_cpu(), &g_cpu_locksetlock,
spin_clrbit(&g_cpu_lockset, cpu, &g_cpu_locksetlock,
&g_cpu_schedlock);
}
@ -319,12 +319,12 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
if (btcb->irqcount > 0)
{
spin_setbit(&g_cpu_irqset, this_cpu(), &g_cpu_irqsetlock,
spin_setbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
&g_cpu_irqlock);
}
else
{
spin_clrbit(&g_cpu_irqset, this_cpu(), &g_cpu_irqsetlock,
spin_clrbit(&g_cpu_irqset, cpu, &g_cpu_irqsetlock,
&g_cpu_irqlock);
}
@ -334,11 +334,12 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
* lifting machinery.
*/
DEBUGASSERT(btcb->flink != NULL);
next = (FAR struct tcb_s *)btcb->flink;
ASSERT(!spin_islocked(&g_cpu_schedlock) && next != NULL);
if ((next->flags & TCB_FLAG_CPU_ASSIGNED) != 0)
{
DEBUGASSERT(next->cpu == cpu);
next->task_state = TSTATE_TASK_ASSIGNED;
}
else