All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Fast mutexes vs. automatic mode switch
@ 2008-10-13 11:47 Jan Kiszka
  2008-10-13 11:59 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2008-10-13 11:47 UTC (permalink / raw)
  To: xenomai-core

Hi,

while preparing my reworked fast mutex patches for submission, reviewing
them once again, I realized a conception problem that the fast path can
introduce: So far every pthread_mutex_lock or rt_mutex_acquire forced
the caller into primary mode in case it was in secondary before. Now
this will only happen if the mutex is contended!

Let's consider the fairly typical use case of a two threads
synchronizing a critical section with the help of a mutex. One thread is
high-prio, always in primary mode, the other is low-prio, constantly
transiting between primary (while holding the lock) and secondary (while
interacting with Linux). If the low-prio acquires the uncontended lock,
it will now remain in secondary mode thanks to the new mutex fast path.
That means if the high-prio requests the lock as well, prio-inheritance
will no longer work as the owner is not in the right mode!

I guess what we need is mode detection for the caller in the mutex fast
path. If the possible new owner is in secondary mode, the syscall path
needs to be taken to trigger a migration reliably. That in turn means we
need a syscall-less detection of the current execution mode. Any
spontaneous ideas on this?

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-13 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13 11:47 [Xenomai-core] Fast mutexes vs. automatic mode switch Jan Kiszka
2008-10-13 11:59 ` Gilles Chanteperdrix
2008-10-13 12:11   ` Jan Kiszka
2008-10-13 12:17     ` Gilles Chanteperdrix
2008-10-13 14:25       ` Jan Kiszka
2008-10-13 18:08         ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.