lkml.org 
[lkml]   [2021]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/3] KVM: x86: introduce definitions to support static calls for kvm_x86_ops
From
Date


On 1/15/21 8:50 AM, Paolo Bonzini wrote:
> On 15/01/21 10:26, Peter Zijlstra wrote:
>>> +#define KVM_X86_OP(func)                         \
>>> +    DEFINE_STATIC_CALL_NULL(kvm_x86_##func,                 \
>>> +                *(((struct kvm_x86_ops *)0)->func));
>>> +#define KVM_X86_OP_NULL KVM_X86_OP
>>> +#include <asm/kvm-x86-ops.h>
>>> +EXPORT_STATIC_CALL_GPL(kvm_x86_get_cs_db_l_bits);
>>> +EXPORT_STATIC_CALL_GPL(kvm_x86_cache_reg);
>>> +EXPORT_STATIC_CALL_GPL(kvm_x86_tlb_flush_current);
>> Would something like:
>>
>>   
>> https://urldefense.com/v3/__https://lkml.kernel.org/r/20201110103909.GD2594@hirez.programming.kicks-ass.net__;!!GjvTz_vk!GbAPurpdyP1TaDRZN0NvvBkOLJhmRHzNtv0ZVIwZqNrJpMYze75mJzpUNJMRAg$
>>
>> Be useful? That way modules can call the static_call() but not change
>> it.
>>
>
> Maybe not in these cases, but in general there may be cases where we later want to change the static_call (for example replacing jump labels with
> static_calls).
>
> Paolo
>

I tried this out but got:

ERROR: modpost: "__SCK__kvm_x86_cache_reg" [arch/x86/kvm/kvm-amd.ko] undefined!
ERROR: modpost: "__SCK__kvm_x86_tlb_flush_current" [arch/x86/kvm/kvm-intel.ko] undefined!
ERROR: modpost: "__SCK__kvm_x86_get_cs_db_l_bits" [arch/x86/kvm/kvm-intel.ko] undefined!
ERROR: modpost: "__SCK__kvm_x86_cache_reg" [arch/x86/kvm/kvm-intel.ko] undefined!

I'm a bit confused because we have:

#define __static_call(name) \
({ \
__ADDRESSABLE(STATIC_CALL_KEY(name)); \
&STATIC_CALL_TRAMP(name); \
})

And so it looks to me like we need to still reference the key from the module code.

Thanks,

-Jason

\
 
 \ /
  Last update: 2021-01-15 16:06    [W:0.038 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site