nuttx/sched
Masayuki Ishikawa d295f11a3a SMP: Introduce a new global IRQ clearing logic and tasklist protection.
The previous implementation of clearing global IRQ in sched_addreadytorun()
and sched_removereadytorun() was done too early. As a result, nxsem_post()
would have a chance to enter the critical section even nxsem_wait() is
still not in blocked state. This patch moves clearing global IRQ controls
from sched_addreadytorun() and sched_removereadytorun() to sched_resumescheduler()
to ensure that nxsem_post() can enter the critical section correctly.

For this change, sched_resumescheduler.c is always necessary for SMP configuration.
In addition, by this change, task_exit() had to be modified so that it calls
sched_resumescheduler() because it calls sched_removescheduler() inside the
function, otherwise it will cause a deadlock.

However, I encountered another DEBUGASSERT() in sched_cpu_select() during
HTTP streaming aging test on lc823450-xgevk. Actually sched_cpu_select()
accesses the g_assignedtasks which might be changed by another CPU. Similarly,
other tasklists might be modified simultaneously if both CPUs are executing
scheduling logic. To avoid this, I introduced tasklist protetion APIs.

With these changes, SMP kernel stability has been much improved.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2018-01-31 15:35:36 +09:00
..
clock sched/clock/clock_systimer.c: Change the way that the 64-bit time is sampled. Previously, we disabled interrupts before sampling the 64-bit timer since the uint64_t access is not atomic on most CPUs. However, disabling (local) interrupts does not work in the SMP case. In that case, the timer interrupt will be running on only one of the CPUs; disabling interrupts on a different CPU will provide no protection from timer rollover. To work around this, logic was added that samples 64-bit timer is sampled twice and if 32-bit rollover was detected between samples, then loops until there is no rollover. 2018-01-15 11:05:45 -06:00
environ sched/env_dup.c: Fix an error in the duplication of the child tasks environment in the special case where the parent's environment was created, but then all of the variables were unset. In that case, there is still an allocation in place but the size of the allocation is zero. This case was not being handled correctly when a child task attempts to create its environment and inherit the zero-size partent environment. Noted by Anthony Merlino. 2017-09-18 19:02:54 -06:00
errno Remove some empty file section section header comments 2016-02-17 18:05:03 -06:00
group Squashed commit of the following: 2017-10-09 09:06:46 -06:00
init arch/arm/src/lpc54xx: Add configuration logic to the empty SPI driver. Still missing all data tranfer logic. 2018-01-13 15:38:55 -06:00
irq Update comments, mostly spelling errors. 2018-01-27 09:37:46 -06:00
module Update comments, mostly spelling errors. 2018-01-27 09:37:46 -06:00
mqueue Fix a few places where there was a semicolon following the 'if' condition, makeing the following logic unconditional. 2017-10-10 14:24:13 -06:00
paging Squashed commit of the following: 2018-01-30 11:08:18 -06:00
pthread sched/: Fix several inappropriate accesses to get_errno() that were missed in previous changes (some going back to nuttx-.23). Add new nxsched_setscheduler() and nxsched_getaffinity() which are equivalent to their counterparts without the nx on front. These versions do not modify the errno value. Changed all calls within the OS to use these newer versions of the functions. 2018-01-30 16:16:41 -06:00
sched SMP: Introduce a new global IRQ clearing logic and tasklist protection. 2018-01-31 15:35:36 +09:00
semaphore Squashed commit of the following: 2018-01-30 11:08:18 -06:00
signal Changes from review of clock_nanosleep(): Misplaced right bracket, but return value in one failure case. 2017-11-11 18:01:28 -06:00
task SMP: Introduce a new global IRQ clearing logic and tasklist protection. 2018-01-31 15:35:36 +09:00
timer Squashed commit of the following: 2017-10-07 10:57:09 -06:00
wdog sched/: Various fixes for typos, improved parameter verification. 2018-01-12 18:26:45 -06:00
wqueue Squashed commit of the following: 2018-01-30 17:57:36 -06:00
.gitignore .dSYM only needs to be in the same .gitignore files as .exe 2013-05-30 15:02:04 -06:00
Kconfig sched/irq: Add a configuration option to show interrupt information via a procfs file. 2018-01-12 18:26:46 -06:00
Makefile TLS: Simplify 2016-03-11 07:17:32 -06:00