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

From: Josh Poimboeuf
Date: Wed Jan 27 2021 - 11:06:10 EST


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.

Can DEFINE_STATIC_CALL() make the tramp-key association?

e.g. have DEFINE_STATIC_CALL() add an entry to .static_call_tramp_key
which has an array of

struct static_call_tramp_key {
unsigned int tramp; // PC-relative pointer to tramp
unsigned int key; // PC-relative pointer to key
}

and then just scan that instead of kallsyms.

--
Josh