aboutsummaryrefslogtreecommitdiff
path: root/qom/cpu.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2016-09-30 22:30:58 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-04 10:00:26 +0200
commitce7cf6a973f4b614162b9518954d441fa5e32fc6 (patch)
tree92689693586f5738d981c13c4096e879f51d6c87 /qom/cpu.c
parentb6b3ccfda015dcd5ab50f70c189ee5cc6c622e91 (diff)
qom/cpu: atomically clear the tb_jmp_cache
The ThreadSanitizer rightly complains that something initialised with a normal access is later updated and read atomically. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20160930213106.20186-8-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r--qom/cpu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index 484c49388d..ef905da9be 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -253,6 +253,7 @@ void cpu_reset(CPUState *cpu)
static void cpu_common_reset(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
+ int i;
if (qemu_loglevel_mask(CPU_LOG_RESET)) {
qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index);
@@ -268,7 +269,10 @@ static void cpu_common_reset(CPUState *cpu)
cpu->can_do_io = 1;
cpu->exception_index = -1;
cpu->crash_occurred = false;
- memset(cpu->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *));
+
+ for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+ atomic_set(&cpu->tb_jmp_cache[i], NULL);
+ }
}
static bool cpu_common_has_work(CPUState *cs)