]> git.proxmox.com Git - mirror_qemu.git/commit
timer: protect timers_state's clock with seqlock
authorLiu Ping Fan <qemulist@gmail.com>
Wed, 25 Sep 2013 06:20:58 +0000 (14:20 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Oct 2013 15:30:52 +0000 (17:30 +0200)
commitcb365646a942ed58aae053064b2048a415337ba2
tree1c032ed0e7f61274484dcd13b7d73684649d3331
parentea753d81e8b085d679f13e4a6023e003e9854d51
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>
cpus.c
include/qemu/timer.h