This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Surprising mutex configuration behavior.


Hi,

Using default eCos configuration, all the mutexes are by default created
with priority inversion protocol INHERIT (as defined by the
CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DEFAULT
configuration option), and dynamic selection of the inversion protocol
at run-time is enabled. Still everything is OK.

Now I've provided user-defined value 0 instead of default 1 for
CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC, in a hope
to get INHERIT mutexes and no run-time selection of the protocol. I've
got a surprise instead, -- all the mutexes are now created with priority
inversion protocol CEILING. 

Adding even more confusion, the
CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DEFAULT still has
the value INHERIT. Well, its documentation does suggest that it's used
only when dynamic selection of the protocol is enabled, but who reads
the documentation anyway. Really bad thing is that in this case it's
impossible to correctly guess from the context of ecos.ecc file alone
what inversion protocol is actually used by the mutexes. I myself have
noticed it only due to a bug(?) in tm_basic test that just hangs when
CEILING mutex with priority 0 (the default) is used in "Unlock/Lock
mutex" test. More about the latter in a different post.

Only explicit providing of user value 0 for
CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING helps to
get INHERIT mutexes back.

As far as I can tell, this confusing behavior is in fact the result of
the way the involved macros are used in the "mutex.cxx" file. I believe
it'd be better to still use
CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DEFAULT value to
select between INHERIT and CEILING when dynamic selection of the
protocol is disabled.

-- 
Sergei.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]