[rcu:rcu/next 35/35] kernel/rcu/tree.c:251:8: error: implicit declaration of function 'arch_atomic_add_return'; did you mean

From: kernel test robot
Date: Wed Jun 24 2020 - 15:43:43 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/next
head: 347acb93a34a6e4f312f8b9ec1afdb86d27858d2
commit: 347acb93a34a6e4f312f8b9ec1afdb86d27858d2 [35/35] rcu: Fixup noinstr warnings
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
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
git checkout 347acb93a34a6e4f312f8b9ec1afdb86d27858d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips

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

All errors (new ones prefixed by >>):

kernel/rcu/tree.c: In function 'rcu_dynticks_eqs_enter':
>> kernel/rcu/tree.c:251:8: error: implicit declaration of function 'arch_atomic_add_return'; did you mean 'atomic_add_return'? [-Werror=implicit-function-declaration]
251 | seq = arch_atomic_add_return(RCU_DYNTICK_CTRL_CTR, &rdp->dynticks);
| ^~~~~~~~~~~~~~~~~~~~~~
| atomic_add_return
kernel/rcu/tree.c: In function 'rcu_dynticks_eqs_exit':
>> kernel/rcu/tree.c:281:3: error: implicit declaration of function 'arch_atomic_andnot'; did you mean 'atomic_andnot'? [-Werror=implicit-function-declaration]
281 | arch_atomic_andnot(RCU_DYNTICK_CTRL_MASK, &rdp->dynticks);
| ^~~~~~~~~~~~~~~~~~
| atomic_andnot
kernel/rcu/tree.c: In function 'rcu_dynticks_curr_cpu_in_eqs':
>> kernel/rcu/tree.c:314:11: error: implicit declaration of function 'arch_atomic_read'; did you mean 'atomic_read'? [-Werror=implicit-function-declaration]
314 | return !(arch_atomic_read(&rdp->dynticks) & RCU_DYNTICK_CTRL_CTR);
| ^~~~~~~~~~~~~~~~
| atomic_read
cc1: some warnings being treated as errors

vim +251 kernel/rcu/tree.c

233
234 /*
235 * Record entry into an extended quiescent state. This is only to be
236 * called when not already in an extended quiescent state, that is,
237 * RCU is watching prior to the call to this function and is no longer
238 * watching upon return.
239 */
240 static noinstr void rcu_dynticks_eqs_enter(void)
241 {
242 struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
243 int seq;
244
245 /*
246 * CPUs seeing atomic_add_return() must see prior RCU read-side
247 * critical sections, and we also must force ordering with the
248 * next idle sojourn.
249 */
250 rcu_dynticks_task_trace_enter(); // Before ->dynticks update!
> 251 seq = arch_atomic_add_return(RCU_DYNTICK_CTRL_CTR, &rdp->dynticks);
252 // RCU is no longer watching. Better be in extended quiescent state!
253 WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
254 (seq & RCU_DYNTICK_CTRL_CTR));
255 /* Better not have special action (TLB flush) pending! */
256 WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
257 (seq & RCU_DYNTICK_CTRL_MASK));
258 }
259
260 /*
261 * Record exit from an extended quiescent state. This is only to be
262 * called from an extended quiescent state, that is, RCU is not watching
263 * prior to the call to this function and is watching upon return.
264 */
265 static noinstr void rcu_dynticks_eqs_exit(void)
266 {
267 struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
268 int seq;
269
270 /*
271 * CPUs seeing atomic_add_return() must see prior idle sojourns,
272 * and we also must force ordering with the next RCU read-side
273 * critical section.
274 */
275 seq = arch_atomic_add_return(RCU_DYNTICK_CTRL_CTR, &rdp->dynticks);
276 // RCU is now watching. Better not be in an extended quiescent state!
277 rcu_dynticks_task_trace_exit(); // After ->dynticks update!
278 WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) &&
279 !(seq & RCU_DYNTICK_CTRL_CTR));
280 if (seq & RCU_DYNTICK_CTRL_MASK) {
> 281 arch_atomic_andnot(RCU_DYNTICK_CTRL_MASK, &rdp->dynticks);
282 smp_mb__after_atomic(); /* _exit after clearing mask. */
283 }
284 }
285
286 /*
287 * Reset the current CPU's ->dynticks counter to indicate that the
288 * newly onlined CPU is no longer in an extended quiescent state.
289 * This will either leave the counter unchanged, or increment it
290 * to the next non-quiescent value.
291 *
292 * The non-atomic test/increment sequence works because the upper bits
293 * of the ->dynticks counter are manipulated only by the corresponding CPU,
294 * or when the corresponding CPU is offline.
295 */
296 static void rcu_dynticks_eqs_online(void)
297 {
298 struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
299
300 if (atomic_read(&rdp->dynticks) & RCU_DYNTICK_CTRL_CTR)
301 return;
302 atomic_add(RCU_DYNTICK_CTRL_CTR, &rdp->dynticks);
303 }
304
305 /*
306 * Is the current CPU in an extended quiescent state?
307 *
308 * No ordering, as we are sampling CPU-local information.
309 */
310 static __always_inline bool rcu_dynticks_curr_cpu_in_eqs(void)
311 {
312 struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
313
> 314 return !(arch_atomic_read(&rdp->dynticks) & RCU_DYNTICK_CTRL_CTR);
315 }
316

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

Attachment: .config.gz
Description: application/gzip