[LLVMdev] Multi-threading and mutexes in LLVM

Kostya Serebryany kcc at google.com
Mon Jun 9 02:53:15 PDT 2014


On Mon, Jun 9, 2014 at 1:35 PM, David Chisnall <David.Chisnall at cl.cam.ac.uk>
wrote:

> On 9 Jun 2014, at 10:29, Kostya Serebryany <kcc at google.com> wrote:
>
> > On Mon, Jun 9, 2014 at 1:21 PM, David Chisnall <
> David.Chisnall at cl.cam.ac.uk> wrote:
> > On 9 Jun 2014, at 10:19, Kostya Serebryany <kcc at google.com> wrote:
> >
> > > tsan's deadlock detector (as well as helgrind and many other similar
> tools) detects lock order inversion, i.e. a situation which may potentially
> lead to a deadlock.
> >
> > Yes, that's what WITNESS does in the FreeBSD kernel.  The line after the
> one you quoted mentioned the port of this to userspace pthreads.
> >
> > Did it extend the pthread_mutex_t data structure?
>
> No, it stored in a look-aside structure.  We've found that requiring users
> to recompile all of their code, including shared libraries, for a new ABI
> is a non-starter.
>

Yea, for lpthread having a separate debug variant is hard.
But using look-aside structure for deadlock detection inside the pthread
library is no better than
having an external deadlock detector that intercepts pthread_mutex_*
(that's what tsan and others do)



>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/ce3de56d/attachment.html>


More information about the llvm-dev mailing list