<div dir="ltr">Thanks Kostya and Dmiitry, that was helpful. <br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">  - Vaivaswatha<br></div></div></div>
<br><div class="gmail_quote">On Tue, Sep 8, 2015 at 10:49 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Sep 8, 2015 at 12:15 AM, Dmitry Vyukov via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+thread-sanitizer mailing list<br>
<span><br>
On Mon, Sep 7, 2015 at 6:41 PM, Vaivaswatha Nagaraj <<a href="mailto:vn@compilertree.com" target="_blank">vn@compilertree.com</a>> wrote:<br>
> Hi,<br>
><br>
> I am interested in understand the compiler-rt thread sanitizer tool and have<br>
> recently started experimenting with it. In particular, I'm interested in the<br>
> deadlock detector.<br>
><br>
> I see that deadlock detection currently don't work. (I tried with a few<br>
> simple deadlocks, as well as the test case "must_deadlock.cc" that is in the<br>
> test-suite). I understand from the comments that this is because the real<br>
> pthread_mutex_lock() is called before the handler (MutexLock()) in tsan.<br>
><br>
> 1. Is there any particular reason that this interceptor is designed this<br>
> way? Can there be a callback prior to calling the real pthread_mutex_lock()<br>
> that can, for example, detect deadlocks?<br>
> 2. Upon debugging a simple test case, I see that there is a worker thread<br>
> that is created. Can this worker not check for the deadlock when the actual<br>
> threads are deadlocked.<br>
<br>
</span>Hello Vaivaswatha,<br>
<br>
Yes, tsan currently detects only _potential_ deadlocks. On actual<br>
deadlocks it deadlocks as well.<br>
This is just not implemented yet. </blockquote><div><br></div></span><div>Correct, I just did not have time to implement this. </div><div>In practice this is not the most important thing to have because </div><div>if the deadlock has actually happened in a test it is easy to find. </div><div>The potential deadlocks are more important. </div><div>Yet I fully agree this needs to be implemented. </div><div><br></div><div>--kcc </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Yes, mutex callback needs to be<br>
split into pre and post parts. The deadlock detector already has<br>
separate callbacks for these events, it is just a matter of threading<br>
these callbacks through tsan code.<br>
You can look at the standalone deadlock detector in<br>
lib/tsan/dd/dd_interceptors.cc, it does it correctly.<br>
<br>
--<br>
Dmitry Vyukov, Software Engineer, <a href="mailto:dvyukov@google.com" target="_blank">dvyukov@google.com</a><br>
Google Germany GmbH, Dienerstraße 12, 80331, München<br>
Geschäftsführer: Graham Law, Christine Elizabeth Flores<br>
Registergericht und -nummer: Hamburg, HRB 86891<br>
Sitz der Gesellschaft: Hamburg<br>
Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat<br>
sind, leiten Sie diese bitte nicht weiter, informieren Sie den<br>
Absender und löschen Sie die E-Mail und alle Anhänge. Vielen Dank.<br>
This e-mail is confidential. If you are not the right addressee please<br>
do not forward it, please inform the sender, and please erase this<br>
e-mail including any attachments. Thanks.<br></span>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></div>