public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@akamai.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: seanjc@google.com, kvm@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH v2 2/3] KVM: x86: introduce definitions to support static calls for kvm_x86_ops
Date: Fri, 15 Jan 2021 10:03:53 -0500	[thread overview]
Message-ID: <2e2cd2d9-e010-b435-3aba-35bac1b4cc14@akamai.com> (raw)
In-Reply-To: <84b2f5ba-1a16-cb01-646c-37e25d659650@redhat.com>



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

  reply	other threads:[~2021-01-15 15:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  3:27 [PATCH v2 0/3] Use static_call for kvm_x86_ops Jason Baron
2021-01-15  3:27 ` [PATCH v2 1/3] KVM: X86: append vmx/svm prefix to additional kvm_x86_ops functions Jason Baron
2021-01-15  9:22   ` Peter Zijlstra
2021-01-15 15:05     ` Jason Baron
2021-01-15  3:27 ` [PATCH v2 2/3] KVM: x86: introduce definitions to support static calls for kvm_x86_ops Jason Baron
2021-01-15  9:26   ` Peter Zijlstra
2021-01-15 13:50     ` Paolo Bonzini
2021-01-15 15:03       ` Jason Baron [this message]
2021-01-15  3:27 ` [PATCH v2 3/3] KVM: x86: use static calls to reduce kvm_x86_ops overhead Jason Baron
2021-01-15  9:45   ` Peter Zijlstra
2021-01-15  9:53     ` Peter Zijlstra
2021-01-15  9:54       ` Peter Zijlstra
2021-01-15 13:56     ` Paolo Bonzini
2021-01-26 16:47 ` [PATCH v2 0/3] Use static_call for kvm_x86_ops Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e2cd2d9-e010-b435-3aba-35bac1b4cc14@akamai.com \
    --to=jbaron@akamai.com \
    --cc=aarcange@redhat.com \
    --cc=bp@alien8.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox