Re: objtool warning for next-20221118
From: Josh Poimboeuf
Date: Tue Nov 22 2022 - 00:16:17 EST
On Mon, Nov 21, 2022 at 06:52:15AM -0800, Paul E. McKenney wrote:
> On Mon, Nov 21, 2022 at 12:31:57PM +0100, Peter Zijlstra wrote:
> > On Sun, Nov 20, 2022 at 08:07:36PM -0800, Paul E. McKenney wrote:
> > > Hello!
> > >
> > > I have started getting this from rcutorture scenario TREE09:
> > >
> > > vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction
> > >
> > > Should I be worried?
> >
> > Typically not a scary warning that.
> >
> > > If so, please let me know what additional information you need.
> >
> > .config and compiler version so that I might recreate and observe what
> > it's complaining about would help :-)
>
> Fair enough! ;-)
>
> .config is attached, and the compiler versions are:
>
> gcc version 8.5.0 20210514 (Red Hat 8.5.0-15) (GCC)
> gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
>
> From an RCU perspective, the key points about TREE09's .config is
> CONFIG_PREEMPTION=y and CONFIG_SMP=n, but running on a single-CPU qemu
> instance.
It's complaining about an unreachable instruction after a call to
arch_cpu_idle_dead(). In this case objtool detects the fact
arch_cpu_idle_dead() doesn't return due to its call to the
non-CONFIG_SMP version of play_dead(). But GCC has no way of detecting
that because the caller is in another translation unit.
As far as I can tell, that function should never return. Though it
seems to have some dubious semantics (see xen_pv_play_dead() for
example, which *does* seem to return?). I'm thinking it would be an
improvement to enforce that noreturn behavior across all arches and
platforms, sprinkling __noreturn and BUG() on arch_cpu_idle_dead() and
maybe some of it callees, where needed.
Peter, what do you think? I could attempt a patch.
--
Josh