summaryrefslogtreecommitdiff
path: root/include/qemu
diff options
context:
space:
mode:
authorLiu Ping Fan <qemulist@gmail.com>2013-09-25 14:20:58 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2013-10-17 17:30:52 +0200
commitcb365646a942ed58aae053064b2048a415337ba2 (patch)
tree1c032ed0e7f61274484dcd13b7d73684649d3331 /include/qemu
parentea753d81e8b085d679f13e4a6023e003e9854d51 (diff)
downloadqemu-cb365646a942ed58aae053064b2048a415337ba2.tar.gz
timer: protect timers_state's clock with seqlock
QEMU_CLOCK_VIRTUAL may be read outside BQL. This will make its foundation, i.e. cpu_clock_offset exposed to race condition. Using private lock to protect it. After this patch, reading QEMU_CLOCK_VIRTUAL is thread safe unless use_icount is true, in which case the existing callers still rely on the BQL. Lock rule: private lock innermost, ie BQL->"this lock" Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/timer.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index b58903bef5..016e29ae95 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -653,7 +653,9 @@ static inline int64_t qemu_soonest_timeout(int64_t timeout1, int64_t timeout2)
void init_clocks(void);
int64_t cpu_get_ticks(void);
+/* Caller must hold BQL */
void cpu_enable_ticks(void);
+/* Caller must hold BQL */
void cpu_disable_ticks(void);
static inline int64_t get_ticks_per_sec(void)