[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 13/19] accel/tcg: Fixed tsan warnings.
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 13/19] accel/tcg: Fixed tsan warnings. |
Date: |
Tue, 26 May 2020 20:47:46 +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:
> For example:
> WARNING: ThreadSanitizer: data race (pid=35425)
> Write of size 4 at 0x7bbc000000ac by main thread (mutexes: write M875):
> #0 cpu_reset_interrupt hw/core/cpu.c:107:28 (qemu-system-aarch64+0x843790)
> #1 arm_cpu_set_irq target/arm/cpu.c (qemu-system-aarch64+0x616265)
> #2 qemu_set_irq hw/core/irq.c:44:5 (qemu-system-aarch64+0x8462ca)
> Previous atomic read of size 4 at 0x7bbc000000ac by thread T6:
> #0 __tsan_atomic32_load <null> (qemu-system-aarch64+0x394c1c)
> #1 cpu_handle_interrupt accel/tcg/cpu-exec.c:534:9
> (qemu-system-aarch64+0x4b7e79)
> #2 cpu_exec accel/tcg/cpu-exec.c:720:17 (qemu-system-aarch64+0x4b7e79)
> or
> WARNING: ThreadSanitizer: data race (pid=25425)
> Read of size 8 at 0x7f8ad8e138d0 by thread T10:
> #0 tb_lookup_cmp accel/tcg/cpu-exec.c:307:13
> (qemu-system-aarch64+0x4ac4d2)
> #1 qht_do_lookup util/qht.c:502:34 (qemu-system-aarch64+0xd05264)
> Previous write of size 8 at 0x7f8ad8e138d0 by thread T15 (mutexes: write
> M728311726235541804):
> #0 tb_link_page accel/tcg/translate-all.c:1625:26
> (qemu-system-aarch64+0x4b0bf2)
> #1 tb_gen_code accel/tcg/translate-all.c:1865:19
> (qemu-system-aarch64+0x4b0bf2)
> #2 tb_find accel/tcg/cpu-exec.c:407:14 (qemu-system-aarch64+0x4ad77c)
>
> Cc: Richard Henderson <address@hidden>
> Cc: Paolo Bonzini <address@hidden>
> Signed-off-by: Robert Foley <address@hidden>
> ---
> accel/tcg/tcg-all.c | 4 ++--
> accel/tcg/tcg-runtime.c | 7 ++++++-
> accel/tcg/translate-all.c | 6 +++++-
> hw/core/cpu.c | 2 +-
> 4 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index 3b4fda5640..f94ea4c4b3 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -54,8 +54,8 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask)
> int old_mask;
> g_assert(qemu_mutex_iothread_locked());
>
> - old_mask = cpu->interrupt_request;
> - cpu->interrupt_request |= mask;
> + old_mask = atomic_read(&cpu->interrupt_request);
> + atomic_or(&cpu->interrupt_request, mask);
You can use atomic_fetch_or here.
Paolo
- Re: [PATCH 11/19] accel/tcg: Fixed tsan warnings related to parallel_cpus, (continued)
- [PATCH 10/19] include/qemu: Added tsan.h for annotations., Robert Foley, 2020/05/22
- [PATCH 12/19] configure: added tsan support for blacklist., Robert Foley, 2020/05/22
- [PATCH 13/19] accel/tcg: Fixed tsan warnings., Robert Foley, 2020/05/22
- [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