Hi there,
I am looking at the test-lock failure reported by (1) while findutils building 
in opensuse for ppc64le architecture.
Helgrind is reporting data race for the three *_checker_done volatiles as 
summarized in (2)

Is is a false positive or a real problem ?

(1) https://bugzilla.suse.com/show_bug.cgi?id=923486
(2) extract of helgrind output (full log in attachment)
===
$valgrind --tool=helgrind ./test-lock
...
==1408== ----------------------------------------------------------------
==1408==
==1408== Possible data race during write of size 4 at 0x102BED4C by thread #1
==1408== Locks held: none
==1408==    at 0x10001078: test_rwlock (test-lock.c:300)
==1408==    by 0x10001078: main (test-lock.c:577)
==1408==
==1408== This conflicts with a previous read of size 4 by thread #17
==1408== Locks held: none
==1408==    at 0x10002118: rwlock_checker_thread (test-lock.c:264)
==1408==    by 0x406C3A3: ??? (in 
/usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408==  Address 0x102bed4c is 0 bytes inside data symbol "rwlock_checker_done"
==1408==
==1408== ----------------------------------------------------------------
===
=== related source code:
===
findutils-4.5.14/tests/test-lock.c:215: lock_checker_done = 1;
findutils-4.5.14/tests/test-lock.c:180: while (!lock_checker_done)
===
findutils-4.5.14/tests/test-lock.c:264: while (!rwlock_checker_done)
findutils-4.5.14/tests/test-lock.c:300: rwlock_checker_done = 1;
===
findutils-4.5.14/tests/test-lock.c:366: while (!reclock_checker_done)
findutils-4.5.14/tests/test-lock.c:401: reclock_checker_done = 1;
===
--
Michel Normand
@vm64:/home/michel[michel@vm64:~]
$/cd 
$cd /mnt/disk3/build-root/standard-ppc64le/home/abuild/rpmbuild/BUILD/findutils-4.5.14/tests/
$
[michel@vm64:/mnt/disk3/build-root/standard-ppc64le/home/abuild/rpmbuild/BUILD/findutils-4.5.14/tests
]
$valgrind --tool=helgrind ./test-lock
==1408== Helgrind, a thread error detector
==1408== Copyright (C) 2007-2013, and GNU GPL'd, by OpenWorks LLP et al.
==1408== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==1408== Command: ./test-lock
==1408== 
Starting test_lock ...==1408== ---Thread-Announcement------------------------------------------
==1408== 
==1408== Thread #1 is the program's root thread
==1408== 
==1408== ---Thread-Announcement------------------------------------------
==1408== 
==1408== Thread #2 was created
==1408==    at 0x41FE058: clone (clone.S:77)
==1408==    by 0x40B7807: create_thread (createthread.c:102)
==1408==    by 0x406C1DB: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x10000EB7: gl_thread_create (thread.h:383)
==1408==    by 0x10000EB7: test_lock (test-lock.c:208)
==1408==    by 0x10000EB7: main (test-lock.c:572)
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during write of size 4 at 0x10013208 by thread #1
==1408== Locks held: none
==1408==    at 0x10000F40: test_lock (test-lock.c:215)
==1408==    by 0x10000F40: main (test-lock.c:572)
==1408== 
==1408== This conflicts with a previous read of size 4 by thread #2
==1408== Locks held: none
==1408==    at 0x10001C78: lock_checker_thread (test-lock.c:180)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408==  Address 0x10013208 is 0 bytes inside data symbol "lock_checker_done"
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during read of size 4 at 0x10013208 by thread #2
==1408== Locks held: none
==1408==    at 0x10001C78: lock_checker_thread (test-lock.c:180)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408== 
==1408== This conflicts with a previous write of size 4 by thread #1
==1408== Locks held: none
==1408==    at 0x10000F40: test_lock (test-lock.c:215)
==1408==    by 0x10000F40: main (test-lock.c:572)
==1408==  Address 0x10013208 is 0 bytes inside data symbol "lock_checker_done"
==1408== 
 OK
Starting test_rwlock ...==1408== ---Thread-Announcement------------------------------------------
==1408== 
==1408== Thread #17 was created
==1408==    at 0x41FE058: clone (clone.S:77)
==1408==    by 0x40B7807: create_thread (createthread.c:102)
==1408==    by 0x406C1DB: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x10000FF7: gl_thread_create (thread.h:383)
==1408==    by 0x10000FF7: test_rwlock (test-lock.c:293)
==1408==    by 0x10000FF7: main (test-lock.c:577)
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during write of size 4 at 0x102BED4C by thread #1
==1408== Locks held: none
==1408==    at 0x10001078: test_rwlock (test-lock.c:300)
==1408==    by 0x10001078: main (test-lock.c:577)
==1408== 
==1408== This conflicts with a previous read of size 4 by thread #17
==1408== Locks held: none
==1408==    at 0x10002118: rwlock_checker_thread (test-lock.c:264)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408==  Address 0x102bed4c is 0 bytes inside data symbol "rwlock_checker_done"
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during read of size 4 at 0x102BED4C by thread #17
==1408== Locks held: none
==1408==    at 0x10002118: rwlock_checker_thread (test-lock.c:264)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408== 
==1408== This conflicts with a previous write of size 4 by thread #1
==1408== Locks held: none
==1408==    at 0x10001078: test_rwlock (test-lock.c:300)
==1408==    by 0x10001078: main (test-lock.c:577)
==1408==  Address 0x102bed4c is 0 bytes inside data symbol "rwlock_checker_done"
==1408== 
 OK
Starting test_recursive_lock ...==1408== ---Thread-Announcement------------------------------------------
==1408== 
==1408== Thread #33 was created
==1408==    at 0x41FE058: clone (clone.S:77)
==1408==    by 0x40B7807: create_thread (createthread.c:102)
==1408==    by 0x406C1DB: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x1000111B: gl_thread_create (thread.h:383)
==1408==    by 0x1000111B: test_recursive_lock (test-lock.c:394)
==1408==    by 0x1000111B: main (test-lock.c:582)
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during write of size 4 at 0x1001320C by thread #1
==1408== Locks held: none
==1408==    at 0x100011A0: test_recursive_lock (test-lock.c:401)
==1408==    by 0x100011A0: main (test-lock.c:582)
==1408== 
==1408== This conflicts with a previous read of size 4 by thread #33
==1408== Locks held: none
==1408==    at 0x10001E5C: reclock_checker_thread (test-lock.c:366)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408==  Address 0x1001320c is 0 bytes inside data symbol "reclock_checker_done"
==1408== 
==1408== ----------------------------------------------------------------
==1408== 
==1408== Possible data race during read of size 4 at 0x1001320C by thread #33
==1408== Locks held: none
==1408==    at 0x10001E5C: reclock_checker_thread (test-lock.c:366)
==1408==    by 0x406C3A3: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-ppc64le-linux.so)
==1408==    by 0x40B9453: start_thread (pthread_create.c:335)
==1408==    by 0x41FE0C3: clone (clone.S:96)
==1408== 
==1408== This conflicts with a previous write of size 4 by thread #1
==1408== Locks held: none
==1408==    at 0x100011A0: test_recursive_lock (test-lock.c:401)
==1408==    by 0x100011A0: main (test-lock.c:582)
==1408==  Address 0x1001320c is 0 bytes inside data symbol "reclock_checker_done"
==1408== 
 OK
Starting test_once ...Killed
=== 
=== related source code:
===
findutils-4.5.14/tests/test-lock.c:215: lock_checker_done = 1;
findutils-4.5.14/tests/test-lock.c:180: while (!lock_checker_done)
===
findutils-4.5.14/tests/test-lock.c:264: while (!rwlock_checker_done)
findutils-4.5.14/tests/test-lock.c:300: rwlock_checker_done = 1;
===
findutils-4.5.14/tests/test-lock.c:366: while (!reclock_checker_done)
findutils-4.5.14/tests/test-lock.c:401: reclock_checker_done = 1;
===
=== 
=== 

Reply via email to