From: Bart Van Assche Date: Tue, 13 Mar 2018 21:44:51 +0000 (-0700) Subject: Suppress uninteresting data race reports X-Git-Tag: fio-3.6~37^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=4f37732a580d7983467ea1ba11f963da4e8cf06e;ds=sidebyside Suppress uninteresting data race reports Thread checkers like Helgrind and DRD report all concurrent modifications of variables that are serialized by a recognized synchronization primitive. Suppress reports about intentionally unsynchronized accesses. Signed-off-by: Bart Van Assche --- diff --git a/diskutil.c b/diskutil.c index 1f2471be..dd8fc6a2 100644 --- a/diskutil.c +++ b/diskutil.c @@ -8,6 +8,11 @@ #include #include #include +#ifdef CONFIG_VALGRIND_DEV +#include +#else +#define DRD_IGNORE_VAR(x) do { } while (0) +#endif #include "fio.h" #include "smalloc.h" @@ -297,6 +302,7 @@ static struct disk_util *disk_util_add(struct thread_data *td, int majdev, if (!du) return NULL; + DRD_IGNORE_VAR(du->users); memset(du, 0, sizeof(*du)); INIT_FLIST_HEAD(&du->list); l = snprintf(du->path, sizeof(du->path), "%s/stat", path); diff --git a/eta.c b/eta.c index 0b795263..3126f217 100644 --- a/eta.c +++ b/eta.c @@ -4,6 +4,11 @@ #include #include #include +#ifdef CONFIG_VALGRIND_DEV +#include +#else +#define DRD_IGNORE_VAR(x) do { } while (0) +#endif #include "fio.h" #include "lib/pow2.h" @@ -668,6 +673,7 @@ void print_thread_status(void) void print_status_init(int thr_number) { + DRD_IGNORE_VAR(__run_str); __run_str[thr_number] = 'P'; update_condensed_str(__run_str, run_str); } diff --git a/helper_thread.c b/helper_thread.c index c890da4a..f0c717f5 100644 --- a/helper_thread.c +++ b/helper_thread.c @@ -1,3 +1,9 @@ +#ifdef CONFIG_VALGRIND_DEV +#include +#else +#define DRD_IGNORE_VAR(x) do { } while (0) +#endif + #include "fio.h" #include "smalloc.h" #include "helper_thread.h" @@ -170,6 +176,8 @@ int helper_thread_create(struct fio_sem *startup_sem, struct sk_out *sk_out) hd->startup_sem = startup_sem; + DRD_IGNORE_VAR(helper_data); + ret = pthread_create(&hd->thread, NULL, helper_thread_main, hd); if (ret) { log_err("Can't create helper thread: %s\n", strerror(ret)); diff --git a/init.c b/init.c index 53aba188..e47e5384 100644 --- a/init.c +++ b/init.c @@ -12,6 +12,11 @@ #include #include #include +#ifdef CONFIG_VALGRIND_DEV +#include +#else +#define DRD_IGNORE_VAR(x) do { } while (0) +#endif #include "fio.h" #ifndef FIO_NO_HAVE_SHM_H @@ -333,6 +338,8 @@ static void free_shm(void) */ static int setup_thread_area(void) { + int i; + if (threads) return 0; @@ -376,6 +383,8 @@ static int setup_thread_area(void) #endif memset(threads, 0, max_jobs * sizeof(struct thread_data)); + for (i = 0; i < max_jobs; i++) + DRD_IGNORE_VAR(threads[i]); fio_debug_jobp = (unsigned int *)(threads + max_jobs); *fio_debug_jobp = -1; fio_warned = fio_debug_jobp + 1;