Re: [RFC PATCH 6/8] preempt/dynamic: Provide preempt_schedule[_notrace]() static calls

From: Josh Poimboeuf
Date: Wed Jan 27 2021 - 11:35:48 EST


On Wed, Jan 27, 2021 at 05:19:02PM +0100, Peter Zijlstra wrote:
> On Wed, Jan 27, 2021 at 09:59:14AM -0600, Josh Poimboeuf wrote:
> > On Wed, Jan 27, 2021 at 12:27:09PM +0100, Peter Zijlstra wrote:
> > > On Wed, Jan 27, 2021 at 10:13:47AM +0100, Peter Zijlstra wrote:
> > > > On Tue, Jan 26, 2021 at 05:57:30PM -0600, Josh Poimboeuf wrote:
> > >
> > > > > Well, I hate it, but I'm not sure I have any better ideas. It should be
> > > > > possible to use kallsyms, instead of the rb-tree/register nonsense. Not
> > > > > sure about the performance impact though. Might be a good reason to
> > > > > speed up kallsyms!
> > > >
> > > > Oh right, let me see if I can make that work.
> > >
> > > Something like so compiles.. but it does make the whole thing depend on
> > > KALLSYMS_ALL, which is somewhat yuck.
> > >
> > > Also, kallsyms_lookup_name() is horrible, but not trivial to fix because
> > > of that compression scheme used.
> >
> > The KALLSYMS_ALL dependency doesn't bother me personally but I assume
> > some of the tinyconfig folks might not appreciate it being on
> > permanently.
>
> I suppose this ought to cure the _ALL thing.
>
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index 7ecd2ccba531..83586cc4d954 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -260,6 +260,12 @@ static int symbol_valid(const struct sym_entry *s)
> {
> const char *name = sym_name(s);
>
> + /*
> + * Always emit __SCK__ symbols for static_call_add_module().
> + */
> + if (!strncmp(name, "__SCK__", 7))
> + return 1;
> +
> /* if --all-symbols is not specified, then symbols outside the text
> * and inittext sections are discarded */
> if (!all_symbols) {

This made me LOL for some reason. I like it though.

What did you think about .static_call_tramp_key? I could whip up a
patch later unless you beat me to it.

--
Josh