[riot-devel] Changing Cortex-M PendSV priority and handling in mutex.c

Nikander Pekka pekka.nikander at aalto.fi
Mon Sep 17 14:33:11 CEST 2018


> But I've been running the system with subpriorities now just for less than an hour.  Hence, I cannot say much about the real stability yet.  Already before adopting subpriorities, but with cpsid and cpsie in isr_svc(), the system was semistable, never crashing but still xtimer_*sleep() blocking, sometimes soon, sometimes only after hours.
> 
> While testing with various options and debugging quite a lot, I've seen the variants of xtimer_*sleep both to crash and block a lot.  Hence, I strongly suspect that there are some latent bugs there.  But I don't properly understand what is going on there.  Most likely some interrupt landing in the middle of the PendSV handler somehow interacts with their mutex use, easily causing blocking and easily also corrupting the stacks.
> 
> My student had so big problems with xtimer_*sleep related instabilities that he reverted to use xtimer_set_msg instead.

Unfortunately I sent the message a little bit too early.  I still encounter threads, which are using xtimer_usleep, rarely and ramdomly blocking, most probably at the second mutex_lock call in _xtimer_tsleep().

I don't have right now time to dig deeper into that but will rewrite those threads to use xtimer_set_msg instead.

--Pekka



More information about the devel mailing list