mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-12 17:41:57 +00:00
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> |
||
---|---|---|
.. | ||
include | ||
alert.c | ||
atomic_c.c | ||
CMakeLists.txt | ||
compiler_stack_protect.c | ||
device.c | ||
errno.c | ||
idle.c | ||
init.c | ||
int_latency_bench.c | ||
Kconfig | ||
Kconfig.event_logger | ||
Kconfig.power_mgmt | ||
mailbox.c | ||
mem_domain.c | ||
mem_slab.c | ||
mempool.c | ||
msg_q.c | ||
mutex.c | ||
pipes.c | ||
poll.c | ||
queue.c | ||
sched.c | ||
sem.c | ||
smp.c | ||
stack.c | ||
sys_clock.c | ||
system_work_q.c | ||
thread_abort.c | ||
thread.c | ||
timer.c | ||
userspace_handler.c | ||
userspace.c | ||
version.c | ||
work_q.c |