mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-05 21:51:56 +00:00
Timeslicing works by removing the _current thread from the run queue and re-adding it at the end of its priority. On systems with a _Swap() that can be preempted by a timer interrupt, that means it's possible for the timeslice to try to slice out a thread that had already pended itself! This behavior used to be benign (or at least undetectable) as the duplicated list operations were idempotent. But now the dlist code is stricter about correctness and has exposed the bug -- it will blow up if you try to remove an already-removed list node. Fix (on affected platforms) by stashing the _current pointer in _pend_current_thread() that is checked and cleared in the timer interrupt. If we discover we're trying to interrupt a thread that's already interrupted itself, we can safely exit z_time_slice() as a noop. The timeslicing bookeeping was already done for us underneath the pend code. 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.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 | ||
system_work_q.c | ||
thread_abort.c | ||
thread.c | ||
timeout.c | ||
timer.c | ||
userspace_handler.c | ||
userspace.c | ||
version.c | ||
work_q.c |