[Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-16 Thread Richard Henderson
On 04/16/2010 05:18 AM, Paolo Bonzini wrote: 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. Not sure about the memory barrier semantics of __sync_* (rth?), but besides that the pat

[Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-16 Thread Gerd Hoffmann
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 host

Re: [Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-16 Thread Gerd Hoffmann
On 04/16/10 12:18, Paolo Bonzini wrote: 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. Not sure about the memory barrier semantics of __sync_* (rth?), but besides that the patch se

[Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-16 Thread Paolo Bonzini
> > 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. Not sure about the memory barrier semantics of __sync_* (rth?), but besides that the patch seems like a good idea. Paolo

Re: [Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-15 Thread Richard Henderson
On 04/15/2010 11:47 AM, Blue Swirl wrote: On 4/15/10, 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)

[Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-15 Thread Blue Swirl
On 4/15/10, 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"); > > > +

[Qemu-devel] Re: [RfC PATCH 08/11] spice: add qxl device

2010-04-14 Thread Paolo Bonzini
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_fetc