[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 09/12] cpus: access .qemu_icount with atomic64
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 09/12] cpus: access .qemu_icount with atomic64 |
Date: |
Mon, 10 Sep 2018 19:27:49 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
cpus.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cpus.c b/cpus.c
index 38dabb138d..f045416c94 100644
--- a/cpus.c
+++ b/cpus.c
@@ -252,8 +252,8 @@ void cpu_update_icount(CPUState *cpu)
seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
- atomic_set__nocheck(&timers_state.qemu_icount,
- timers_state.qemu_icount + executed);
+ atomic_set_i64(&timers_state.qemu_icount,
+ timers_state.qemu_icount + executed);
seqlock_write_unlock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
}
@@ -270,8 +270,8 @@ static int64_t cpu_get_icount_raw_locked(void)
/* Take into account what has run */
cpu_update_icount(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)
--
2.17.1
- [Qemu-devel] [PATCH v2 00/12] i386 + x86_64 mttcg, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 09/12] cpus: access .qemu_icount with atomic64,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v2 11/12] target/i386/translate: use thread-local storage in !user-mode, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 10/12] cpus: access .qemu_icount_bias with atomic64, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 12/12] configure: enable mttcg for i386 and x86_64, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 01/12] cacheinfo: add i/d cache_linesize_log, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 02/12] util: add atomic64, Emilio G. Cota, 2018/09/10