Quoting Petr Mladek (2021-04-13 07:41:11)
> > diff --git a/lib/dump_stack.c b/lib/dump_stack.c
> > index f5a33b6f773f..d685331b065f 100644
> > --- a/lib/dump_stack.c
> > +++ b/lib/dump_stack.c
> > @@ -5,6 +5,7 @@
> >   */
> >  
> >  #include <linux/kernel.h>
> > +#include <linux/buildid.h>
> >  #include <linux/export.h>
> >  #include <linux/sched.h>
> >  #include <linux/sched/debug.h>
> > @@ -36,6 +37,14 @@ void __init dump_stack_set_arch_desc(const char *fmt, 
> > ...)
> >       va_end(args);
> >  }
> >  
> > +#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
> > +#define BUILD_ID_FMT " %20phN"
> > +#define BUILD_ID_VAL vmlinux_build_id
> > +#else
> > +#define BUILD_ID_FMT "%s"
> > +#define BUILD_ID_VAL ""
> > +#endif
> 
> 3rd patch always defines and initializes vmlinux_build_id. But it is
> used only when CONFIG_STACKTRACE_BUILD_ID is enabled.

It is also used for crash code.

> Is it intentional, please?

Yes, mostly for simplicity with the other user.

> 
> It is not a big deal for vmlinux_build_id. But it is more questionable
> for the per-module id. I am going to open this question for 5th patch
> as well.
> 

Right, for the vmlinux_build_id symbol it is not exported, and the whole
buildid.c file is part of lib-y, so if the symbol isn't used the linker
should drop it during link phase. I can drop the early init call if the
config is disabled and crash kernel code isn't enabled, and then rely on
the linker to drop the vmlinux_build_id symbol. Let me see if that can
work so that we don't have to parse it at boot if it is never used.

Reply via email to