Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1215293
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Peter Zijlstra <peterz@infradead.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [RFC 2/5] atomics: introduce arch_atomic_op_{acquire,release,fence} helpers |
| Date | Fri, 28 Aug 2015 13:40:01 +0200 |
| Message-ID | <q2qaJ-20a-9@gated-at.bofh.it> (permalink) |
| References | <q2hTP-6SU-3@gated-at.bofh.it> <q2hTP-6SU-1@gated-at.bofh.it> |
| X-Original-To | Boqun Feng <boqun.feng@gmail.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.21 (2012-12-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 43 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ingo Molnar <mingo@kernel.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, Michael Ellerman <mpe@ellerman.id.au>, Thomas Gleixner <tglx@linutronix.de>, Will Deacon <will.deacon@arm.com>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Waiman Long <waiman.long@hp.com> |
| X-Original-Date | Fri, 28 Aug 2015 13:36:14 +0200 |
| X-Original-Message-ID | <20150828113614.GC16853@twins.programming.kicks-ass.net> |
| X-Original-References | <1440730099-29133-1-git-send-email-boqun.feng@gmail.com> <1440730099-29133-3-git-send-email-boqun.feng@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1215293 |
Show key headers only | View raw
On Fri, Aug 28, 2015 at 10:48:16AM +0800, Boqun Feng wrote:
> Some architectures may have their special barriers for acquire, release
> and fence semantics, general memory barriers(smp_mb__*_atomic()) in
> __atomic_op_*() may be too strong, so arch_atomic_op_*() helpers are
> introduced for architectures to provide their own version helpers to
> build different variants based on _relaxed variants.
>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> ---
> include/linux/atomic.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/include/linux/atomic.h b/include/linux/atomic.h
> index 00a5763..622255b 100644
> --- a/include/linux/atomic.h
> +++ b/include/linux/atomic.h
> @@ -34,20 +34,33 @@
> * The idea here is to build acquire/release variants by adding explicit
> * barriers on top of the relaxed variant. In the case where the relaxed
> * variant is already fully ordered, no additional barriers are needed.
> + *
> + * Besides, if an arch has a special barrier for acquire/release, it could
> + * implement its own arch_atomic_op_* and use the same framework for building
> + * variants
> */
> +#ifndef arch_atomic_op_acquire
> #define __atomic_op_acquire(op, args...) \
> ({ \
> typeof(op##_relaxed(args)) __ret = op##_relaxed(args); \
> smp_mb__after_atomic(); \
> __ret; \
> })
> +#else
> +#define __atomic_op_acquire arch_atomic_op_acquire
> +#endif
Not really a fan of this, its not consistent with the existing #ifndef
guard style.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 2/5] atomics: introduce arch_atomic_op_{acquire,release,fence} helpers Boqun Feng <boqun.feng@gmail.com> - 2015-08-28 04:50 +0200
Re: [RFC 2/5] atomics: introduce arch_atomic_op_{acquire,release,fence} helpers Peter Zijlstra <peterz@infradead.org> - 2015-08-28 13:40 +0200
Re: [RFC 2/5] atomics: introduce arch_atomic_op_{acquire,release,fence} helpers Boqun Feng <boqun.feng@gmail.com> - 2015-08-28 14:00 +0200
csiph-web