From: compudj@krystal.dyndns.org (Mathieu Desnoyers)
Subject: [ltt-dev] [URCU PATCH] atomic: provide seq_cst semantics on powerpc
Date: Tue, 20 Sep 2011 12:35:18 -0400 [thread overview]
Message-ID: <20110920163518.GB31802@Krystal> (raw)
In-Reply-To: <1316502769-576-2-git-send-email-pbonzini@redhat.com>
* Paolo Bonzini (pbonzini at redhat.com) wrote:
> Using lwsync before a load conditional provides acq_rel semantics. Other
> architectures provide sequential consistency, so replace the lwsync with
> sync (see also http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html).
Paul, I think Paolo is right here. And it seems to fit with the powerpc
barrier models we discussed at plumbers. Can you provide feedback on
this ?
Thanks,
Mathieu
> ---
> urcu/uatomic/ppc.h | 18 ++++++------------
> 1 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/urcu/uatomic/ppc.h b/urcu/uatomic/ppc.h
> index 3eb3d63..8485f67 100644
> --- a/urcu/uatomic/ppc.h
> +++ b/urcu/uatomic/ppc.h
> @@ -27,12 +27,6 @@
> extern "C" {
> #endif
>
> -#ifdef __NO_LWSYNC__
> -#define LWSYNC_OPCODE "sync\n"
> -#else
> -#define LWSYNC_OPCODE "lwsync\n"
> -#endif
> -
> #define ILLEGAL_INSTR ".long 0xd00d00"
>
> /*
> @@ -53,7 +47,7 @@ unsigned long _uatomic_exchange(void *addr, unsigned long val, int len)
> unsigned int result;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "lwarx %0,0,%1\n" /* load and reserve */
> "stwcx. %2,0,%1\n" /* else store conditional */
> "bne- 1b\n" /* retry if lost reservation */
> @@ -70,7 +64,7 @@ unsigned long _uatomic_exchange(void *addr, unsigned long val, int len)
> unsigned long result;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "ldarx %0,0,%1\n" /* load and reserve */
> "stdcx. %2,0,%1\n" /* else store conditional */
> "bne- 1b\n" /* retry if lost reservation */
> @@ -104,7 +98,7 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
> unsigned int old_val;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "lwarx %0,0,%1\n" /* load and reserve */
> "cmpw %0,%3\n" /* if load is not equal to */
> "bne 2f\n" /* old, fail */
> @@ -125,7 +119,7 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
> unsigned long old_val;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "ldarx %0,0,%1\n" /* load and reserve */
> "cmpd %0,%3\n" /* if load is not equal to */
> "bne 2f\n" /* old, fail */
> @@ -166,7 +160,7 @@ unsigned long _uatomic_add_return(void *addr, unsigned long val,
> unsigned int result;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "lwarx %0,0,%1\n" /* load and reserve */
> "add %0,%2,%0\n" /* add val to value loaded */
> "stwcx. %0,0,%1\n" /* store conditional */
> @@ -184,7 +178,7 @@ unsigned long _uatomic_add_return(void *addr, unsigned long val,
> unsigned long result;
>
> __asm__ __volatile__(
> - LWSYNC_OPCODE
> + "sync\n" /* for sequential consistency */
> "1:\t" "ldarx %0,0,%1\n" /* load and reserve */
> "add %0,%2,%0\n" /* add val to value loaded */
> "stdcx. %0,0,%1\n" /* store conditional */
> --
> 1.7.6
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2011-09-20 16:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-20 7:12 Paolo Bonzini
2011-09-20 16:35 ` Mathieu Desnoyers [this message]
2011-09-21 23:56 ` Paul E. McKenney
2011-09-22 0:27 ` Mathieu Desnoyers
2011-09-22 7:53 ` Paolo Bonzini
2011-09-22 9:13 ` Mathieu Desnoyers
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=20110920163518.GB31802@Krystal \
--to=compudj@krystal.dyndns.org \
/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