[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40cb1de12da8742e32da03b50d7729b2eeec0a04.camel@redhat.com>
Date: Tue, 04 Dec 2018 18:44:44 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Edward Cree <ecree@...arflare.com>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net-next 1/4] indirect call wrappers: helpers to
speed-up indirect calls of builtin
On Tue, 2018-12-04 at 17:13 +0000, Edward Cree wrote:
> On 03/12/18 11:40, Paolo Abeni wrote:
> > This header define a bunch of helpers that allow avoiding the
> > retpoline overhead when calling builtin functions via function pointers.
> > It boils down to explicitly comparing the function pointers to
> > known builtin functions and eventually invoke directly the latter.
> >
> > The macros defined here implement the boilerplate for the above schema
> > and will be used by the next patches.
> >
> > rfc -> v1:
> > - use branch prediction hint, as suggested by Eric
> >
> > Suggested-by: Eric Dumazet <Eric Dumazet edumazet@...gle.com>
> > Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> > ---
> I'm not sure I see the reason why this is done with numbers and
> 'name ## NR', adding extra distance between the callsite and the
> list of callees. In particular it means that each callable needs
> to specify its index.
> Wouldn't it be simpler just to have
> #define 1(f, f1, ...) \
> (likely(f == f1) ? f1(__VA_ARGS__) : f(__VA_ARGS__))
> #define INDIRECT_CALL_2(f, f2, f1, ...) \
> (likely(f == f2) ? f2(__VA_ARGS__) : INDIRECT_CALL_1(f, f1, __VA_ARGS__))
> etc.? Removing the need for INDIRECT_CALLABLE_DECLARE_* entirely.
Thank you for the review!
As some of the builtin symbols are static, we would still need some
macro wrappers to properly specify the scope when retpoline is enabled.
Also, I think that f1, f2... declaration before INDIRECT_CALL_ would be
uglier, as we need to list there the function names (so we would have
the same list in 2 places).
Anyway this sounds really one thing that will enrage guys on lklm.
Suggestions for alternative solutions more than welcome ;)
> PS: this has reminded me of my desire to try runtime creation of
> these kinds of branch tables with self-modifying code
This:
https://lore.kernel.org/lkml/cover.1543200841.git.jpoimboe@redhat.com/T/#ma30f6b2aa655c99e93cfb267fef75b8fe9fca29b
is possibly related to what you are planning. AFAICS should work only
for global function pointers, not for e.g. function ptr inside lists,
so the above and this series should be complementary.
Cheers,
Paolo
Powered by blists - more mailing lists