mirror of
https://github.com/verilator/verilator.git
synced 2026-09-07 01:52:17 +02:00
PR #7902 uncovered a pre-existing bug in multi-threaded scheduling, where we can end up with an un-ordered R-W hazard in the MTask graph, resulting in non-deterministic runtime behaviour. This is extremely hard to actually trigger on a small example, so using ThreadSanitizer to flag it, which can identify the race reliably. In this patch: - Add configure and `verilator --get-supported TSAN` to check if the configured compiler supports ThreadSanitizer - Add a --tsan option to the test driver.py which builds the test with thread sanitizer (similar idea to --gdbsim). - Add a tests.enable_tsan() method to allow turning on TSan in the test Python file. - Add a suppressions file that waives TSan errors in the runtime library - Finally add `t_sched_hybrid_hazard` that demonstrates the data race triggered after #7902. This is currently expected failing, fix later. With the suppression, there are 17 vltmt tests failing due races in the generated code. (Using `driver.py --vltmt --tsan --quiet -j0`)
34 lines
1.4 KiB
Plaintext
34 lines
1.4 KiB
Plaintext
# DESCRIPTION: Verilator: ThreadSanitizer default suppressions for test_regress
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of either the GNU Lesser General Public License Version 3
|
|
# or the Perl Artistic License Version 2.0.
|
|
# SPDX-FileCopyrightText: 2026 Wilson Snyder
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
#
|
|
# This file is used via TSAN_OPTIONS by driver.py when running a test with
|
|
# ThreadSanitizer (--tsan option, or test.enable_tsan()). Suppress known
|
|
# races in the runtime library. TODO: most of these should likely be fixed.
|
|
|
|
# Racy update of the cached last-used context pointer
|
|
race:*Verilated::lastContextp*
|
|
|
|
# Model teardown may destroy mtask state while a worker thread is still
|
|
# returning from signaling completion of the final mtask
|
|
race:*VlMTaskVertex::signalUpstreamDone*
|
|
|
|
# The parallel trace buffer handoff between worker threads and the commit
|
|
# on the dumping thread is not visible to ThreadSanitizer; this includes
|
|
# the trace worker unlocking a mutex locked by the dumping thread
|
|
race:*VerilatedTrace*
|
|
race:*VerilatedVcd*
|
|
mutex:*VerilatedTrace*
|
|
|
|
# vl_stop (e.g. on assertion failure) tears the model down via exit
|
|
# handlers while worker threads may still be executing the current eval
|
|
race:*vl_stop*
|
|
|
|
# The --debug-runtime-timeout alarm handler prints via the runtime, which
|
|
# allocates; not async-signal-safe. Note 'signal:' matches the handler name.
|
|
signal:*alarmHandler*
|