[PATCH 0/6][BZ #11588] pi-condvars: add priority inheritance for pthread_cond_* internal lock
Gratian Crisan
gratian.crisan@ni.com
Mon Jul 7 20:24:00 GMT 2014
Re-submitting an updated version of the series of patches Darren Hart
posted
back in 2010. The basic problem they're addressing is the fact that the
pthread_cond* calls can cause an unbounded priority inversion, described
in
BZ #11588.
It took a while but the copyright assignments should all be sorted out
now.
Paul E. McKenny submitted the assignment on behalf of IBM and one was
signed/submitted by relevant parties at National Instruments and FSF.
Longer description: When using a PTHREAD_PRIO_INHERIT mutex with a
condvar,
the pthread_cond* calls can still cause an unbounded priority inversion
via the
internal condvar lock. The POSIX specification doesn't provide a mechanism
to
specify the protocol of the condvar. A new API,
pthread_condattr_setprotocol_np() and pthread_condattr_getprotocol_np()
allow
the user to create a PTHREAD_PRIO_INHERIT condvar. This uses a
PTHREAD_PRIO_INHERIT mutex for the internal condvar lock, eliminating the
potential for hitting an unbounded priority inversion on that lock.
The first patch in the series contains the main changes. The second and
third
patch add tests. The fourth patch is a benchmark for various combinations
of
pthread_cond_* calls. The fifth patch based on the benchmark results
removes the
assembly implementations for x86_64 pthread_cond_* functions since the C
implementation is equivalent in performance and has PI support. The sixth
patch
re-enables PI futex support for ARM kernels >= 3.14.3 which now
unconditionally
support it.
Torvald Riegel made us aware of the new POSIX changes related to condvars
(http://austingroupbugs.net/view.php?id=609) and C++11 clarification
(http://cplusplus.github.com/LWG/lwg-active.html#2190)
We believe we can work on these issues in parallel and if they end up
colliding
we will fix it.
The changes have been tested so far on dual and quad-core x86_64 machines
and
ARM dual-core Cortex A9 (Xilinx Zynq-7000). They solve the priority
inversion
problem with condvars.
Thanks,
Gratian
More information about the Libc-alpha
mailing list