zephyr/kernel
Andy Ross dff6b71450 kernel/sched: More nonatomic swap fixes
Nonatomic swap strikes again.  These issues are all longstanding, but
were unmasked by the dlist work in commit d40b8ce1fb ("sys: dlist:
Add sys_dnode_is_linked") where list node pointers become nulls on
removal.

The previous fix was for a specific case where a timeslicing interrupt
would try to slice out the "wrong" current thread because the thread
has "just" pended itself.  That was incomplete, because the parallel
code in k_sleep() didn't flag itself the same way.

And beyond that, it turns out to be basically impossible (now that I'm
thinking about it correctly) to prevent interrupt code from calling
into the scheduler to suspend a "just pended but not quite" current
and/or preempt away to another thread.  In any of these cases, the
scheduler modifications to the state bits remain correct but the queue
nodes may be corrupt because the thread was already removed from the
ready queue.  So we have to test and correct this at the lowest level,
where a thread is being removed from a priq: check that it's (1) the
ready queue and not a waitq, (2) the current thread, and (3) already
marked suspended and thus not in the queue.

There are lots of existing issues filed in the last few months all
pointing to odd instability on ARM platforms.  I'm reasonably certain
this is the root cause for most or all of them.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-27 12:07:34 -08:00
..
include kernel: syscall_handler: get rid of stdarg 2019-02-25 13:42:03 -08:00
atomic_c.c kernel/atomic_c: Spinlockify 2019-02-08 14:49:39 -05:00
CMakeLists.txt cmake: Use variables for target names 2019-01-19 07:21:55 -05:00
compiler_stack_protect.c userspace: remove APP_SHARED_MEM Kconfig 2019-02-23 07:43:55 -05:00
device.c kernel: check retval of driver init 2018-12-07 19:33:23 -05:00
errno.c kernel: userspace: reserve stack space to store local data 2018-08-17 09:40:52 -07:00
idle.c power: Fix naming of Kconfig options controlling deep sleep states 2019-02-12 07:46:32 -05:00
init.c userspace: remove APP_SHARED_MEM Kconfig 2019-02-23 07:43:55 -05:00
int_latency_bench.c kernel: Make statements evaluate boolean expressions 2019-01-07 08:52:07 -05:00
Kconfig arch: make __ramfunc support transparent 2019-02-22 11:36:50 -08:00
Kconfig.power_mgmt power: rename CPU_LPS_n power states 2019-02-26 02:30:13 +01:00
mailbox.c kernel/mbox: Spinlockify 2019-02-08 14:49:39 -05:00
mem_domain.c kernel/mem_domain: Spinlockify 2019-02-08 14:49:39 -05:00
mem_slab.c kernel/mem_slab: Spinlockify 2019-02-08 14:49:39 -05:00
mempool.c kernel/mempool: Spinlockify 2019-02-08 14:49:39 -05:00
msg_q.c kernel/msg_q: Spinlockify 2019-02-08 14:49:39 -05:00
mutex.c kernel/mutex: Spinlockify 2019-02-08 14:49:39 -05:00
pipes.c include: misc: util.h: Rename min/max to MIN/MAX 2019-02-14 22:16:03 -05:00
poll.c kernel/poll: Spinlockify 2019-02-08 14:49:39 -05:00
queue.c kernel/queue: Spinlockify 2019-02-08 14:49:39 -05:00
sched.c kernel/sched: More nonatomic swap fixes 2019-02-27 12:07:34 -08:00
sem.c kernel/k_sem: Spinlockify 2019-02-08 14:49:39 -05:00
smp.c kernel: Add _unlocked() variant to context switch primitives 2019-02-08 14:49:39 -05:00
stack.c kernel/stack: Spinlockify 2019-02-08 14:49:39 -05:00
system_work_q.c kernel: system_work_q: Set dedicated "sysworkq" name. 2018-10-19 07:58:45 -04:00
thread.c kernel/thread: Spinlockify 2019-02-08 14:49:39 -05:00
thread_abort.c kernel/thread_abort: Remove needless locking 2019-02-08 14:49:39 -05:00
timeout.c include: misc: util.h: Rename min/max to MIN/MAX 2019-02-14 22:16:03 -05:00
timer.c kernel/timer: Spinlockify 2019-02-08 14:49:39 -05:00
userspace.c userspace: remove APP_SHARED_MEM Kconfig 2019-02-23 07:43:55 -05:00
userspace_handler.c kernel: Make statements evaluate boolean expressions 2019-01-07 08:52:07 -05:00
version.c doc: add kernel version API to doxygen 2018-12-08 17:24:53 -05:00
work_q.c kernel/work_q: Fix block-in-spinlock bug 2019-02-14 19:45:20 -05:00