Re: [rcu:rcu/dev 48/48] kernel/rcu/tree_exp.h:407:3: note: in expansion of macro 'trace_printk'

From: Paul E. McKenney
Date: Thu Feb 01 2018 - 05:40:03 EST


On Thu, Feb 01, 2018 at 03:43:58PM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/dev
> head: 32860a6da7c75039afea229ba396aeac3b708d6b
> commit: 32860a6da7c75039afea229ba396aeac3b708d6b [48/48] EXP rcu: Add trace_printk()s to probe expedited CPU selection
> config: sparc64-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 32860a6da7c75039afea229ba396aeac3b708d6b
> # save the attached .config to linux build tree
> make.cross ARCH=sparc64
>
> All warnings (new ones prefixed by >>):

These should be fixed in later commits. Plus this is likely sacrificial
code anyway.

Thanx, Paul

> In file included from kernel/rcu/tree.c:31:0:
> kernel/rcu/tree_exp.h: In function 'sync_rcu_exp_select_cpus':
> kernel/rcu/tree_exp.h:407:16: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'int' [-Wformat=]
> trace_printk("%s rnp %d:%d first pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!rnp->exp_tasks);
> ^ ~~~~~~~~
> include/linux/kernel.h:634:33: note: in definition of macro '__trace_printk_check_format'
> ____trace_printk_check_format(fmt, ##args); \
> ^~~
> >> include/linux/kernel.h:671:3: note: in expansion of macro 'do_trace_printk'
> do_trace_printk(fmt, ##__VA_ARGS__); \
> ^~~~~~~~~~~~~~~
> >> kernel/rcu/tree_exp.h:407:3: note: in expansion of macro 'trace_printk'
> trace_printk("%s rnp %d:%d first pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!rnp->exp_tasks);
> ^~~~~~~~~~~~
> kernel/rcu/tree_exp.h:407:16: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'int' [-Wformat=]
> trace_printk("%s rnp %d:%d first pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!rnp->exp_tasks);
> ^ ~~~~~~~~
> include/linux/kernel.h:687:29: note: in definition of macro 'do_trace_printk'
> __trace_printk(_THIS_IP_, fmt, ##args); \
> ^~~
> >> kernel/rcu/tree_exp.h:407:3: note: in expansion of macro 'trace_printk'
> trace_printk("%s rnp %d:%d first pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!rnp->exp_tasks);
> ^~~~~~~~~~~~
> kernel/rcu/tree_exp.h:446:16: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'int' [-Wformat=]
> trace_printk("%s rnp %d:%d second pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!READ_ONCE(rnp->exp_tasks));
> ^
> include/linux/kernel.h:634:33: note: in definition of macro '__trace_printk_check_format'
> ____trace_printk_check_format(fmt, ##args); \
> ^~~
> >> include/linux/kernel.h:671:3: note: in expansion of macro 'do_trace_printk'
> do_trace_printk(fmt, ##__VA_ARGS__); \
> ^~~~~~~~~~~~~~~
> kernel/rcu/tree_exp.h:446:3: note: in expansion of macro 'trace_printk'
> trace_printk("%s rnp %d:%d second pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!READ_ONCE(rnp->exp_tasks));
> ^~~~~~~~~~~~
> kernel/rcu/tree_exp.h:446:16: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'int' [-Wformat=]
> trace_printk("%s rnp %d:%d second pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!READ_ONCE(rnp->exp_tasks));
> ^
> include/linux/kernel.h:687:29: note: in definition of macro 'do_trace_printk'
> __trace_printk(_THIS_IP_, fmt, ##args); \
> ^~~
> kernel/rcu/tree_exp.h:446:3: note: in expansion of macro 'trace_printk'
> trace_printk("%s rnp %d:%d second pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!READ_ONCE(rnp->exp_tasks));
> ^~~~~~~~~~~~
>
> vim +/trace_printk +407 kernel/rcu/tree_exp.h
>
> 363
> 364 /*
> 365 * Select the nodes that the upcoming expedited grace period needs
> 366 * to wait for.
> 367 */
> 368 static void sync_rcu_exp_select_cpus(struct rcu_state *rsp,
> 369 smp_call_func_t func)
> 370 {
> 371 int cpu;
> 372 unsigned long flags;
> 373 unsigned long mask_ofl_test;
> 374 unsigned long mask_ofl_ipi;
> 375 int ret;
> 376 struct rcu_node *rnp;
> 377
> 378 trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("reset"));
> 379 sync_exp_reset_tree(rsp);
> 380 trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("select"));
> 381 rcu_for_each_leaf_node(rsp, rnp) {
> 382 raw_spin_lock_irqsave_rcu_node(rnp, flags);
> 383
> 384 /* Each pass checks a CPU for identity, offline, and idle. */
> 385 mask_ofl_test = 0;
> 386 for_each_leaf_node_possible_cpu(rnp, cpu) {
> 387 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
> 388
> 389 rdp->exp_dynticks_snap =
> 390 rcu_dynticks_snap(rdp->dynticks);
> 391 if (raw_smp_processor_id() == cpu ||
> 392 rcu_dynticks_in_eqs(rdp->exp_dynticks_snap) ||
> 393 !(rnp->qsmaskinitnext & rdp->grpmask))
> 394 mask_ofl_test |= rdp->grpmask;
> 395 trace_printk("%s rnp %d:%d first pass CPU %d\n", __func__, rnp->grplo, rnp->grphi, cpu);
> 396 }
> 397 mask_ofl_ipi = rnp->expmask & ~mask_ofl_test;
> 398
> 399 /*
> 400 * Need to wait for any blocked tasks as well. Note that
> 401 * additional blocking tasks will also block the expedited
> 402 * GP until such time as the ->expmask bits are cleared.
> 403 */
> 404 if (rcu_preempt_has_tasks(rnp))
> 405 rnp->exp_tasks = rnp->blkd_tasks.next;
> 406 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> > 407 trace_printk("%s rnp %d:%d first pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!rnp->exp_tasks);
> 408
> 409 /* IPI the remaining CPUs for expedited quiescent state. */
> 410 for_each_leaf_node_possible_cpu(rnp, cpu) {
> 411 unsigned long mask = leaf_node_cpu_bit(rnp, cpu);
> 412 struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu);
> 413
> 414 if (!(mask_ofl_ipi & mask))
> 415 continue;
> 416 retry_ipi:
> 417 if (rcu_dynticks_in_eqs_since(rdp->dynticks,
> 418 rdp->exp_dynticks_snap)) {
> 419 mask_ofl_test |= mask;
> 420 continue;
> 421 }
> 422 ret = smp_call_function_single(cpu, func, rsp, 0);
> 423 if (!ret) {
> 424 mask_ofl_ipi &= ~mask;
> 425 continue;
> 426 }
> 427 /* Failed, raced with CPU hotplug operation. */
> 428 raw_spin_lock_irqsave_rcu_node(rnp, flags);
> 429 if ((rnp->qsmaskinitnext & mask) &&
> 430 (rnp->expmask & mask)) {
> 431 /* Online, so delay for a bit and try again. */
> 432 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> 433 trace_rcu_exp_grace_period(rsp->name, rcu_exp_gp_seq_endval(rsp), TPS("selectofl"));
> 434 schedule_timeout_uninterruptible(1);
> 435 goto retry_ipi;
> 436 }
> 437 /* CPU really is offline, so we can ignore it. */
> 438 if (!(rnp->expmask & mask))
> 439 mask_ofl_ipi &= ~mask;
> 440 raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> 441 }
> 442 /* Report quiescent states for those that went offline. */
> 443 mask_ofl_test |= mask_ofl_ipi;
> 444 if (mask_ofl_test)
> 445 rcu_report_exp_cpu_mult(rsp, rnp, mask_ofl_test, false);
> 446 trace_printk("%s rnp %d:%d second pass mask %#lx tasks %ld\n", __func__, rnp->grplo, rnp->grphi, mask_ofl_ipi, !!READ_ONCE(rnp->exp_tasks));
> 447 }
> 448 }
> 449
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation