Re: [tip:WIP.x86/apic 40/43] arch/x86/kernel/irq.o:(__tracepoints+0x170): undefined reference to `trace_resched_ipi_reg'

From: Thomas Gleixner
Date: Fri Aug 25 2017 - 08:26:29 EST


On Fri, 25 Aug 2017, Thomas Gleixner wrote:

CC + Rostedt

> On Fri, 25 Aug 2017, kbuild test robot wrote:
>
> > Hi Thomas,
> >
> > It's probably a bug fix that unveils the link errors.
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/apic
> > head: 395b2c62edea5a2bb8a8786392feb12fae5917a7
> > commit: 902f1bb88397dd6769c98b2177bbda134b3a1ef2 [40/43] x86/idt: Deinline setup functions
> > config: i386-randconfig-s0-201734 (attached as .config)
> > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> > reproduce:
> > git checkout 902f1bb88397dd6769c98b2177bbda134b3a1ef2
> > # save the attached .config to linux build tree
> > make ARCH=i386
> >
> > All errors (new ones prefixed by >>):
> >
> > >> arch/x86/kernel/irq.o:(__tracepoints+0x170): undefined reference to `trace_resched_ipi_reg'
> > >> arch/x86/kernel/irq.o:(__tracepoints+0x174): undefined reference to `trace_resched_ipi_unreg'
> > arch/x86/kernel/irq.o:(__tracepoints+0x184): undefined reference to `trace_resched_ipi_reg'
> > arch/x86/kernel/irq.o:(__tracepoints+0x188): undefined reference to `trace_resched_ipi_unreg'
> >
>
> That link error is caused by the tracepoint code being stupid enough to
> generate tracepoint stuff in an object file whether they are used or not.
>
> The issue here is that the reschedule ipi tracepoint has an initializer
> function which is only compiled in when CONFIG_SMP=y.
>
> That tracepoint is not used in irq.o at all, but still the tracepoint macro
> hell generates something for it:
>
> objdump -t ../build-386/arch/x86/kernel/irq.o | grep resched
> 00000048 l O _ftrace_events 00000004 __event_reschedule_exit
> 00000a00 l O .data 0000004c event_reschedule_exit
> 0000004c l O _ftrace_events 00000004 __event_reschedule_entry
> 00000a60 l O .data 0000004c event_reschedule_entry
> 00000048 l O __tracepoints_ptrs 00000004 __tracepoint_ptr_reschedule_exit
> 00000188 l O __tracepoints_strings 00000010 __tpstrtab_reschedule_exit
> 0000004c l O __tracepoints_ptrs 00000004 __tracepoint_ptr_reschedule_entry
> 00000198 l O __tracepoints_strings 00000011 __tpstrtab_reschedule_entry
> 0000017c g O __tracepoints 00000014 __tracepoint_reschedule_entry
> 00000000 *UND* 00000000 trace_resched_ipi_reg
> 00000168 g O __tracepoints 00000014 __tracepoint_reschedule_exit
> 00000000 *UND* 00000000 trace_resched_ipi_unreg
>
> Brilliant stuff that. I'll hide the tracepoint behind a CONFIG_SMP ifdef
> for now.
>
> Thanks,
>
> tglx
>