On 04/15/10 01:08, Paolo Bonzini wrote: > On 04/14/2010 06:52 PM, Blue Swirl wrote: >> On 4/14/10, Gerd Hoffmann wrote: >>> +static inline void atomic_or(uint32_t *var, uint32_t add) >>> +{ >>> + __asm__ __volatile__ ("lock; orl %1, %0" : "+m" (*var) : "r" (add) >>> : "memory"); >>> +} >> >> This will break on non-x86 hosts. > > I'd just use __sync_fetch_and_or here. Good idea. I think we can zap the memory barrier and fix a small race while being at it, see the incremental fix below. cheers, Gerd