From: peterz@infradead.org (Peter Zijlstra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: atomics: fix use of acquire + release for full barrier semantics
Date: Tue, 4 Feb 2014 17:43:08 +0100 [thread overview]
Message-ID: <20140204164308.GA5002@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <1391516953-14541-1-git-send-email-will.deacon@arm.com>
On Tue, Feb 04, 2014 at 12:29:12PM +0000, Will Deacon wrote:
> @@ -112,17 +114,20 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
> unsigned long tmp;
> int oldval;
>
> + smp_mb();
> +
> asm volatile("// atomic_cmpxchg\n"
> -"1: ldaxr %w1, %2\n"
> +"1: ldxr %w1, %2\n"
> " cmp %w1, %w3\n"
> " b.ne 2f\n"
> -" stlxr %w0, %w4, %2\n"
> +" stxr %w0, %w4, %2\n"
> " cbnz %w0, 1b\n"
> "2:"
> : "=&r" (tmp), "=&r" (oldval), "+Q" (ptr->counter)
> : "Ir" (old), "r" (new)
> : "cc", "memory");
>
> + smp_mb();
> return oldval;
> }
>
Any particular reason atomic_cmpxchg() doesn't use the proposed rel + mb
scheme? It would be a waste to have atomic_cmpxchg() be more expensive
than it needs to be.
next prev parent reply other threads:[~2014-02-04 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 12:29 [PATCH 1/2] arm64: atomics: fix use of acquire + release for full barrier semantics Will Deacon
2014-02-04 12:29 ` [PATCH 2/2] arm64: asm: remove redundant "cc" clobbers Will Deacon
2014-02-19 17:05 ` Catalin Marinas
2014-02-04 16:43 ` Peter Zijlstra [this message]
2014-02-04 17:16 ` [PATCH 1/2] arm64: atomics: fix use of acquire + release for full barrier semantics Will Deacon
2014-02-19 17:05 ` Catalin Marinas
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=20140204164308.GA5002@laptop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.