This is the mail archive of the
mailing list for the glibc project.
[RFC][PATCH 0/3][BZ #11588] pi-condvars: add priority inheritance for pthread_cond_* internal lock
- From: Gratian Crisan <gratian dot crisan at ni dot com>
- To: libc-alpha at sourceware dot org
- Cc: Darren Hart <dvhart at linux dot intel dot com>, "Carlos O'Donell" <carlos at redhat dot com>, Jeff Law <law at redhat dot com>, Scot Salmon <scot dot salmon at ni dot com>, Siddhesh Poyarekar <spoyarek at redhat dot com>, Thomas Gleixner <tglx at linutronix dot de>, Torvald Riegel <triegel at redhat dot com>, Clark Williams <williams at redhat dot com>
- Date: Thu, 17 Oct 2013 16:33:50 -0500
- Subject: [RFC][PATCH 0/3][BZ #11588] pi-condvars: add priority inheritance for pthread_cond_* internal lock
- Authentication-results: sourceware.org; auth=none
The following three patches are an updated version of the patch series
Darren Hart posted
back in 2010. The first patch in the series contains the main changes. The
rest add tests.
The basic problem they're addressing is the fact that the pthread_cond*
can cause an unbounded priority inversion.
When using a PTHREAD_PRIO_INHERIT mutex with a condvar, the pthread_cond*
can still cause an unbounded priority inversion via the internal condvar
The POSIX specification doesn't provide a mechanism to specify the
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
internal condvar lock, eliminating the potential for hitting an unbounded
priority inversion on that lock.
Torvald Riegel made us aware of the new POSIX changes related to condvars
(http://austingroupbugs.net/view.php?id=609) and C++11 clarification
We believe we can work on these issues in parallel and if they end up
colliding we will fix it.
There is one caveat: currently the patch series is missing assembly
platforms that use pthread_cond_* assembly functions (i.e. x86 variants,
As a separate task I will be working on adding a pthread_cond_*
The hope is that the benchmark would prove that the assembly version
of these functions could be replaced with the C version w/o a
performance loss (and also lower the maintenance cost).
I have run the glibc test suite and also tested these changes on an ARM
(Xilinx Zynq Platform). They solve the priority inversion problem with