[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 16/19] util: fixed tsan warnings in thread_pool.c
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 16/19] util: fixed tsan warnings in thread_pool.c |
Date: |
Tue, 26 May 2020 22:18:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 22/05/20 18:07, Robert Foley wrote:
> #include "trace.h"
> #include "block/thread-pool.h"
> #include "qemu/main-loop.h"
> +#include "qemu/tsan.h"
>
> static void do_spawn_thread(ThreadPool *pool);
>
> @@ -97,7 +98,9 @@ static void *worker_thread(void *opaque)
> }
>
> req = QTAILQ_FIRST(&pool->request_list);
> + TSAN_ANNOTATE_IGNORE_WRITES_BEGIN();
> QTAILQ_REMOVE(&pool->request_list, req, reqs);
> +
> req->state = THREAD_ACTIVE;
> qemu_mutex_unlock(&pool->lock);
>
> @@ -107,7 +110,7 @@ static void *worker_thread(void *opaque)
> /* Write ret before state. */
> smp_wmb();
> req->state = THREAD_DONE;
> -
> + TSAN_ANNOTATE_IGNORE_WRITES_END();
You should instead use atomic_read/set for req->state and req->ret.
Paolo
- Re: [PATCH 13/19] accel/tcg: Fixed tsan warnings., (continued)
- [PATCH 05/19] qht: call qemu_spin_destroy for head buckets, Robert Foley, 2020/05/22
- [PATCH 14/19] util/async: Fixed tsan warnings, Robert Foley, 2020/05/22
- [PATCH 15/19] qht: Fix tsan warnings., Robert Foley, 2020/05/22
- [PATCH 16/19] util: fixed tsan warnings in thread_pool.c, Robert Foley, 2020/05/22
- Re: [PATCH 16/19] util: fixed tsan warnings in thread_pool.c,
Paolo Bonzini <=
- [PATCH 17/19] util: Added tsan annotate for thread name., Robert Foley, 2020/05/22
- [PATCH 18/19] target/arm: Fix tsan warning in cpu.c, Robert Foley, 2020/05/22
[PATCH 19/19] docs: Added details on TSan to testing.rst, Robert Foley, 2020/05/22