Add Thread Sanitizer support to QEMU
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest19 patches 30 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/19 | configure: add --enable-tsan flag + fiber annotations for coroutine-ucontextconfigure util/ | +127 | 5 replies | |
| 2/19 | cpu: convert queued work to a QSIMPLEQcpus-common.c cpus.c hw/ +1 more | +24 | 2 replies | |
| 3/19 | thread: add qemu_spin_destroyinclude/ | +3 | 0 replies | |
| 4/19 | cputlb: destroy CPUTLB with tlb_destroyaccel/ exec.c include/ | +24 | 0 replies | |
| 5/19 | qht: call qemu_spin_destroy for head bucketsutil/ | +1 | 0 replies | |
| 6/19 | tcg: call qemu_spin_destroy for tb->jmp_lockaccel/ include/ tcg/ | +27 | 0 replies | |
| 7/19 | translate-all: call qemu_spin_destroy for PageDescaccel/ | +9 | 0 replies | |
| 8/19 | thread: add tsan annotations to QemuSpininclude/ | +36 | 0 replies | |
| 9/19 | tests/docker: Added docker build support for TSan.tests/ tests/ tests/ +1 more | +100 | 0 replies | |
| 10/19 | include/qemu: Added tsan.h for annotations.include/ | +48 | 2 replies | |
| 11/19 | accel/tcg: Fixed tsan warnings related to parallel_cpusaccel/ cpus.c include/ +1 more | +6 | 1 reply | |
| 12/19 | configure: added tsan support for blacklist.configure tests/ | +7 | 2 replies | |
| 13/19 | accel/tcg: Fixed tsan warnings.accel/ accel/ accel/ +1 more | +14 | 3 replies | |
| 14/19 | util/async: Fixed tsan warningsutil/ | +9 | 4 replies | |
| 15/19 | qht: Fix tsan warnings.util/ | +3 | 1 reply | |
| 16/19 | util: fixed tsan warnings in thread_pool.cutil/ | +4 | 1 reply | |
| 17/19 | util: Added tsan annotate for thread name.util/ | +2 | 1 reply | |
| 18/19 | target/arm: Fix tsan warning in cpu.ctarget/ | +1 | 5 replies | |
| 19/19 | docs: Added details on TSan to testing.rstdocs/ | +72 | 1 reply |
Reviews trailers per patch
5 of 19 patches have a Reviewed-by or Acked-by.
| Patch | Richard Henderson | Alex Bennée | Emilio G. Cota | Philippe Mathieu-Daudé |
|---|---|---|---|---|
| 1/19 | ||||
| 2/19 | R-b | R-b | R-b | |
| 3/19 | ||||
| 4/19 | ||||
| 5/19 | ||||
| 6/19 | ||||
| 7/19 | ||||
| 8/19 | ||||
| 9/19 | ||||
| 10/19 | R-b | |||
| 11/19 | R-b | |||
| 12/19 | ||||
| 13/19 | ||||
| 14/19 | ||||
| 15/19 | ||||
| 16/19 | ||||
| 17/19 | R-b | |||
| 18/19 | ||||
| 19/19 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH 00/19] Add Thread Sanitizer support to QEMU
This patch series continues the work done by Emilio Cota and others to add Thread Sanitizer (TSan) support to QEMU.
The starting point for this work was Emilio's branch here:
https://github.com/cota/qemu/commits/tsan
specifically this commit: 0be125fc0afd47218b34d2019abdd19b644f3199
The purpose of this patch is not to fix all the TSan warnings, but to enable the TSan support so that QEMU developers can start using the tool. We found this tool useful and even ran it on our recent changes in the cpu-locks series.
Clearly there is work to do here to clean up all the warnings. :) We have made a start to cleaning up these warnings by getting a VM to boot cleanly with no TSan warnings.
We have also made an effort to introduce enough of the TSan suppression mechanisms, so that others can continue this work.
This series adds support for:
- configure option for --enable-tsan.
- testing.rst has the full details on how to use TSan with docker and also outside of docker.
- Docker builds with TSan.
- We added an Ubuntu 20.04 docker that supports TSan builds.
- Something like this will build TSan
make docker-test-build@ubuntu2004 DEBUG=1 TSAN=1
- Testing with TSan is also supported with docker,
although, be forwarned that test-quick currently fails.
See "Issues" section below for the current failures.
make docker-test-quick@ubuntu2004 DEBUG=1 TSAN=1
- We recommend using the DEBUG=1 option and launching the test (like test-quick) from inside the docker so that when the test is done, you can review the warnings from inside the docker.
- testing.rst has the full details on how to use TSan with docker.
- We added a blacklist file for files/functions
TSan should ignore at compile time.
- And added a suppression file for TSan to suppress certain warnings at run time.
We found both of these mechanisms are needed when suppressing warnings.
- It is also worth mentioning that we were able to suppress/fix enough errors to allow an Ubuntu 18.04 aarch64 VM to boot with zero TSan warnings. When we started this effort, there were ~300 warnings reported by TSan during the same VM boot !
Issues:
- When running docker-test-quick under TSan there are several tests which hang
- The unit tests which seem to hang under TSan:
test-char, test-qdev-global-props, and test-qga.
- If we comment out those tests, check-unit finishes, albeit with a couple of warnings. :)
Emilio G. Cota (7):
cpu: convert queued work to a QSIMPLEQ
thread: add qemu_spin_destroy
cputlb: destroy CPUTLB with tlb_destroy
qht: call qemu_spin_destroy for head buckets
tcg: call qemu_spin_destroy for tb->jmp_lock
translate-all: call qemu_spin_destroy for PageDesc
thread: add tsan annotations to QemuSpin
Lingfeng Yang (1):
configure: add --enable-tsan flag + fiber annotations for
coroutine-ucontext
Robert Foley (11):
tests/docker: Added docker build support for TSan. include/qemu: Added tsan.h for annotations. accel/tcg: Fixed tsan warnings related to parallel_cpus
configure: added tsan support for blacklist. accel/tcg: Fixed tsan warnings.
util/async: Fixed tsan warnings
qht: Fix tsan warnings.
util: fixed tsan warnings in thread_pool.c
util: Added tsan annotate for thread name. target/arm: Fix tsan warning in cpu.c
docs: Added details on TSan to testing.rst
accel/tcg/cpu-exec.c | 4 +- accel/tcg/cputlb.c | 15 ++++ accel/tcg/tcg-all.c | 4 +- accel/tcg/tcg-runtime.c | 7 +- accel/tcg/translate-all.c | 25 +++++- configure | 40 +++++++++ cpus-common.c | 25 ++---- cpus.c | 16 +++- docs/devel/testing.rst | 72 ++++++++++++++++ exec.c | 1 + hw/core/cpu.c | 3 +- include/exec/exec-all.h | 10 ++- include/hw/core/cpu.h | 6 +- include/qemu/thread.h | 38 ++++++++- include/qemu/tsan.h | 48 +++++++++++ include/tcg/tcg.h | 3 +- linux-user/syscall.c | 4 +- target/arm/cpu.c | 2 +- tcg/tcg.c | 19 ++++- tests/docker/Makefile.include | 2 + tests/docker/common.rc | 19 +++++ tests/docker/dockerfiles/ubuntu2004.docker | 65 +++++++++++++++ tests/tsan/blacklist.tsan | 5 ++ tests/tsan/suppressions.tsan | 14 ++++ util/async.c | 11 ++- util/coroutine-ucontext.c | 97 ++++++++++++++++++++-- util/qemu-thread-posix.c | 2 + util/qht.c | 4 + util/thread-pool.c | 5 +- 29 files changed, 514 insertions(+), 52 deletions(-) create mode 100644 include/qemu/tsan.h create mode 100644 tests/docker/dockerfiles/ubuntu2004.docker create mode 100644 tests/tsan/blacklist.tsan create mode 100644 tests/tsan/suppressions.tsan
Signature · 1 line
2.17.1