Re: [RFC PATCH 14/21] treewide: static_call: Pass call arguments to the macro

From: Peter Zijlstra
Date: Fri Apr 29 2022 - 19:21:59 EST


On Fri, Apr 29, 2022 at 01:36:37PM -0700, Sami Tolvanen wrote:
> Include the function arguments in the static call macro to make it
> possible to add a wrapper for the call. This is needed with
> CONFIG_CFI_CLANG to disable indirect call checking for static calls
> that are patched into direct calls at runtime.
>
> Users of static_call were updated using the following Coccinelle
> script and manually adjusted to preserve coding style:
>
> @@
> expression name;
> expression list args;
> identifier static_call =~ "^static_call(_mod|_cond)?$";
> @@
>
> - static_call(name)(args)
> + static_call(name, args)

Urgh, sadness.. I worked so hard to get away from that terrible syntax.

Can you explain why this is needed? I don't think there are any indirect
calls to get confused about. That is, if you have STATIC_CALL_INLINE
then the compiler should be emitting direct calls to the trampoline.

At no point will there be an indirect call.