On Mon, Mar 30, 2015 at 10:17:06AM +0200, Paolo Bonzini wrote: > > > On 19/03/2015 10:33, Dr. David Alan Gilbert wrote: > >> > But still pointless. Atomicity isn't magic pixie dust; it only makes > >> > sense if you're making atomic specific operations that need to be. > >> > Simple integer loads and stores are already atomic. Unless at least > >> > some of the atomic operations are something more complex, there's > >> > really no point to atomically marked operations. > > OK, I'll kill it off. > > No, don't. > > And both of you, read docs/atomics.txt. *reads* > "atomic_read() and atomic_set() prevents the compiler from using > optimizations that might otherwise optimize accesses out of existence > on the one hand, or that might create unsolicited accesses on the other. > [...] it tells readers which variables are shared with > other threads, and which are local to the current thread or protected > by other, more mundane means." > > atomic_read() and atomic_set() provide the same guarantees as > ACCESS_ONCE in the Linux kernel. Ok, having better understood the semantics and intentions of the atomic_* functions in qemu, I withdraw my objection. They do seem like the right primitives for this situation. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson