[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 27/41] Use QEMU_SANITIZE_THREAD
From: |
marcandre . lureau |
Subject: |
[PATCH 27/41] Use QEMU_SANITIZE_THREAD |
Date: |
Wed, 20 Apr 2022 17:26:10 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/qemu/atomic.h | 8 +++++---
subprojects/libvhost-user/include/compiler.h | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
create mode 120000 subprojects/libvhost-user/include/compiler.h
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 112a29910bea..7e8fc8e7cde2 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -15,6 +15,8 @@
#ifndef QEMU_ATOMIC_H
#define QEMU_ATOMIC_H
+#include "compiler.h"
+
/* Compiler barrier */
#define barrier() ({ asm volatile("" ::: "memory"); (void)0; })
@@ -81,7 +83,7 @@
* no processors except Alpha need a barrier here. Leave it in if
* using Thread Sanitizer to avoid warnings, otherwise optimize it away.
*/
-#if defined(__SANITIZE_THREAD__)
+#ifdef QEMU_SANITIZE_THREAD
#define smp_read_barrier_depends() ({ barrier();
__atomic_thread_fence(__ATOMIC_CONSUME); })
#elif defined(__alpha__)
#define smp_read_barrier_depends() asm volatile("mb":::"memory")
@@ -146,7 +148,7 @@
/* See above: most compilers currently treat consume and acquire the
* same, but this slows down qatomic_rcu_read unnecessarily.
*/
-#ifdef __SANITIZE_THREAD__
+#ifdef QEMU_SANITIZE_THREAD
#define qatomic_rcu_read__nocheck(ptr, valptr) \
__atomic_load(ptr, valptr, __ATOMIC_CONSUME);
#else
@@ -254,7 +256,7 @@
#define qatomic_mb_read(ptr) \
qatomic_load_acquire(ptr)
-#if !defined(__SANITIZE_THREAD__) && \
+#if !defined(QEMU_SANITIZE_THREAD) && \
(defined(__i386__) || defined(__x86_64__) || defined(__s390x__))
/* This is more efficient than a store plus a fence. */
# define qatomic_mb_set(ptr, i) ((void)qatomic_xchg(ptr, i))
diff --git a/subprojects/libvhost-user/include/compiler.h
b/subprojects/libvhost-user/include/compiler.h
new file mode 120000
index 000000000000..de7b70697cd2
--- /dev/null
+++ b/subprojects/libvhost-user/include/compiler.h
@@ -0,0 +1 @@
+../../../include/qemu/compiler.h
\ No newline at end of file
--
2.35.1.693.g805e0a68082a
- [PATCH 23/41] include: add qemu/keyval.h, (continued)
- [PATCH 23/41] include: add qemu/keyval.h, marcandre . lureau, 2022/04/20
- [PATCH 21/41] include: move qemu_fdatasync() to osdep, marcandre . lureau, 2022/04/20
- [PATCH 25/41] tests: remove block/qdict checks from check-qobject.c, marcandre . lureau, 2022/04/20
- [PATCH 24/41] include: move qdict_{crumple,flatten} declarations, marcandre . lureau, 2022/04/20
- [PATCH 26/41] compiler.h: add QEMU_SANITIZE_{ADDRESS,THREAD}, marcandre . lureau, 2022/04/20
- [PATCH 27/41] Use QEMU_SANITIZE_THREAD,
marcandre . lureau <=
- [PATCH 28/41] Use QEMU_SANITIZE_ADDRESS, marcandre . lureau, 2022/04/20
- [PATCH 29/41] tests: run-time skip test-qga if TSAN is enabled, marcandre . lureau, 2022/04/20
- [PATCH 30/41] Move error_printf_unless_qmp() with monitor unit, marcandre . lureau, 2022/04/20
- [PATCH 31/41] qga: move qga_get_host_name(), marcandre . lureau, 2022/04/20