From: Nicholas N. <n.n...@gm...> - 2009-03-30 13:45:19
|
On Mon, Mar 30, 2009 at 8:17 AM, Konstantin Serebryany <kon...@gm...> wrote: > Hi valgrind developers, > > Does valgrind core do something special about TLS (thread-local storage)? > > I've recently discovered a false positive in ThreadSanitizer which is > caused by TLS. > Helgrind also emits a race report on the same test case. > Test: > // - Thread1 starts > // - Thread1 touches per_thread_global > // - Thread1 ends > // - Thread2 starts (and there is no happens-before relation between > it and Thread1) > // - Thread2 touches per_thread_global > // It may happen so that Thread2 will have per_thread_global in the same address > // as Thread1. Since there is no happens-before relation between threads, > // ThreadSanitizer reports a race. > The runable code is in > http://code.google.com/p/data-race-test/source/browse/trunk/unittest/racecheck_unittest.cc?spec=svn939&r=939#6017 > > As I understand, the valgrind core handles stack allocation and > deallocation itself. > All that tool needs to do is to call VG_(track_new_mem_stack) and similar. > Is there anything like this for TLS? No; it's never come up before... Nick |