kernel/sched: Add missing SMP thread abort case

The loop in thread abort on SMP where we wait for the results on an
IPI correctly handled the case where a thread running on another CPU
gets its interrupt and self-aborts, but it missed the case where the
other thread pends before receiving the interrupt.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2019-08-16 20:54:38 -07:00 committed by Anas Nashif
commit d442927667

View file

@ -1073,10 +1073,15 @@ void z_sched_abort(struct k_thread *thread)
*/ */
while ((thread->base.thread_state & _THREAD_DEAD) == 0U) { while ((thread->base.thread_state & _THREAD_DEAD) == 0U) {
LOCKED(&sched_spinlock) { LOCKED(&sched_spinlock) {
if (z_is_thread_queued(thread)) { if (z_is_thread_prevented_from_running(thread)) {
__ASSERT(!z_is_thread_queued(thread), "");
thread->base.thread_state |= _THREAD_DEAD; thread->base.thread_state |= _THREAD_DEAD;
} else if (z_is_thread_queued(thread)) {
_priq_run_remove(&_kernel.ready_q.runq, thread); _priq_run_remove(&_kernel.ready_q.runq, thread);
z_mark_thread_as_not_queued(thread); z_mark_thread_as_not_queued(thread);
thread->base.thread_state |= _THREAD_DEAD;
} else {
k_busy_wait(100);
} }
} }
} }