kernel/sched: Correct locking in essential thread panic
Calling a (handled/ignored) panic with the scheduler lock held produces spinlock errors in some circumstances, depending on whether or not the swap gets reached before another context switch. Release the lock around the call, we don't touch any scheduler state on the path to z_swap(), so this is safe. Signed-off-by: Andy Ross <andyross@google.com>
This commit is contained in:
parent
1903a8f415
commit
ddee1ab4cf
1 changed files with 2 additions and 0 deletions
|
@ -434,7 +434,9 @@ static ALWAYS_INLINE void z_thread_halt(struct k_thread *thread, k_spinlock_key_
|
|||
halt_thread(thread, terminate ? _THREAD_DEAD : _THREAD_SUSPENDED);
|
||||
if ((thread == _current) && !arch_is_in_isr()) {
|
||||
if (z_is_thread_essential(thread)) {
|
||||
k_spin_unlock(&_sched_spinlock, key);
|
||||
k_panic();
|
||||
key = k_spin_lock(&_sched_spinlock);
|
||||
}
|
||||
z_swap(&_sched_spinlock, key);
|
||||
__ASSERT(!terminate, "aborted _current back from dead");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue