Re: [PATCH] locking/qrwlock: Let qrwlock has same layout regardless of the endian

From: kbuild test robot
Date: Wed Jun 15 2016 - 05:48:03 EST


Hi,

[auto build test ERROR on asm-generic/master]
[also build test ERROR on v4.7-rc3 next-20160615]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Pan-Xinhui/locking-qrwlock-Let-qrwlock-has-same-layout-regardless-of-the-endian/20160615-172044
base: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic master
config: x86_64-randconfig-x014-201624 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/qrwlock.h:5:0,
from arch/x86/include/asm/spinlock.h:219,
from include/linux/spinlock.h:87,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/asm-generic/qrwlock.h: In function 'queued_read_can_lock':
>> include/asm-generic/qrwlock.h:40:29: error: '_QW_SHIFT' undeclared (first use in this function)
#define _QW_WMASK (0xffU << _QW_SHIFT) /* Writer mask */
^
>> include/asm-generic/qrwlock.h:55:38: note: in expansion of macro '_QW_WMASK'
return !(atomic_read(&lock->cnts) & _QW_WMASK);
^~~~~~~~~
include/asm-generic/qrwlock.h:40:29: note: each undeclared identifier is reported only once for each function it appears in
#define _QW_WMASK (0xffU << _QW_SHIFT) /* Writer mask */
^
>> include/asm-generic/qrwlock.h:55:38: note: in expansion of macro '_QW_WMASK'
return !(atomic_read(&lock->cnts) & _QW_WMASK);
^~~~~~~~~
In file included from arch/x86/include/asm/atomic.h:4:0,
from include/linux/atomic.h:4,
from include/linux/crypto.h:20,
from arch/x86/kernel/asm-offsets.c:8:
include/asm-generic/qrwlock.h: In function 'queued_read_trylock':
>> include/asm-generic/qrwlock.h:40:29: error: '_QW_SHIFT' undeclared (first use in this function)
#define _QW_WMASK (0xffU << _QW_SHIFT) /* Writer mask */
^
include/linux/compiler.h:169:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
include/asm-generic/qrwlock.h:77:22: note: in expansion of macro '_QW_WMASK'
if (likely(!(cnts & _QW_WMASK))) {
^~~~~~~~~
include/asm-generic/qrwlock.h: In function 'queued_write_trylock':
include/asm-generic/qrwlock.h:39:30: error: '_QW_SHIFT' undeclared (first use in this function)
#define _QW_LOCKED (0xffU << _QW_SHIFT) /* A writer holds the lock */
^
include/linux/compiler.h:169:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
>> include/asm-generic/qrwlock.h:100:24: note: in expansion of macro '_QW_LOCKED'
cnts, cnts | _QW_LOCKED) == cnts);
^~~~~~~~~~
include/asm-generic/qrwlock.h: In function 'queued_read_lock':
>> include/asm-generic/qrwlock.h:40:29: error: '_QW_SHIFT' undeclared (first use in this function)
#define _QW_WMASK (0xffU << _QW_SHIFT) /* Writer mask */
^
include/linux/compiler.h:169:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
include/asm-generic/qrwlock.h:111:22: note: in expansion of macro '_QW_WMASK'
if (likely(!(cnts & _QW_WMASK)))
^~~~~~~~~
In file included from arch/x86/include/asm/qrwlock.h:5:0,
from arch/x86/include/asm/spinlock.h:219,
from include/linux/spinlock.h:87,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/asm-generic/qrwlock.h: In function 'queued_write_lock':
include/asm-generic/qrwlock.h:39:30: error: '_QW_SHIFT' undeclared (first use in this function)
#define _QW_LOCKED (0xffU << _QW_SHIFT) /* A writer holds the lock */
^
include/asm-generic/qrwlock.h:125:45: note: in expansion of macro '_QW_LOCKED'
if (atomic_cmpxchg_acquire(&lock->cnts, 0, _QW_LOCKED) == 0)
^~~~~~~~~~
make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2

vim +/_QW_SHIFT +40 include/asm-generic/qrwlock.h

33 #else
34 #define _QR_SHIFT 0 /* Reader count shift */
35 #define _QW_SHIFT 24 /* Writer mode shift */
36 #endif
37
38 #define _QW_WAITING (1U << _QW_SHIFT) /* A writer is waiting */
> 39 #define _QW_LOCKED (0xffU << _QW_SHIFT) /* A writer holds the lock */
> 40 #define _QW_WMASK (0xffU << _QW_SHIFT) /* Writer mask */
41 #define _QR_BIAS (1U << _QR_SHIFT)
42
43 /*
44 * External function declarations
45 */
46 extern void queued_read_lock_slowpath(struct qrwlock *lock, u32 cnts);
47 extern void queued_write_lock_slowpath(struct qrwlock *lock);
48
49 /**
50 * queued_read_can_lock- would read_trylock() succeed?
51 * @lock: Pointer to queue rwlock structure
52 */
53 static inline int queued_read_can_lock(struct qrwlock *lock)
54 {
> 55 return !(atomic_read(&lock->cnts) & _QW_WMASK);
56 }
57
58 /**
59 * queued_write_can_lock- would write_trylock() succeed?
60 * @lock: Pointer to queue rwlock structure
61 */
62 static inline int queued_write_can_lock(struct qrwlock *lock)
63 {
64 return !atomic_read(&lock->cnts);
65 }
66
67 /**
68 * queued_read_trylock - try to acquire read lock of a queue rwlock
69 * @lock : Pointer to queue rwlock structure
70 * Return: 1 if lock acquired, 0 if failed
71 */
72 static inline int queued_read_trylock(struct qrwlock *lock)
73 {
74 u32 cnts;
75
76 cnts = atomic_read(&lock->cnts);
77 if (likely(!(cnts & _QW_WMASK))) {
78 cnts = (u32)atomic_add_return_acquire(_QR_BIAS, &lock->cnts);
79 if (likely(!(cnts & _QW_WMASK)))
80 return 1;
81 atomic_sub(_QR_BIAS, &lock->cnts);
82 }
83 return 0;
84 }
85
86 /**
87 * queued_write_trylock - try to acquire write lock of a queue rwlock
88 * @lock : Pointer to queue rwlock structure
89 * Return: 1 if lock acquired, 0 if failed
90 */
91 static inline int queued_write_trylock(struct qrwlock *lock)
92 {
93 u32 cnts;
94
95 cnts = atomic_read(&lock->cnts);
96 if (unlikely(cnts))
97 return 0;
98
99 return likely(atomic_cmpxchg_acquire(&lock->cnts,
> 100 cnts, cnts | _QW_LOCKED) == cnts);
101 }
102 /**
103 * queued_read_lock - acquire read lock of a queue rwlock

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data