]> Git Repo - qemu.git/commitdiff
cpus: access .qemu_icount with atomic64
authorEmilio G. Cota <[email protected]>
Mon, 10 Sep 2018 23:27:49 +0000 (19:27 -0400)
committerPaolo Bonzini <[email protected]>
Tue, 2 Oct 2018 16:47:55 +0000 (18:47 +0200)
Signed-off-by: Emilio G. Cota <[email protected]>
Message-Id: <20180910232752[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
cpus.c

diff --git a/cpus.c b/cpus.c
index 6e1a892f8ce1ef8cdeb017eea431c05e19c13e6c..fed8ec1dff1375508861f33d18b553bc516bf5f3 100644 (file)
--- 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)
This page took 0.029456 seconds and 4 git commands to generate.