zephyr/kernel
Daniel Leung adac4cbafa sched: smp: fix thread marked dead but still running
Under SMP, when a thread is marked aborting, this thread may still
be running on another CPU. However, if there is only one thread
available to run, this thread may be selected to run again due to
next_up() not checking for the aborting state. Moreover, when
there is no IPI to signal to others k_thread_abort() being called,
the k_thread_abort() target thread is marked dead after a new
thread is selected to run. This causes the original thread calling
k_thread_abort() to mistaken that target thread is no longer
running and returns.

Note that, with working IPI, z_sched_ipi() is called as an ISR
to mark the target thread dead. A new thread is then selected to
run, so that the target thread would not be selected due to it
being dead.

This moves the code to mark thread dead into next_up(), where
the next best thread is selected, and the current thread being
swapped out. z_sched_ipi() now becomes an empty function, and
calls to it are removed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-31 11:46:35 -05:00
..
include mempool: use k_malloc heap for ISR allocations 2020-01-24 09:27:59 -08:00
atomic_c.c kernel: fix the bug in atomic_c.c 2019-09-26 21:13:20 -04:00
CMakeLists.txt cmake: Add target for generating header files 2020-01-29 11:44:57 -06:00
compiler_stack_protect.c kernel: Fix gcc-9.2 warning with _StackCheckHandler 2019-10-04 05:22:30 -07:00
device.c kernel: device: Add const qualifier to device_config 2020-01-22 06:32:36 -06:00
errno.c headers: Refactor kernel and arch headers. 2019-11-06 16:07:32 -08:00
fatal.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
futex.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
idle.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
init.c coverage: do not dump coverage data by default 2020-01-30 16:04:03 -05:00
Kconfig kernel: kconfig: Make SCHED_IPI_SUPPORTED invisible 2020-01-20 18:38:10 -05:00
Kconfig.power_mgmt kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
mailbox.c global: Remove leading/trailing blank lines in files 2019-12-11 19:17:27 +01:00
mem_domain.c kernel: fix k_mem_partition data types 2019-12-12 14:48:42 -08:00
mem_slab.c kernel: mem_slab: error handling 2020-01-20 17:19:54 -05:00
mempool.c mempool: use k_malloc heap for ISR allocations 2020-01-24 09:27:59 -08:00
msg_q.c kernel: msgq: error handling 2020-01-20 17:19:54 -05:00
mutex.c kernel: mutex: add error checking 2020-01-20 17:19:54 -05:00
pipes.c kernel: pipe: runtime error checking 2020-01-20 17:19:54 -05:00
poll.c kernel: poll: Allow 0 event input 2020-01-03 11:26:46 -08:00
queue.c kernel/queue: Fix SMP race 2020-01-21 14:47:52 -08:00
sched.c sched: smp: fix thread marked dead but still running 2020-01-31 11:46:35 -05:00
sem.c kernel: semaphore: optimize code 2020-01-20 17:19:54 -05:00
smp.c kernel: cleanup and formally define CPU start fn 2020-01-13 16:35:10 -05:00
stack.c kernel: stack: error handling 2020-01-20 17:19:54 -05:00
system_work_q.c kernel: system_work_q: Set dedicated "sysworkq" name. 2018-10-19 07:58:45 -04:00
thread_abort.c kernel/sched: Move thread suspend and abort under the scheduler lock 2020-01-08 14:21:10 +01:00
thread.c kernel: thread: fix string for _THREAD_PRESTART 2020-01-29 13:17:19 -08:00
timeout.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00
timer.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00
userspace_handler.c kernel: remove vestigal printk references 2019-10-01 16:15:06 -05:00
userspace.c kernel: use 'thread' for thread variable consistently 2019-12-21 19:57:57 -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: error handling 2020-01-20 17:19:54 -05:00