Re: [PATCH 1/1] kallsyms: print module name in %ps/S case when KALLSYMS is disabled

From: Petr Mladek
Date: Thu Feb 10 2022 - 03:20:00 EST


On Wed 2022-02-09 15:02:06, Luis Chamberlain wrote:
> On Wed, Feb 09, 2022 at 12:40:38PM +0100, Petr Mladek wrote:
> > > --- a/include/linux/kallsyms.h
> > > +++ b/include/linux/kallsyms.h
> > > @@ -163,6 +163,33 @@ static inline bool kallsyms_show_value(const struct cred *cred)
> > > return false;
> > > }
> > >
> > > +#ifdef CONFIG_MODULES
> > > +static inline int fill_minimal_module_info(char *sym, int size, unsigned long value)
> > > +{
> > > + struct module *mod;
> > > + unsigned long offset;
> > > + int ret = 0;
> > > +
> > > + preempt_disable();
> > > + mod = __module_address(value);
> > > + if (mod) {
> > > + offset = value - (unsigned long)mod->core_layout.base;
> > > + snprintf(sym, size - 1, "0x%lx+0x%lx [%s]",
> > > + (unsigned long)mod->core_layout.base, offset, mod->name);
> > > +
> > > + sym[size - 1] = '\0';
> > > + ret = 1;
> > > + }
> > > +
> > > + preempt_enable();
> > > + return ret;
> > > +}
> >
> > It looks too big for an inlined function. Anyway, we will need
> > something even more complex, see below.
>
> Interesting, these observations might apply to Vimal's work as well [0].
>
> [0] https://lkml.kernel.org/r/YgKyC4ZRud0JW1PF@xxxxxxxxxxxxxxxxxxxxxx

Honestly, I am not sure what is the best practice. My understanding is
that inlined functions are used primary for speed up at runtime.

Anyway, there is the huge patchset that tries to optimize kernel build
time by optimizing headers, see
https://lore.kernel.org/lkml/YdIfz+LMewetSaEB@xxxxxxxxx/T/

This is from the cover letter:

<paste>
Techniques used by the fast-headers tree to reduce header size & dependencies:
[...]
- Uninlining: there's a number of unnecessary inline functions that also
couple otherwise unrelated headers to each other. The fast-headers tree
contains over 100 uninlining commits.
</paste>

It is probably less important for some local includes. I am not sure how
widely is kallsyms.h included.

Best Regards,
Petr