Re: [PATCH] seqlock: <linux/seqlock.h>: fix multiple kernel-doc warnings

From: kernel test robot
Date: Sun Aug 16 2020 - 20:15:04 EST


Hi Randy,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.9-rc1 next-20200814]
[cannot apply to tip/locking/core linux/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Randy-Dunlap/seqlock-linux-seqlock-h-fix-multiple-kernel-doc-warnings/20200817-062836
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
config: x86_64-randconfig-a013-20200817 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ab9fc8bae805c785066779e76e7846aabad5609e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

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

In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:156:8: error: 'inline' can only appear on functions
static __always_inline void \
^
include/linux/compiler_attributes.h:70:41: note: expanded from macro '__always_inline'
#define __always_inline inline __attribute__((__always_inline__))
^
include/linux/compiler_types.h:144:16: note: expanded from macro 'inline'
#define inline inline __gnu_inline __inline_maybe_unused notrace
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:156:8: warning: '__gnu_inline__' attribute only applies to functions [-Wignored-attributes]
include/linux/compiler_attributes.h:70:41: note: expanded from macro '__always_inline'
#define __always_inline inline __attribute__((__always_inline__))
^
include/linux/compiler_types.h:144:23: note: expanded from macro 'inline'
#define inline inline __gnu_inline __inline_maybe_unused notrace
^
include/linux/compiler_attributes.h:167:56: note: expanded from macro '__gnu_inline'
#define __gnu_inline __attribute__((__gnu_inline__))
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:156:8: warning: 'no_instrument_function' attribute only applies to functions [-Wignored-attributes]
include/linux/compiler_attributes.h:70:41: note: expanded from macro '__always_inline'
#define __always_inline inline __attribute__((__always_inline__))
^
include/linux/compiler_types.h:144:58: note: expanded from macro 'inline'
#define inline inline __gnu_inline __inline_maybe_unused notrace
^
arch/x86/include/asm/linkage.h:8:32: note: expanded from macro 'notrace'
#define notrace __attribute__((no_instrument_function))
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:156:8: warning: '__always_inline__' attribute only applies to functions [-Wignored-attributes]
include/linux/compiler_attributes.h:70:63: note: expanded from macro '__always_inline'
#define __always_inline inline __attribute__((__always_inline__))
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:156:34: error: variable has incomplete type 'void'
static __always_inline void \
^
>> include/linux/seqlock.h:157:10: error: expected ';' after top level declarator
seqcount_##lockname##_init(seqcount_##lockname##_t *s, locktype *lock) \
^
;
>> include/linux/seqlock.h:213:1: error: unknown type name 'seqcount_raw_spinlock_t'
SEQCOUNT_LOCKTYPE(raw_spinlock_t, raw_spinlock, false, s->lock)
^
include/linux/seqlock.h:177:29: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
__seqcount_##lockname##_ptr(seqcount_##lockname##_t *s) \
^
<scratch space>:103:1: note: expanded from here
seqcount_raw_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:213:1: error: unknown type name 'seqcount_raw_spinlock_t'
include/linux/seqlock.h:183:37: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
__seqcount_##lockname##_preemptible(seqcount_##lockname##_t *s) \
^
<scratch space>:107:1: note: expanded from here
seqcount_raw_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:213:1: error: unknown type name 'seqcount_raw_spinlock_t'
include/linux/seqlock.h:189:32: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
__seqcount_##lockname##_assert(seqcount_##lockname##_t *s) \
^
<scratch space>:111:1: note: expanded from here
seqcount_raw_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
>> include/linux/seqlock.h:751:17: error: implicit declaration of function '__seqcount_ptr' [-Werror,-Wimplicit-function-declaration]
unsigned ret = read_seqcount_begin(&sl->seqcount);
^
include/linux/seqlock.h:306:24: note: expanded from macro 'read_seqcount_begin'
read_seqcount_t_begin(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:241:15: note: expanded from macro '__seqprop'
seqcount_t: __seqcount_##prop((void *)(s)), \
^
<scratch space>:184:1: note: expanded from here
__seqcount_ptr
^
include/linux/seqlock.h:751:17: note: did you mean '__seqcount_init'?
include/linux/seqlock.h:306:24: note: expanded from macro 'read_seqcount_begin'
read_seqcount_t_begin(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:241:15: note: expanded from macro '__seqprop'
seqcount_t: __seqcount_##prop((void *)(s)), \
^
<scratch space>:184:1: note: expanded from here
__seqcount_ptr
^
include/linux/seqlock.h:71:20: note: '__seqcount_init' declared here
static inline void __seqcount_init(seqcount_t *s, const char *name,
^
include/linux/seqlock.h:751:17: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
unsigned ret = read_seqcount_begin(&sl->seqcount);
^
include/linux/seqlock.h:306:24: note: expanded from macro 'read_seqcount_begin'
read_seqcount_t_begin(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:242:2: note: expanded from macro '__seqprop'
__seqprop_case((s), raw_spinlock, prop), \
^
include/linux/seqlock.h:238:2: note: expanded from macro '__seqprop_case'
seqcount_##lockname##_t: __seqcount_##lockname##_##prop((void *)(s))
^
<scratch space>:186:1: note: expanded from here
seqcount_raw_spinlock_t
^
include/linux/seqlock.h:214:1: note: 'seqcount_spinlock_t' declared here
SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
^
include/linux/seqlock.h:174:3: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
} seqcount_##lockname##_t; \
^
<scratch space>:114:1: note: expanded from here
seqcount_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
include/linux/seqlock.h:777:9: error: implicit declaration of function '__seqcount_ptr' [-Werror,-Wimplicit-function-declaration]
return read_seqcount_retry(&sl->seqcount, start);
^
include/linux/seqlock.h:401:24: note: expanded from macro 'read_seqcount_retry'
read_seqcount_t_retry(__seqcount_ptr(s), start)
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:241:15: note: expanded from macro '__seqprop'
seqcount_t: __seqcount_##prop((void *)(s)), \
^
<scratch space>:210:1: note: expanded from here
__seqcount_ptr
^
In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from include/linux/crypto.h:20:
In file included from include/linux/slab.h:15:
In file included from include/linux/gfp.h:6:
In file included from include/linux/mmzone.h:16:
include/linux/seqlock.h:777:9: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
include/linux/seqlock.h:401:24: note: expanded from macro 'read_seqcount_retry'
read_seqcount_t_retry(__seqcount_ptr(s), start)
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:242:2: note: expanded from macro '__seqprop'
__seqprop_case((s), raw_spinlock, prop), \
^
include/linux/seqlock.h:238:2: note: expanded from macro '__seqprop_case'
seqcount_##lockname##_t: __seqcount_##lockname##_##prop((void *)(s))
^
<scratch space>:212:1: note: expanded from here
seqcount_raw_spinlock_t
^
include/linux/seqlock.h:214:1: note: 'seqcount_spinlock_t' declared here
SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
^
include/linux/seqlock.h:174:3: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
} seqcount_##lockname##_t; \
^
<scratch space>:114:1: note: expanded from here
seqcount_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:10:
In file included from include/linux/sched.h:20:
>> include/linux/hrtimer.h:163:2: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
seqcount_raw_spinlock_t seq;
^~~~~~~~~~~~~~~~~~~~~~~
seqcount_spinlock_t
include/linux/seqlock.h:214:1: note: 'seqcount_spinlock_t' declared here
SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
^
include/linux/seqlock.h:174:3: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
} seqcount_##lockname##_t; \
^
<scratch space>:114:1: note: expanded from here
seqcount_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:13:
>> include/linux/rbtree_latch.h:148:2: error: implicit declaration of function '__seqcount_ptr' [-Werror,-Wimplicit-function-declaration]
raw_write_seqcount_latch(&root->seq);
^
include/linux/seqlock.h:696:29: note: expanded from macro 'raw_write_seqcount_latch'
raw_write_seqcount_t_latch(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:241:15: note: expanded from macro '__seqprop'
seqcount_t: __seqcount_##prop((void *)(s)), \
^
<scratch space>:23:1: note: expanded from here
__seqcount_ptr
^
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:13:
>> include/linux/rbtree_latch.h:148:2: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
include/linux/seqlock.h:696:29: note: expanded from macro 'raw_write_seqcount_latch'
raw_write_seqcount_t_latch(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:242:2: note: expanded from macro '__seqprop'
__seqprop_case((s), raw_spinlock, prop), \
^
include/linux/seqlock.h:238:2: note: expanded from macro '__seqprop_case'
seqcount_##lockname##_t: __seqcount_##lockname##_##prop((void *)(s))
^
<scratch space>:25:1: note: expanded from here
seqcount_raw_spinlock_t
^
include/linux/seqlock.h:214:1: note: 'seqcount_spinlock_t' declared here
SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
^
include/linux/seqlock.h:174:3: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
} seqcount_##lockname##_t; \
^
<scratch space>:114:1: note: expanded from here
seqcount_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:13:
include/linux/rbtree_latch.h:150:2: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
raw_write_seqcount_latch(&root->seq);
^
include/linux/seqlock.h:696:29: note: expanded from macro 'raw_write_seqcount_latch'
raw_write_seqcount_t_latch(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:242:2: note: expanded from macro '__seqprop'
__seqprop_case((s), raw_spinlock, prop), \
^
include/linux/seqlock.h:238:2: note: expanded from macro '__seqprop_case'
seqcount_##lockname##_t: __seqcount_##lockname##_##prop((void *)(s))
^
<scratch space>:51:1: note: expanded from here
seqcount_raw_spinlock_t
^
include/linux/seqlock.h:214:1: note: 'seqcount_spinlock_t' declared here
SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
^
include/linux/seqlock.h:174:3: note: expanded from macro 'SEQCOUNT_LOCKTYPE'
} seqcount_##lockname##_t; \
^
<scratch space>:114:1: note: expanded from here
seqcount_spinlock_t
^
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:13:
include/linux/rbtree_latch.h:175:2: error: implicit declaration of function '__seqcount_ptr' [-Werror,-Wimplicit-function-declaration]
raw_write_seqcount_latch(&root->seq);
^
include/linux/seqlock.h:696:29: note: expanded from macro 'raw_write_seqcount_latch'
raw_write_seqcount_t_latch(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:241:15: note: expanded from macro '__seqprop'
seqcount_t: __seqcount_##prop((void *)(s)), \
^
<scratch space>:75:1: note: expanded from here
__seqcount_ptr
^
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:13:
include/linux/rbtree_latch.h:175:2: error: unknown type name 'seqcount_raw_spinlock_t'; did you mean 'seqcount_spinlock_t'?
include/linux/seqlock.h:696:29: note: expanded from macro 'raw_write_seqcount_latch'
raw_write_seqcount_t_latch(__seqcount_ptr(s))
^
include/linux/seqlock.h:248:28: note: expanded from macro '__seqcount_ptr'
#define __seqcount_ptr(s) __seqprop(s, ptr)
^
include/linux/seqlock.h:242:2: note: expanded from macro '__seqprop'
__seqprop_case((s), raw_spinlock, prop), \
^

# https://github.com/0day-ci/linux/commit/360da27b2632939e5188f48d211b8a39cfdb8cde
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Randy-Dunlap/seqlock-linux-seqlock-h-fix-multiple-kernel-doc-warnings/20200817-062836
git checkout 360da27b2632939e5188f48d211b8a39cfdb8cde
vim +/inline +156 include/linux/seqlock.h

139
140 /**
141 * typedef seqcount_LOCKNAME_t - sequence counter with LOCKTYPE associated
142 * @seqcount: The real sequence counter
143 * @lock: Pointer to the associated spinlock
144 *
145 * A plain sequence counter with external writer synchronization by a
146 * spinlock. The spinlock is associated to the sequence count in the
147 * static initializer or init function. This enables lockdep to validate
148 * that the write side critical section is properly serialized.
149 */
150
151 /*
152 * seqcount_LOCKNAME_init() - runtime initializer for seqcount_LOCKNAME_t
153 * @s: Pointer to the seqcount_LOCKNAME_t instance
154 * @lock: Pointer to the associated LOCKTYPE
155 */
> 156 static __always_inline void \
> 157 seqcount_##lockname##_init(seqcount_##lockname##_t *s, locktype *lock) \
158 { \
159 seqcount_init(&s->seqcount); \
160 __SEQ_LOCK(s->lock = lock); \
161 } \
162
163 /*
164 * SEQCOUNT_LOCKTYPE() - Instantiate seqcount_LOCKNAME_t and helpers
165 * @locktype: actual typename
166 * @lockname: name
167 * @preemptible: preemptibility of above locktype
168 * @lockmember: argument for lockdep_assert_held()
169 */
170 #define SEQCOUNT_LOCKTYPE(locktype, lockname, preemptible, lockmember) \
171 typedef struct seqcount_##lockname { \
172 seqcount_t seqcount; \
173 __SEQ_LOCK(locktype *lock); \
174 } seqcount_##lockname##_t; \
175 \
176 static __always_inline seqcount_t * \
177 __seqcount_##lockname##_ptr(seqcount_##lockname##_t *s) \
178 { \
179 return &s->seqcount; \
180 } \
181 \
182 static __always_inline bool \
183 __seqcount_##lockname##_preemptible(seqcount_##lockname##_t *s) \
184 { \
185 return preemptible; \
186 } \
187 \
188 static __always_inline void \
189 __seqcount_##lockname##_assert(seqcount_##lockname##_t *s) \
190 { \
191 __SEQ_LOCK(lockdep_assert_held(lockmember)); \
192 }
193
194 /*
195 * __seqprop() for seqcount_t
196 */
197
198 static inline seqcount_t *__seqcount_ptr(seqcount_t *s)
199 {
200 return s;
201 }
202
203 static inline bool __seqcount_preemptible(seqcount_t *s)
204 {
205 return false;
206 }
207
208 static inline void __seqcount_assert(seqcount_t *s)
209 {
210 lockdep_assert_preemption_disabled();
211 }
212
> 213 SEQCOUNT_LOCKTYPE(raw_spinlock_t, raw_spinlock, false, s->lock)
214 SEQCOUNT_LOCKTYPE(spinlock_t, spinlock, false, s->lock)
215 SEQCOUNT_LOCKTYPE(rwlock_t, rwlock, false, s->lock)
216 SEQCOUNT_LOCKTYPE(struct mutex, mutex, true, s->lock)
217 SEQCOUNT_LOCKTYPE(struct ww_mutex, ww_mutex, true, &s->lock->base)
218

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip