Messages in this thread | | | Date | Mon, 7 Oct 2019 13:33:07 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH v2 00/13] Add static_call() |
| |
On Mon, Oct 07, 2019 at 10:27:08AM +0200, Peter Zijlstra wrote: > This series, which depends on the previous two, introduces static_call(). > > static_call(), is the idea of static_branch() applied to indirect function > calls. Remove a data load (indirection) by modifying the text. > > These patches are still based on the work Josh did earlier, but incorporated > feedback from the last posting and have a lot of extra patches which resulted > from me trying to actually use static_call(). > > This still relies on objtool to generate the .static_call_sites section, mostly > because this is a natural place for x86_64 and works for both GCC and LLVM. > Other architectures can pick other means if/when they implement the inline > patching. The out-of-line (aka. trampoline) variant doesn't require this. >
FWIW, Steve, if we were to do something like:
CFLAGS += -mfentry -mfentry_name=____static_call_fentry_tramp
And have:
struct static_call_key ____static_call_fentry = { .func = NULL, .next = 1, }; asm(".pushsection .static_call.text, \"ax\" \n" ".align 4 \n" ".globl ____static_call_fentry_tramp \n" "____static_call_fentry_tramp: \n" " ret \n" ".type ____static_call_fentry_tramp, @function \n" ".size ____static_call_fentry_tramp, . - ____static_call_fentry_tramp \n" ".popsection \n");
Then the whole function entry thing would automagicaly turn into something like static_cond_call(fentry)(...);
Not saying we should do that, but we could ;-)
| |