From: Rich P. <pro...@gm...> - 2015-08-10 16:51:06
|
Hello, Suppose that I have a shared variable that is always updates when a mutex is held and is sometimes read without holding the mutex. The read race is fine for my application. However, I want to use helgrind to check for other races. If I disable/enable checking around the lock free read, then I get spurious write race helgrind reports WRT the locked writes. So, disable/enable checking is not going to work. I can add a helgrind suppression for the unlocked read race. However, there are write races reported for all the places that the variable is written. I could just disable checking for this variable when the variable is created. However, that will lose ALL helgrind checking of the variable. Is there a better technique? Thanks On Sun, Aug 9, 2015 at 10:29 AM, Philippe Waroquiers <phi...@sk...> wrote: > On Fri, 2015-08-07 at 10:36 -0400, Rich Prohaska wrote: >> Hello, >> >> I have observed that helgrind will report erroneous data races on a >> variable if checking on that variable is disable and enabled by a >> concurrent thread. Can someone explain what is going on? > VALGRIND_HG_ENABLE_CHECKING implementation consists in declaring > that the address range is 'new' and belongs (exclusively) to this > thread. In other words, calling VALGRIND_HG_ENABLE_CHECKING > is like if the memory was just allocated. > > So, using that definition, it is normal that helgrind reports > a race, because there is no synchronisation between the thread > that 'allocated freshly' count, and the thread that does a write > to count. > > Philippe > > |