Re: [Qemu-devel] [PATCH 1/4] cpus: protect all icount computation with seqlock

2018-08-31 Thread Emilio G. Cota
On Mon, Aug 20, 2018 at 17:09:00 +0200, Paolo Bonzini wrote: > Using the seqlock makes the atomic_read__nocheck safe, because it now > happens always inside a seqlock and any torn reads will be retried. Using a seqlock makes regular accesses safe as well, for the same reason. It's undefined behavi

[Qemu-devel] [PATCH 1/4] cpus: protect all icount computation with seqlock

2018-08-20 Thread Paolo Bonzini
Using the seqlock 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 n