Re: [lkp] [PATCH v3 2/6] atomics: Add test for atomic operations with _relaxed variants

Fengguang Wu
2015-10-12T15:32:49Z

Hi Boqun,

The base tree detection is based on the whole patchset's

- subjects
- touched files
- TO/CC list

Log shows the files and TO/CC are strongly related to powerpc,
so it looks a natural choice to apply to it. Especially you put
"linuxppc-dev@lists.ozlabs.org" in the TO list while Peter/Ingo
in the CC list -- that looks like a strong indication for powerpc.

[2015-10-12 22:27:49] patched_files: ["arch/powerpc/include/asm/cmpxchg.h", "lib/atomic64_test.c", "include/linux/atomic.h", "arch/powerpc/include/asm/atomic.h"]
[2015-10-12 22:27:49] bases: ["powerpc/next", "powerpc/next"]

[2015-10-12 22:27:49] lists: ["linux-kernel@vger.kernel.org", "linuxppc-dev@lists.ozlabs.org", "Peter Zijlstra <peterz@infradead.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.d
e>", "Will Deacon <will.deacon@arm.com>", "\"Paul E. McKenney\" <paulmck@linux.vnet.ibm.com>", "Waiman Long <waiman.long@hp.com>", "Davidlohr Bueso <dave@stgolabs.net>"
, "Boqun Feng <boqun.feng@gmail.com>"]
[2015-10-12 22:27:49] bases: ["powerpc/next", "powerpc/next", "powerpc/next", "mpe/next", "mpe/next", "arm64/for-next/core", "arm64/for-next/core"]

The possible improvement would be to let tip:locking/core register
itself in the MAINTAINERS file to match files *cmpxchg* *atomic*.

Thanks,
Fengguang

On Mon, Oct 12, 2015 at 10:56:52PM +0800, Boqun Feng wrote:
> On Mon, Oct 12, 2015 at 10:43:56PM +0800, kbuild test robot wrote:
> > Hi Boqun,
> >
> > [auto build test ERROR on v4.3-rc5 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> >
>
> This patch should be tested based on current locking/core branch of tip
> tree. Thank you.
>
> Regards,
> Boqun
>
> > url: https://github.com/0day-ci/linux/commits/Boqun-Feng/atomics-powerpc-Implement-relaxed-acquire-release-variants-of-some-atomics/20151012-222750
> > config: x86_64-randconfig-x016-10121751 (attached as .config)
> > reproduce:
> > # save the attached .config to linux build tree
> > make ARCH=x86_64
> >
> > All error/warnings (new ones prefixed by >>):
> >
> > In file included from include/linux/init.h:4:0,
> > from lib/atomic64_test.c:14:
> > lib/atomic64_test.c: In function 'test_atomic':
> > >> lib/atomic64_test.c:60:9: error: implicit declaration of function 'atomic_inc_return_acquire' [-Werror=implicit-function-declaration]
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > include/linux/compiler.h:166:42: note: in definition of macro 'unlikely'
> > # define unlikely(x) __builtin_expect(!!(x), 0)
> > ^
> > >> lib/atomic64_test.c:60:2: note: in expansion of macro 'BUG_ON'
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > >> lib/atomic64_test.c:38:2: note: in expansion of macro 'TEST_ARGS'
> > test(bit, op##_acquire, ##args); \
> > ^
> > >> lib/atomic64_test.c:79:2: note: in expansion of macro 'FAMILY_TEST'
> > FAMILY_TEST(TEST_ARGS, bit, inc_return, \
> > ^
> > >> lib/atomic64_test.c:113:2: note: in expansion of macro 'INC_RETURN_FAMILY_TEST'
> > INC_RETURN_FAMILY_TEST(, v0);
> > ^
> > >> lib/atomic64_test.c:60:9: error: implicit declaration of function 'atomic_inc_return_release' [-Werror=implicit-function-declaration]
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > include/linux/compiler.h:166:42: note: in definition of macro 'unlikely'
> > # define unlikely(x) __builtin_expect(!!(x), 0)
> > ^
> > >> lib/atomic64_test.c:60:2: note: in expansion of macro 'BUG_ON'
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > lib/atomic64_test.c:39:2: note: in expansion of macro 'TEST_ARGS'
> > test(bit, op##_release, ##args); \
> > ^
> > >> lib/atomic64_test.c:79:2: note: in expansion of macro 'FAMILY_TEST'
> > FAMILY_TEST(TEST_ARGS, bit, inc_return, \
> > ^
> > >> lib/atomic64_test.c:113:2: note: in expansion of macro 'INC_RETURN_FAMILY_TEST'
> > INC_RETURN_FAMILY_TEST(, v0);
> > ^
> > >> lib/atomic64_test.c:60:9: error: implicit declaration of function 'atomic_inc_return_relaxed' [-Werror=implicit-function-declaration]
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > include/linux/compiler.h:166:42: note: in definition of macro 'unlikely'
> > # define unlikely(x) __builtin_expect(!!(x), 0)
> > ^
> > >> lib/atomic64_test.c:60:2: note: in expansion of macro 'BUG_ON'
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > lib/atomic64_test.c:40:2: note: in expansion of macro 'TEST_ARGS'
> > test(bit, op##_relaxed, ##args); \
> > ^
> > >> lib/atomic64_test.c:79:2: note: in expansion of macro 'FAMILY_TEST'
> > FAMILY_TEST(TEST_ARGS, bit, inc_return, \
> > ^
> > >> lib/atomic64_test.c:113:2: note: in expansion of macro 'INC_RETURN_FAMILY_TEST'
> > INC_RETURN_FAMILY_TEST(, v0);
> > ^
> > >> lib/atomic64_test.c:60:9: error: implicit declaration of function 'atomic_dec_return_acquire' [-Werror=implicit-function-declaration]
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > include/linux/compiler.h:166:42: note: in definition of macro 'unlikely'
> > # define unlikely(x) __builtin_expect(!!(x), 0)
> > ^
> > >> lib/atomic64_test.c:60:2: note: in expansion of macro 'BUG_ON'
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > >> lib/atomic64_test.c:38:2: note: in expansion of macro 'TEST_ARGS'
> > test(bit, op##_acquire, ##args); \
> > ^
> > lib/atomic64_test.c:85:2: note: in expansion of macro 'FAMILY_TEST'
> > FAMILY_TEST(TEST_ARGS, bit, dec_return, \
> > ^
> > >> lib/atomic64_test.c:114:2: note: in expansion of macro 'DEC_RETURN_FAMILY_TEST'
> > DEC_RETURN_FAMILY_TEST(, v0);
> > ^
> > >> lib/atomic64_test.c:60:9: error: implicit declaration of function 'atomic_dec_return_release' [-Werror=implicit-function-declaration]
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > include/linux/compiler.h:166:42: note: in definition of macro 'unlikely'
> > # define unlikely(x) __builtin_expect(!!(x), 0)
> > ^
> > >> lib/atomic64_test.c:60:2: note: in expansion of macro 'BUG_ON'
> > BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > ^
> > lib/atomic64_test.c:39:2: note: in expansion of macro 'TEST_ARGS'
> > test(bit, op##_release, ##args); \
> > ^
> > lib/atomic64_test.c:85:2: note: in expansion of macro 'FAMILY_TEST'
> > FAMILY_TEST(TEST_ARGS, bit, dec_return, \
> > ^
> > >> lib/atomic64_test.c:114:2: note: in expansion of macro 'DEC_RETURN_FAMILY_TEST'
> > DEC_RETURN_FAMILY_TEST(, v0);
> > ^
> >
> > vim +/atomic_inc_return_acquire +60 lib/atomic64_test.c
> >
> > 8 * the Free Software Foundation; either version 2 of the License, or
> > 9 * (at your option) any later version.
> > 10 */
> > 11
> > 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > 13
> > > 14 #include <linux/init.h>
> > 15 #include <linux/bug.h>
> > 16 #include <linux/kernel.h>
> > 17 #include <linux/atomic.h>
> > 18
> > 19 #define TEST(bit, op, c_op, val) \
> > 20 do { \
> > 21 atomic##bit##_set(&v, v0); \
> > 22 r = v0; \
> > 23 atomic##bit##_##op(val, &v); \
> > 24 r c_op val; \
> > 25 WARN(atomic##bit##_read(&v) != r, "%Lx != %Lx\n", \
> > 26 (unsigned long long)atomic##bit##_read(&v), \
> > 27 (unsigned long long)r); \
> > 28 } while (0)
> > 29
> > 30 /*
> > 31 * Test for a atomic operation family,
> > 32 * @test should be a macro accepting parameters (bit, op, ...)
> > 33 */
> > 34
> > 35 #define FAMILY_TEST(test, bit, op, args...) \
> > 36 do { \
> > 37 test(bit, op, ##args); \
> > > 38 test(bit, op##_acquire, ##args); \
> > > 39 test(bit, op##_release, ##args); \
> > > 40 test(bit, op##_relaxed, ##args); \
> > 41 } while (0)
> > 42
> > 43 #define TEST_RETURN(bit, op, c_op, val) \
> > 44 do { \
> > 45 atomic##bit##_set(&v, v0); \
> > 46 r = v0; \
> > 47 r c_op val; \
> > 48 BUG_ON(atomic##bit##_##op(val, &v) != r); \
> > 49 BUG_ON(atomic##bit##_read(&v) != r); \
> > 50 } while (0)
> > 51
> > 52 #define RETURN_FAMILY_TEST(bit, op, c_op, val) \
> > 53 do { \
> > 54 FAMILY_TEST(TEST_RETURN, bit, op, c_op, val); \
> > 55 } while (0)
> > 56
> > 57 #define TEST_ARGS(bit, op, init, ret, expect, args...) \
> > 58 do { \
> > 59 atomic##bit##_set(&v, init); \
> > > 60 BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
> > 61 BUG_ON(atomic##bit##_read(&v) != expect); \
> > 62 } while (0)
> > 63
> > 64 #define XCHG_FAMILY_TEST(bit, init, new) \
> > 65 do { \
> > 66 FAMILY_TEST(TEST_ARGS, bit, xchg, init, init, new, new); \
> > 67 } while (0)
> > 68
> > 69 #define CMPXCHG_FAMILY_TEST(bit, init, new, wrong) \
> > 70 do { \
> > 71 FAMILY_TEST(TEST_ARGS, bit, cmpxchg, \
> > 72 init, init, new, init, new); \
> > 73 FAMILY_TEST(TEST_ARGS, bit, cmpxchg, \
> > 74 init, init, init, wrong, new); \
> > 75 } while (0)
> > 76
> > 77 #define INC_RETURN_FAMILY_TEST(bit, i) \
> > 78 do { \
> > > 79 FAMILY_TEST(TEST_ARGS, bit, inc_return, \
> > 80 i, (i) + one, (i) + one); \
> > 81 } while (0)
> > 82
> > 83 #define DEC_RETURN_FAMILY_TEST(bit, i) \
> > 84 do { \
> > > 85 FAMILY_TEST(TEST_ARGS, bit, dec_return, \
> > 86 i, (i) - one, (i) - one); \
> > 87 } while (0)
> > 88
> > 89 static __init void test_atomic(void)
> > 90 {
> > 91 int v0 = 0xaaa31337;
> > 92 int v1 = 0xdeadbeef;
> > 93 int onestwos = 0x11112222;
> > 94 int one = 1;
> > 95
> > 96 atomic_t v;
> > 97 int r;
> > 98
> > 99 TEST(, add, +=, onestwos);
> > 100 TEST(, add, +=, -one);
> > 101 TEST(, sub, -=, onestwos);
> > 102 TEST(, sub, -=, -one);
> > 103 TEST(, or, |=, v1);
> > 104 TEST(, and, &=, v1);
> > 105 TEST(, xor, ^=, v1);
> > 106 TEST(, andnot, &= ~, v1);
> > 107
> > 108 RETURN_FAMILY_TEST(, add_return, +=, onestwos);
> > 109 RETURN_FAMILY_TEST(, add_return, +=, -one);
> > 110 RETURN_FAMILY_TEST(, sub_return, -=, onestwos);
> > 111 RETURN_FAMILY_TEST(, sub_return, -=, -one);
> > 112
> > > 113 INC_RETURN_FAMILY_TEST(, v0);
> > > 114 DEC_RETURN_FAMILY_TEST(, v0);
> > 115
> > 116 XCHG_FAMILY_TEST(, v0, v1);
> > 117 CMPXCHG_FAMILY_TEST(, v0, v1, onestwos);
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
>