I propose we use gcc builtins. We get automatic architecture support,
and tuning for newer processors if the user so chooses.
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
In May 2031 we can switch to C11 atomics.
Maybe 2013?
--
Wei-Ren Chen (陳韋任)
On 08/08/2012 12:05 PM, 陳韋任 (Wei-Ren Chen) wrote:
I propose we use gcc builtins. We get automatic architecture support,
and tuning for newer processors if the user so chooses.
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
In May 2031 we can switch to C11 atomics.
On 8 August 2012 07:25, Liu Ping Fan qemul...@gmail.com wrote:
+static inline void atomic_sub(int i, Atomic *v)
+{
+asm volatile(lock; subl %1,%0
+ : +m (v-counter)
+ : ir (i));
+}
NAK. We don't want random inline assembly implementations of locking
primitives in
On Wed, Aug 8, 2012 at 10:21 AM, Peter Maydell peter.mayd...@linaro.org wrote:
On 8 August 2012 07:25, Liu Ping Fan qemul...@gmail.com wrote:
+static inline void atomic_sub(int i, Atomic *v)
+{
+asm volatile(lock; subl %1,%0
+ : +m (v-counter)
+ : ir (i));
+}
Il 08/08/2012 15:09, Stefan Hajnoczi ha scritto:
NAK. We don't want random inline assembly implementations of locking
primitives in QEMU, they are way too hard to keep working with all the
possible host architectures we support. I spent some time a while back
getting rid of the (variously
On 8 August 2012 14:18, Paolo Bonzini pbonz...@redhat.com wrote:
Il 08/08/2012 15:09, Stefan Hajnoczi ha scritto:
No need to roll our own or copy the implementation from the kernel.
To some extent we need to because:
1. GCC atomics look ugly, :) do not provide rmb/wmb, and in some
versions