kernel: assert no spinlock is held on swap when !USE_SWITCH
The do_swap() routine used when CONFIG_USE_SWITCH=y asserts that caller thread does not hold any spinlock when CONFIG_SPIN_VALIDATE is enabled. However, there is no similar check in place when CONFIG_USE_SWITCH=n. Copy this assertion in the USE_SWITCH=n implementation of z_swap_irqlock(). Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This commit is contained in:
parent
9c9dc0dfb4
commit
5183fc5693
@ -203,6 +203,16 @@ static inline int z_swap_irqlock(unsigned int key)
|
||||
{
|
||||
int ret;
|
||||
z_check_stack_sentinel();
|
||||
|
||||
#ifdef CONFIG_SPIN_VALIDATE
|
||||
/* Refer to comment in do_swap() above for details */
|
||||
# ifndef CONFIG_ARM64
|
||||
__ASSERT(arch_irq_unlocked(key) ||
|
||||
_current->base.thread_state & (_THREAD_DUMMY | _THREAD_DEAD),
|
||||
"Context switching while holding lock!");
|
||||
# endif /* CONFIG_ARM64 */
|
||||
#endif /* CONFIG_SPIN_VALIDATE */
|
||||
|
||||
ret = arch_swap(key);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user