[lttng-dev] TSAN and the tests

Ondřej Surý ondrej at sury.org
Tue Mar 21 10:59:37 EDT 2023


> On 21. 3. 2023, at 15:49, Mathieu Desnoyers <mathieu.desnoyers at efficios.com> wrote:
> 
> Agreed, let's see how it holds up to testing under TSAN. :)

The make check is OK, but any of the make regtest, short_bench or long_bench produces
lot of TSAN warnings like these below.

Looks like they mostly come from the tests itself and I will start chopping them off when I
have little time if nobody beats me to it meanwhile.

Meanwhile I've isolated the use of cds_lfht for a small hashtable with bad "names" used
as SERVFAIL cache which doesn't use reference counting nor LRU, and there was
yet-another custom hashtable in BIND 9, so it was perfect for testing.  I'll report what
TSAN likes or doesn't like in the real world app soon(ish).

Ondrej


==================
WARNING: ThreadSanitizer: data race (pid=1110834)
  Write of size 4 at 0x5612e63ef380 by main thread:
    #0 perftestrun /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:217:9 (rcutorture_urcu_bp+0xd6278) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:255:9 (rcutorture_urcu_bp+0xd55f5) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Previous read of size 4 at 0x5612e63ef380 by thread T24:
    #0 rcu_read_perf_test /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:148:9 (rcutorture_urcu_bp+0xd5f61) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Location is global 'goflag' of size 4 at 0x5612e63ef380 (rcutorture_urcu_bp+0x147f380)

  Thread T24 (tid=1110872, running) created by main thread at:
    #0 pthread_create <null> (rcutorture_urcu_bp+0x4e5bb) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:188:6 (rcutorture_urcu_bp+0xd5e6c) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:251:3 (rcutorture_urcu_bp+0xd55b7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:217:9 in perftestrun
==================
==================
WARNING: ThreadSanitizer: data race (pid=1110834)
  Read of size 8 at 0x5612e63ef408 by thread T3:
    #0 __smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 (rcutorture_urcu_bp+0xd69d8) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:167:10 (rcutorture_urcu_bp+0xd67be) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 rcu_read_perf_test /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:161:2 (rcutorture_urcu_bp+0xd6007) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Previous write of size 8 at 0x5612e63ef408 by main thread:
    #0 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:192:21 (rcutorture_urcu_bp+0xd5eb7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:251:3 (rcutorture_urcu_bp+0xd55b7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Location is global '__thread_id_map' of size 32768 at 0x5612e63ef3f0 (rcutorture_urcu_bp+0x147f408)

  Thread T3 (tid=1110851, running) created by main thread at:
    #0 pthread_create <null> (rcutorture_urcu_bp+0x4e5bb) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:188:6 (rcutorture_urcu_bp+0xd5e6c) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:251:3 (rcutorture_urcu_bp+0xd55b7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 in __smp_thread_id
==================
==================
WARNING: ThreadSanitizer: data race (pid=1110834)
  Write of size 8 at 0x5612e63ef3f8 by main thread:
    #0 wait_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:214:21 (rcutorture_urcu_bp+0xd6cc6) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 wait_all_threads /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:227:10 (rcutorture_urcu_bp+0xd6ba1) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftestrun /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:223:2 (rcutorture_urcu_bp+0xd62c9) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:255:9 (rcutorture_urcu_bp+0xd55f5) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #4 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Previous read of size 8 at 0x5612e63ef3f8 by thread T11:
    #0 __smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 (rcutorture_urcu_bp+0xd69d8) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:167:10 (rcutorture_urcu_bp+0xd67be) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 rcu_read_perf_test /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:161:2 (rcutorture_urcu_bp+0xd6007) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  As if synchronized via sleep:
    #0 sleep <null> (rcutorture_urcu_bp+0x4b206) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 perftestrun /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:219:2 (rcutorture_urcu_bp+0xd6297) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:255:9 (rcutorture_urcu_bp+0xd55f5) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Location is global '__thread_id_map' of size 32768 at 0x5612e63ef3f0 (rcutorture_urcu_bp+0x147f3f8)

  Thread T11 (tid=1110859, finished) created by main thread at:
    #0 pthread_create <null> (rcutorture_urcu_bp+0x4e5bb) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:188:6 (rcutorture_urcu_bp+0xd5e6c) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:251:3 (rcutorture_urcu_bp+0xd55b7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:214:21 in wait_thread
==================
==================
WARNING: ThreadSanitizer: data race (pid=1110834)
  Read of size 8 at 0x5612e63ef4f8 by thread T33:
    #0 __smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 (rcutorture_urcu_bp+0xd69d8) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:167:10 (rcutorture_urcu_bp+0xd67be) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 rcu_update_perf_test /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:189:2 (rcutorture_urcu_bp+0xd6173) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Previous write of size 8 at 0x5612e63ef4f8 by main thread:
    #0 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:192:21 (rcutorture_urcu_bp+0xd5eb7) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:254:2 (rcutorture_urcu_bp+0xd55e2) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Location is global '__thread_id_map' of size 32768 at 0x5612e63ef3f0 (rcutorture_urcu_bp+0x147f4f8)

  Thread T33 (tid=1110881, running) created by main thread at:
    #0 pthread_create <null> (rcutorture_urcu_bp+0x4e5bb) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:188:6 (rcutorture_urcu_bp+0xd5e6c) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:254:2 (rcutorture_urcu_bp+0xd55e2) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 in __smp_thread_id
==================
==================
WARNING: ThreadSanitizer: data race (pid=1110834)
  Write of size 8 at 0x5612e63ef458 by main thread:
    #0 wait_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:214:21 (rcutorture_urcu_bp+0xd6cc6) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 wait_all_threads /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:227:10 (rcutorture_urcu_bp+0xd6ba1) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftestrun /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:223:2 (rcutorture_urcu_bp+0xd62c9) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:255:9 (rcutorture_urcu_bp+0xd55f5) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #4 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Previous read of size 8 at 0x5612e63ef458 by thread T33:
    #0 __smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:138:7 (rcutorture_urcu_bp+0xd69d8) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 smp_thread_id /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:167:10 (rcutorture_urcu_bp+0xd67be) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 rcu_update_perf_test /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:189:2 (rcutorture_urcu_bp+0xd6173) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

  Location is global '__thread_id_map' of size 32768 at 0x5612e63ef3f0 (rcutorture_urcu_bp+0x147f458)

  Thread T33 (tid=1110881, finished) created by main thread at:
    #0 pthread_create <null> (rcutorture_urcu_bp+0x4e5bb) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #1 create_thread /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:188:6 (rcutorture_urcu_bp+0xd5e6c) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #2 perftest /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:254:2 (rcutorture_urcu_bp+0xd55e2) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)
    #3 main /home/ondrej/Projects/userspace-rcu/tests/regression/./rcutorture.h:646:4 (rcutorture_urcu_bp+0xd512d) (BuildId: 7d612c532f25f675ca5eca76f2a54e3bca37fd4b)

SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/userspace-rcu/tests/regression/../../tests/common/api.h:214:21 in wait_thread
==================
ThreadSanitizer: reported 5 warnings

Ondrej
--
Ondřej Surý (He/Him)
ondrej at sury.org



More information about the lttng-dev mailing list