Re: [rcu:rcu/next 78/83] kernel/rcu/tasks.h:740:8: error: type defaults to 'int' in declaration of 'DEFINE_IRQ_WORK'

From: Paul E. McKenney
Date: Mon Mar 23 2020 - 14:23:52 EST


On Mon, Mar 23, 2020 at 01:26:49PM +0800, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/next
> head: 72f26c3be409e0ccd52a48e7f5ffbdbb5cd0a960
> commit: f7f9f5b97a87a31d90fe254f6e685b67e0b378a9 [78/83] rcu-tasks: Allow rcu_read_unlock_trace() under scheduler locks
> config: m68k-allmodconfig (attached as .config)
> compiler: m68k-linux-gcc (GCC) 9.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 f7f9f5b97a87a31d90fe254f6e685b67e0b378a9
> # save the attached .config to linux build tree
> GCC_VERSION=9.2.0 make.cross ARCH=m68k
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>

I believe I have this fixed via a #include of linux/irq_work.h, which I
will fold into the original patch.

Thank you for finding this!

Thanx, Paul

> All error/warnings (new ones prefixed by >>):
>
> In file included from kernel/rcu/update.c:562:
> >> kernel/rcu/tasks.h:736:39: warning: 'struct irq_work' declared inside parameter list will not be visible outside of this definition or declaration
> 736 | static void rcu_read_unlock_iw(struct irq_work *iwp)
> | ^~~~~~~~
> >> kernel/rcu/tasks.h:740:8: error: type defaults to 'int' in declaration of 'DEFINE_IRQ_WORK' [-Werror=implicit-int]
> 740 | static DEFINE_IRQ_WORK(rcu_tasks_trace_iw, rcu_read_unlock_iw);
> | ^~~~~~~~~~~~~~~
> >> kernel/rcu/tasks.h:740:1: warning: parameter names (without types) in function declaration
> 740 | static DEFINE_IRQ_WORK(rcu_tasks_trace_iw, rcu_read_unlock_iw);
> | ^~~~~~
> kernel/rcu/tasks.h: In function 'rcu_read_unlock_trace_special':
> >> kernel/rcu/tasks.h:751:3: error: implicit declaration of function 'irq_work_queue'; did you mean 'drain_workqueue'? [-Werror=implicit-function-declaration]
> 751 | irq_work_queue(&rcu_tasks_trace_iw);
> | ^~~~~~~~~~~~~~
> | drain_workqueue
> >> kernel/rcu/tasks.h:751:19: error: 'rcu_tasks_trace_iw' undeclared (first use in this function); did you mean 'rcu_tasks_trace_qs'?
> 751 | irq_work_queue(&rcu_tasks_trace_iw);
> | ^~~~~~~~~~~~~~~~~~
> | rcu_tasks_trace_qs
> kernel/rcu/tasks.h:751:19: note: each undeclared identifier is reported only once for each function it appears in
> kernel/rcu/update.c: At top level:
> kernel/rcu/tasks.h:740:8: warning: 'DEFINE_IRQ_WORK' declared 'static' but never defined [-Wunused-function]
> 740 | static DEFINE_IRQ_WORK(rcu_tasks_trace_iw, rcu_read_unlock_iw);
> | ^~~~~~~~~~~~~~~
> kernel/rcu/tasks.h:736:13: warning: 'rcu_read_unlock_iw' defined but not used [-Wunused-function]
> 736 | static void rcu_read_unlock_iw(struct irq_work *iwp)
> | ^~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
> vim +740 kernel/rcu/tasks.h
>
> 727
> 728 void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
> 729 DEFINE_RCU_TASKS(rcu_tasks_trace, rcu_tasks_wait_gp, call_rcu_tasks_trace,
> 730 "RCU Tasks Trace");
> 731
> 732 /*
> 733 * This irq_work handler allows rcu_read_unlock_trace() to be invoked
> 734 * while the scheduler locks are held.
> 735 */
> > 736 static void rcu_read_unlock_iw(struct irq_work *iwp)
> 737 {
> 738 wake_up(&trc_wait);
> 739 }
> > 740 static DEFINE_IRQ_WORK(rcu_tasks_trace_iw, rcu_read_unlock_iw);
> 741
> 742 /* If we are the last reader, wake up the grace-period kthread. */
> 743 void rcu_read_unlock_trace_special(struct task_struct *t, int nesting)
> 744 {
> 745 if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB) &&
> 746 t->trc_reader_special.b.need_mb)
> 747 smp_mb(); // Pairs with update-side barriers.
> 748 WRITE_ONCE(t->trc_reader_nesting, nesting);
> 749 WRITE_ONCE(t->trc_reader_special.b.need_qs, false);
> 750 if (atomic_dec_and_test(&trc_n_readers_need_end))
> > 751 irq_work_queue(&rcu_tasks_trace_iw);
> 752 }
> 753 EXPORT_SYMBOL_GPL(rcu_read_unlock_trace_special);
> 754
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx