zephyr/kernel
Andy Ross eace1df539 kernel/sched: Fix SMP scheduling
Recent changes post-scheduler-rewrite broke scheduling on SMP:

The "preempt_ok" feature added to isolate preemption points wasn't
honored in SMP mode.  Fix this by adding a "swap_ok" field to the CPU
record (not the thread) which is set at the same time out of
update_cache().

The "queued" flag wasn't being maintained correctly when swapping away
from _current (it was added back to the queue, but the flag wasn't
set).

Abstract out a "should_preempt()" predicate so SMP and uniprocessor
paths share the same logic, which is distressingly subtle.

There were two places where _Swap() was predicated on
_get_next_ready_thread() != _current.  That's no longer a benign
optimization in SMP, where the former function REMOVES the next thread
from the queue.  Just call _Swap() directly in SMP, which has a
unified C implementation that does this test already.  Don't change
other architectures in case it exposes bugs with _Swap() switching
back to the same thread (it should work, I just don't want to break
anything).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-05-31 14:02:03 -04:00
..
include kernel/sched: Fix SMP scheduling 2018-05-31 14:02:03 -04:00
alert.c syscalls: remove policy from handler checks 2018-05-17 23:34:03 +03:00
atomic_c.c
CMakeLists.txt kernel: Cmake: Add __ZEPHYR_SUPERVISOR__ macro for kernel files. 2018-05-15 17:48:18 +03:00
compiler_stack_protect.c kernel: add CODE_UNREACHABLE in _StackCheckHandler 2018-04-17 10:50:12 -07:00
device.c kernel: device: Only compare strings if pointer comparison fails 2018-02-15 17:31:59 -08:00
errno.c
idle.c kernel: Rework SMP irq_lock() compatibility layer 2018-05-02 10:00:17 -07:00
init.c kernel: Use IS-specific entropy function when available 2018-05-24 15:13:13 -07:00
int_latency_bench.c
Kconfig arch: x86: Rename CPU_NO_SPECTRE to CPU_NO_SPECTRE_V2 2018-05-24 13:07:12 -04:00
Kconfig.event_logger kconfig: fix more help spacing issues 2018-02-15 23:20:55 -05:00
Kconfig.power_mgmt kconfig: fix more help spacing issues 2018-02-15 23:20:55 -05:00
mailbox.c kernel: Fix sloppy wait queue API 2018-05-18 01:48:48 +03:00
mem_domain.c kernel: mem_domain: Fix compile issues 2018-03-05 10:47:00 -06:00
mem_slab.c kernel: mem_slab: Reschedule in k_mem_slab_free only when necessary. 2018-05-18 20:16:50 +03:00
mempool.c kernel/mempool: Handle transient failure condition 2018-05-27 09:55:04 -04:00
msg_q.c kernel: Wait queues aren't dlists anymore 2018-05-19 07:00:55 +03:00
mutex.c kernel: Fix sloppy wait queue API 2018-05-18 01:48:48 +03:00
pipes.c kernel: Wait queues aren't dlists anymore 2018-05-19 07:00:55 +03:00
poll.c k_poll: expose to user mode 2018-05-17 23:34:03 +03:00
queue.c kernel: Fix sloppy wait queue API 2018-05-18 01:48:48 +03:00
sched.c kernel/sched: Fix SMP scheduling 2018-05-31 14:02:03 -04:00
sem.c kernel: Fix sloppy wait queue API 2018-05-18 01:48:48 +03:00
smp.c kernel: Rework SMP irq_lock() compatibility layer 2018-05-02 10:00:17 -07:00
stack.c kernel: Wait queues aren't dlists anymore 2018-05-19 07:00:55 +03:00
sys_clock.c syscalls: remove policy from handler checks 2018-05-17 23:34:03 +03:00
system_work_q.c
thread_abort.c syscalls: remove policy from handler checks 2018-05-17 23:34:03 +03:00
thread.c kernel: handle early entropy issues 2018-05-23 19:38:06 -07:00
timer.c kernel: Fix sloppy wait queue API 2018-05-18 01:48:48 +03:00
userspace_handler.c syscalls: remove policy from handler checks 2018-05-17 23:34:03 +03:00
userspace.c userspace: generate list of kernel object sizes 2018-05-16 17:32:59 -07:00
version.c kernel: version: no need to store version in RAM 2017-09-07 16:34:50 -07:00
work_q.c work_q: Correctly clear pending flag in delayed work queue, update docs 2018-02-13 18:08:57 -05:00