Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: paulmck@linux.vnet.ibm.com (Paul E. McKenney)
Subject: [ltt-dev] [PATCH tip/core/rcu 1/4] Add header files supporting gcc __sync_ primitives
Date: Thu, 17 Jun 2010 09:45:24 -0700	[thread overview]
Message-ID: <20100617164524.GB2348@linux.vnet.ibm.com> (raw)
In-Reply-To: <1936029737.362931276761347025.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>

On Thu, Jun 17, 2010 at 03:55:47AM -0400, Paolo Bonzini wrote:
> +#define CACHE_LINE_SIZE 128
> +#define mb()    __sync_synchronize()
> 
> These are provided by arch_generic.h, aren't they?
> 
> In particular, CACHE_LINE_SIZE should be updated there from 64
> to 128 if we deem that value to be better.

Good point -- I need to prune in favor of arch_generic.h.
Therefore getting rid of both CACHE_LINE_SIZE and mb().

> diff --git a/urcu/uatomic_arch_gcc.h b/urcu/uatomic_arch_gcc.h
> new file mode 100644
> index 0000000..df208bd
> --- /dev/null
> +++ b/urcu/uatomic_arch_gcc.h
> @@ -0,0 +1,48 @@
> +/* xchg */
> +#define uatomic_xchg(addr, v) __sync_lock_test_and_set(addr, v)
> 
> __sync_lock_test_and_set may only support v==1, and is only
> an acquire barrier, so I think it's better to just use the
> definition in uatomic_arch_generic.h.

Good point -- I clearly am still catching up with the autoconf
changes to this library!  Thank you for bearing with me here.

> +/* cmpxchg */
> +#define uatomic_cmpxchg(addr, old, _new) \
> +	__sync_val_compare_and_swap(addr, old, _new)
> +
> +/* uatomic_add_return */
> +#define uatomic_add_return(addr, v) __sync_add_and_fetch(addr, v)
> 
> These are also provided by uatomic_arch_generic.h.

What I will do is define both UATOMIC_HAS_ATOMIC_BYTE and
UATOMIC_HAS_ATOMIC_SHORT in uatomic_arch_gcc.h, which allows
leveraging uatomic_arch_generic.h -- no other definitions required.

Of course, the same applies to the ARM stuff...

So letting arch_generic.h define CACHE_LINE_SIZE.  I need to keep mb()
in arch_armv7l.h due to the compiler bug.  At some point, I should
make this depend on __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__.

Given that ARM supports atomic operations on all sizes up to 32 bits,
seems simplest to just supply the bare __sync_ definitions, so will
leave uatomic_arch_armv7l.h as is for the moment.

Will respin, test, and resend!

							Thanx, Paul




  reply	other threads:[~2010-06-17 16:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17  4:47 [ltt-dev] [PATCH 0/4] v2: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
2010-06-17  4:47 ` [ltt-dev] [PATCH tip/core/rcu 1/4] Add header files supporting gcc __sync_ primitives Paul E. McKenney
2010-06-17  7:55   ` Paolo Bonzini
2010-06-17 16:45     ` Paul E. McKenney [this message]
2010-06-17  4:47 ` [ltt-dev] [PATCH tip/core/rcu 2/4] Add ia64 architecture based on gcc primitives Paul E. McKenney
2010-06-17  4:47 ` [ltt-dev] [PATCH tip/core/rcu 3/4] Add native ARM port for armv7l Paul E. McKenney
2010-06-17  4:48 ` [ltt-dev] [PATCH tip/core/rcu 4/4] Force build failure on unknown architectures Paul E. McKenney
2010-06-18 15:46 ` [ltt-dev] [PATCH 0/4] v2: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Mathieu Desnoyers
2010-06-18 16:02   ` Mathieu Desnoyers
2010-06-18 16:13     ` Paul E. McKenney
2010-06-18 16:12   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100617164524.GB2348@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox