aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2016-09-30 22:30:59 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-04 10:00:26 +0200
commit027d9a7d2911e993cdcbd21c7c35d1dd058f05bb (patch)
treeb215197742f489c9af5dd1737ee60be313190f49 /qom
parentce7cf6a973f4b614162b9518954d441fa5e32fc6 (diff)
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')
-rw-r--r--qom/cpu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index ef905da9be..e765bc0caf 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -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,