Re: RCU: undefined reference to irq_work_queue

From: Hyeonggon Yoo
Date: Thu Mar 17 2022 - 11:55:00 EST


On Thu, Mar 17, 2022 at 11:22:28PM +0800, Zhouyi Zhou wrote:
> Hi,
>
> On Thu, Mar 17, 2022 at 8:48 PM Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> wrote:
> >
> > Hello RCU folks,
> >
> > I like to use minimal configuration for kernel development.
> > when building with tinyconfig + CONFIG_PREEMPT=y on arm64:
> I invoke cross compiler to reproduce the bug on my X86 machine
> $make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> CC=aarch64-linux-gnu-gcc-10 tinyconfig
> let CONFIG_PREEMPT=y in .config
> $make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
> CC=aarch64-linux-gnu-gcc-10 -j 16
> LD vmlinux
> aarch64-linux-gnu-ld: kernel/rcu/update.o: in function `call_rcu_tasks':
> update.c:(.text+0xb30): undefined reference to `irq_work_queue'
> update.c:(.text+0xb30): relocation truncated to fit: R_AARCH64_CALL26
> against undefined symbol `irq_work_queue'

Right. that was exactly what I faced :)

> >
> > ld: kernel/rcu/update.o: in function `call_rcu_tasks':
> > update.c:(.text+0xb2c): undefined reference to `irq_work_queue'
> > update.c:(.text+0xb2c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `irq_work_queue'
> > make: *** [Makefile:1155: vmlinux] Error 1
> >
> > It seems RCU calls irq_work_queue() without checking if CONFIG_IRQ_WORK is enabled.
> >
> > --
> > Thank you, You are awesome!
> > Hyeonggon :-)

> Meanwhile, there is no error for doing the same to build X86 kernel.
> I think the reason is:
> arch/x86/Kconfig select PERF_EVENT
> and PERF_EVENT select IRQ_WORK

Right. selecting anything that selects IRQ_WORK solves the problem.
Simply enabling printk also solves this.

> Hope my little research could provide some clues to solve the problem ;-)

Thank you for kind reply!

BTW, can we just fix this? (e.g. by conditionally compiling the problematic
code or always selecting IRQ_WORK)

> You are welcome
> Cheers
> Zhouyi

--
Thank you, You are awesome!
Hyeonggon :-)