aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-09-10 19:27:49 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 18:47:55 +0200
commit38adcb6e4197b5277dbb5ad0036a804b30b25bc6 (patch)
tree6b890c49dcc89e9b82f7f32c312f6e88620162be /cpus.c
parent9b4e6f496601d3cd35fd8d09c9e2103999fd5c33 (diff)
cpus: access .qemu_icount with atomic64
Signed-off-by: Emilio G. Cota <cota@braap.org> Message-Id: <20180910232752.31565-10-cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cpus.c b/cpus.c
index 6e1a892f8c..fed8ec1dff 100644
--- a/cpus.c
+++ b/cpus.c
@@ -250,8 +250,8 @@ static void cpu_update_icount_locked(CPUState *cpu)
int64_t executed = cpu_get_icount_executed(cpu);
cpu->icount_budget -= executed;
- atomic_set__nocheck(&timers_state.qemu_icount,
- timers_state.qemu_icount + executed);
+ atomic_set_i64(&timers_state.qemu_icount,
+ timers_state.qemu_icount + executed);
}
/*
@@ -280,8 +280,8 @@ static int64_t cpu_get_icount_raw_locked(void)
/* Take into account what has run */
cpu_update_icount_locked(cpu);
}
- /* The read is protected by the seqlock, so __nocheck is okay. */
- return atomic_read__nocheck(&timers_state.qemu_icount);
+ /* The read is protected by the seqlock, but needs atomic64 to avoid UB */
+ return atomic_read_i64(&timers_state.qemu_icount);
}
static int64_t cpu_get_icount_locked(void)