Il 19/06/2013 22:44, Richard Henderson ha scritto:
>>> >> +/* Data must be read atomically. We don't really need barrier
>>> >> semantics
>>> >> + * but it's easier to use atomic_* than roll our own. */
>>> >> +log = atomic_xchg(from, 0);
>> >
>> > If you really don't need
On 06/19/2013 01:39 PM, Torvald Riegel wrote:
> On Thu, 2013-06-20 at 04:59 +0800, Liu Ping Fan wrote:
>> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>> index fbabf99..28abe1e 100644
>> --- a/hw/virtio/vhost.c
>> +++ b/hw/virtio/vhost.c
>> @@ -16,6 +16,7 @@
>> #include
>> #include "hw/vir
On Thu, 2013-06-20 at 04:59 +0800, Liu Ping Fan wrote:
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index fbabf99..28abe1e 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -16,6 +16,7 @@
> #include
> #include "hw/virtio/vhost.h"
> #include "hw/hw.h"
> +#include "qemu/at
Il 19/06/2013 18:37, Richard Henderson ha scritto:
>> > +#ifndef atomic_read
>> > +#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
>> > #endif
>> >
>> > +#ifndef atomic_set
>> > +#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) =
>> > (i))
>> > +#endif
On 06/19/2013 01:59 PM, Liu Ping Fan wrote:
> +#ifndef atomic_read
> +#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
> #endif
>
> +#ifndef atomic_set
> +#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i))
> +#endif
I still think these should be enh
From: Paolo Bonzini
We're already using them in several places, but __sync builtins are just
too ugly to type, and do not provide seqcst load/store operations.
Signed-off-by: Paolo Bonzini
Cc: Richard Henderson
Cc: Andrew Haley ,
Cc: Torvald Riegel ,
Cc: Paul E. McKenney
---
docs/atomics.tx