> On Jun 7, 2019, at 1:49 AM, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote:
> 
>> On Fri, 7 Jun 2019 at 10:29, Peter Zijlstra <pet...@infradead.org> wrote:
>> 
>> On Thu, Jun 06, 2019 at 10:44:23PM +0000, Nadav Amit wrote:
>>>> + * Usage example:
>>>> + *
>>>> + *   # Start with the following functions (with identical prototypes):
>>>> + *   int func_a(int arg1, int arg2);
>>>> + *   int func_b(int arg1, int arg2);
>>>> + *
>>>> + *   # Define a 'my_key' reference, associated with func_a() by default
>>>> + *   DEFINE_STATIC_CALL(my_key, func_a);
>>>> + *
>>>> + *   # Call func_a()
>>>> + *   static_call(my_key, arg1, arg2);
>>>> + *
>>>> + *   # Update 'my_key' to point to func_b()
>>>> + *   static_call_update(my_key, func_b);
>>>> + *
>>>> + *   # Call func_b()
>>>> + *   static_call(my_key, arg1, arg2);
>>> 
>>> I think that this calling interface is not very intuitive.
>> 
>> Yeah, it is somewhat unfortunate..
>> 
> 
> Another thing I brought up at the time is that it would be useful to
> have the ability to 'reset' a static call to its default target. E.g.,
> for crypto modules that implement an accelerated version of a library
> interface, removing the module should revert those call sites back to
> the original target, without putting a disproportionate burden on the
> module itself to implement the logic to support this.

I was thinking this could be a layer on top.  We could have a way to register a 
static call with the module core so that, when a GPL module with an appropriate 
symbol is loaded, the static call gets replaced.

KVM could use this too.  Or we could just require KVM to be built in some day.

Reply via email to