Yann Sionneau <yann.sionneau%gmail.com@localhost> wrote:
I've tried to understand how ci_mtx_count is supposed to be managed my
MD code, so far I failed to understand.
It seems some arch use spin_mutex and inc/dec ci_mtx_count upon
spin_mutex_enter/exit.
Some other archs do it in softint handling.
Could someone give my some clue (or documentation) about the intended
behaviour of curcpu()->ci_mtx_count please?
It is a reference count on the IPL raised by spin-mutexes. The IPL should
be lowered (straight to IPL_NONE) on a last reference. Notice that this is
a negative counter - mutex_spin_enter() decrements, while mutex_spin_exit()
incremenets. Not the other way round.