This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

[RFC][PATCH 0/3][BZ #11588] pi-condvars: add priority inheritance for pthread_cond_* internal lock


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* 
calls
can cause an unbounded priority inversion.

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. 

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.

There is one caveat: currently the patch series is missing assembly 
implementations for
platforms that use pthread_cond_* assembly functions (i.e. x86 variants, 
sh, hppa).
As a separate task I will be working on adding a pthread_cond_*
microbenchmark.
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 
Cortex A9
(Xilinx Zynq Platform). They solve the priority inversion problem with 
condvars.

Thanks,
Gratian


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