Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244729

[PATCH v3 0/6] atomics: powerpc: Implement relaxed/acquire/release variants of some atomics

From Boqun Feng <boqun.feng@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v3 0/6] atomics: powerpc: Implement relaxed/acquire/release variants of some atomics
Date 2015-10-12 16:20 +0200
Message-ID <qiM7f-1nR-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

This is v3 of the series.

Link for v1: https://lkml.org/lkml/2015/8/27/798
Link for v2: https://lkml.org/lkml/2015/9/16/527

Paul, Peter and Will, thank you all for the comments and suggestions,
that's really a lot of fun to discuss these with you and very
enlightening to me ;-)

Changes since v2:

*	reorder the patches to put the fix of cmpxchg, xchg and their
	atomic_ versions first, and Cc stable. (Peter Zijlstra)

*	modify the commit log for implementation of cmpxchg family to
	explain why we implement some operation using assembly code
	(Peter Zijlstra)

*	add implementation and test for {inc,dec}_return atomics.
	(Will Deacon)

*	rebase on current locking/core branch of tip tree (commit
	00eb4bab69db3)

*	rewrite the macros for generating tests to save some lines of
	code


Relaxed/acquire/release variants of atomic operations {add,sub}_return
and {cmp,}xchg are introduced by commit:

"atomics: add acquire/release/relaxed variants of some atomic operations"

and {inc,dec}_return has been introduced by commit:

"locking/asm-generic: Add _{relaxed|acquire|release}() variants for
inc/dec atomics"

Both of these are in the current locking/core branch of the tip tree.

By default, the generic code will implement a relaxed variant as a full
ordered atomic operation and release/acquire a variant as a relaxed
variant with a necessary general barrier before or after.

On powerpc, which has a weak memory order model, a relaxed variant can
be implemented more lightweightly than a full ordered one. Further more,
release and acquire variants can be implemented with arch-specific
lightweight barriers.

Besides, cmpxchg, xchg and their atomic_ versions are only RELEASE+ACQUIRE
rather that full barriers in current PPC implementation, which is
incorrect according to memory-barriers.txt.

Therefore this patchset fix the order guarantee of cmpxchg, xchg and
their atomic_ versions and implements the relaxed/acquire/release
variants based on powerpc memory model and specific barriers, Some
trivial tests for these new variants are also included in this series,
because some of these variants are not used in kernel for now, I think
is a good idea to at least generate the code for these variants
somewhere.

The patchset consists of 6 parts:

1.	Make xchg, cmpxchg and their atomic_ versions a full barrier

2.	Add trivial tests for the new variants in lib/atomic64_test.c

3.	Allow architectures to define their own __atomic_op_*() helpers
	to build other variants based on relaxed.

4.	Implement atomic{,64}_{add,sub,inc,dec}_return_* variants

5.	Implement xchg_* and atomic{,64}_xchg_* variants

6.	Implement cmpxchg_* atomic{,64}_cmpxchg_* variants


This patchset is based on current locking/core branch of the tip tree
and all patches are built and boot tested for little endian pseries, and
also tested by 0day.


Looking forward to any suggestion, question and comment ;-)

Regards,
Boqun

--
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 | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/6] atomics: powerpc: Implement relaxed/acquire/release variants of some atomics Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
  [PATCH v3 5/6] powerpc: atomic: Implement xchg_* and atomic{,64}_xchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
  [PATCH v3 3/6] atomics: Allow architectures to define their own __atomic_op_* helpers Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
  [PATCH v3 4/6] powerpc: atomic: Implement atomic{,64}_*_return_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
    Re: [PATCH v3 4/6] powerpc: atomic: Implement atomic{,64}_*_return_*  variants Will Deacon <will.deacon@arm.com> - 2015-10-13 15:30 +0200
      Re: [PATCH v3 4/6] powerpc: atomic: Implement atomic{,64}_*_return_*  variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 15:40 +0200
        Re: [PATCH v3 4/6] powerpc: atomic: Implement atomic{,64}_*_return_*  variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-14 03:10 +0200
  [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
    Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Will Deacon <will.deacon@arm.com> - 2015-10-13 15:30 +0200
      Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 16:40 +0200
        Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 16:50 +0200
        Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Will Deacon <will.deacon@arm.com> - 2015-10-13 16:50 +0200
          Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 17:00 +0200
            Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Will Deacon <will.deacon@arm.com> - 2015-10-13 17:10 +0200
              Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 17:50 +0200
              Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-14 03:50 +0200
                Re: [PATCH v3 6/6] powerpc: atomic: Implement cmpxchg{,64}_* and  atomic{,64}_cmpxchg_* variants Will Deacon <will.deacon@arm.com> - 2015-10-14 11:50 +0200
  [PATCH v3 2/6] atomics: Add test for atomic operations with _relaxed variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:20 +0200
    Re: [lkp] [PATCH v3 2/6] atomics: Add test for atomic operations  with _relaxed variants Fengguang Wu <lkp@intel.com> - 2015-10-12 17:40 +0200
      Re: [lkp] [PATCH v3 2/6] atomics: Add test for atomic operations  with _relaxed variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 17:50 +0200
        Re: [kbuild-all] [lkp] [PATCH v3 2/6] atomics: Add test for atomic  operations with _relaxed variants Fengguang Wu <lkp@intel.com> - 2015-10-12 18:10 +0200
        Re: [kbuild-all] [lkp] [PATCH v3 2/6] atomics: Add test for atomic  operations with _relaxed variants Fengguang Wu <lkp@intel.com> - 2015-10-12 18:10 +0200
          Re: [kbuild-all] [lkp] [PATCH v3 2/6] atomics: Add test for atomic  operations with _relaxed variants Boqun Feng <boqun.feng@gmail.com> - 2015-10-13 03:40 +0200
  Re: [PATCH v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full  barrier Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:30 +0200
  [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a full barrier Boqun Feng <boqun.feng@gmail.com> - 2015-10-12 16:40 +0200
    Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg  a full barrier Michael Ellerman <mpe@ellerman.id.au> - 2015-10-14 02:20 +0200
      Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a  full barrier Boqun Feng <boqun.feng@gmail.com> - 2015-10-14 03:00 +0200
        Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a  full barrier Peter Zijlstra <peterz@infradead.org> - 2015-10-14 10:10 +0200
          Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a  full barrier Boqun Feng <boqun.feng@gmail.com> - 2015-10-14 11:30 +0200
            Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg a  full barrier Peter Zijlstra <peterz@infradead.org> - 2015-10-14 11:40 +0200
              Re: [PATCH RESEND v3 1/6] powerpc: atomic: Make *xchg and *cmpxchg  a full barrier Michael Ellerman <mpe@ellerman.id.au> - 2015-10-14 11:50 +0200
  Re: [PATCH v3 0/6] atomics: powerpc: Implement  relaxed/acquire/release variants of some atomics Peter Zijlstra <peterz@infradead.org> - 2015-10-13 14:30 +0200
    Re: [PATCH v3 0/6] atomics: powerpc: Implement  relaxed/acquire/release variants of some atomics "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-10-13 17:50 +0200

csiph-web