diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2016-09-30 22:30:59 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-04 10:00:26 +0200 |
commit | 027d9a7d2911e993cdcbd21c7c35d1dd058f05bb (patch) | |
tree | b215197742f489c9af5dd1737ee60be313190f49 /qom/cpu.c | |
parent | ce7cf6a973f4b614162b9518954d441fa5e32fc6 (diff) | |
download | qemu-027d9a7d2911e993cdcbd21c7c35d1dd058f05bb.zip qemu-027d9a7d2911e993cdcbd21c7c35d1dd058f05bb.tar.gz qemu-027d9a7d2911e993cdcbd21c7c35d1dd058f05bb.tar.bz2 |
cpu: atomically modify cpu->exit_request
ThreadSanitizer picks up potential races although we already use
barriers to ensure things are in the correct order when processing exit
requests. For true C11 defined behaviour across threads we need to use
relaxed atomic_set/atomic_read semantics to reassure tsan.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160930213106.20186-9-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r-- | qom/cpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -120,10 +120,10 @@ void cpu_reset_interrupt(CPUState *cpu, int mask) void cpu_exit(CPUState *cpu) { - cpu->exit_request = 1; + atomic_set(&cpu->exit_request, 1); /* Ensure cpu_exec will see the exit request after TCG has exited. */ smp_wmb(); - cpu->tcg_exit_req = 1; + atomic_set(&cpu->tcg_exit_req, 1); } int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, |