]> git.proxmox.com Git - mirror_qemu.git/commit
cpus: protect all icount computation with seqlock
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Aug 2018 07:31:58 +0000 (09:31 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Aug 2018 16:46:25 +0000 (18:46 +0200)
commitc1ff073cd88eddce5a0870791431878b96d08157
treeffe953a1e92d208a9151bdf3c67cee4ea10a9a45
parent900610e631c0371070aad4d9482fd42915166948
cpus: protect all icount computation with seqlock

Move the icount->ns computation to cpu_get_icount, and make
cpu_get_icount_locked return the raw value.  This makes the
atomic_read__nocheck safe, because it now happens always inside a
seqlock and any torn reads will be retried.  qemu_icount_bias and
icount_time_shift also need to be accessed with atomics.  At the
same time, however, you don't need atomic_read within the writer,
because no concurrent writes are possible.

The fix to vmstate lets us keep the struct nicely packed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cpus.c