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
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
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
> > 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
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)
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");
> > > +
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