diff mbox series

[10/14] KVM: x86: Remove unnecessary export of kvm_vcpu_is_reset_bsp()

Message ID 20221114095606.39785-11-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Remove unnecessary exported symbols | expand

Commit Message

Like Xu Nov. 14, 2022, 9:56 a.m. UTC
From: Like Xu <likexu@tencent.com>

Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
KVM x86's vendor modules. Move up the code block out of existing
callers' need.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/kvm/x86.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Sean Christopherson Dec. 1, 2022, 2:07 a.m. UTC | #1
On Mon, Nov 14, 2022, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
> KVM x86's vendor modules. Move up the code block out of existing
> callers' need.

Again, no.  kvm_vcpu_is_reset_bsp() is declared by kvm_vcpu_is_reset_bsp().  The
lack of "static" is the first clue, and the fact that KVM compiles without issue
today is the second clue.  EXPORT_SYMBOL_GPL() only affects resolving module
dependencies, it doesn't provide any information to the compiler about function
prototypes.

> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
>  arch/x86/kvm/x86.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index f325710a4f25..f3cb3e02bfa6 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -11496,6 +11496,11 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
>  	return static_call(kvm_x86_vcpu_precreate)(kvm);
>  }
>  
> +bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
> +{
> +	return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
> +}
> +
>  int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
>  {
>  	struct page *page;
> @@ -11993,12 +11998,6 @@ int kvm_arch_check_processor_compat(void *opaque)
>  	return ops->check_processor_compatibility();
>  }
>  
> -bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
> -{
> -	return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
> -}
> -EXPORT_SYMBOL_GPL(kvm_vcpu_is_reset_bsp);
> -
>  bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
>  {
>  	return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
> -- 
> 2.38.1
>
Paolo Bonzini Dec. 2, 2022, 6:31 p.m. UTC | #2
On 11/14/22 10:56, Like Xu wrote:
> 
> Don't export x86's kvm_vcpu_is_reset_bsp(), the helper isn't used by
> KVM x86's vendor modules. Move up the code block out of existing
> callers' need.

I'm not sure why to move the code up?

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f325710a4f25..f3cb3e02bfa6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -11496,6 +11496,11 @@  int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
 	return static_call(kvm_x86_vcpu_precreate)(kvm);
 }
 
+bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
+{
+	return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
+}
+
 int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
 {
 	struct page *page;
@@ -11993,12 +11998,6 @@  int kvm_arch_check_processor_compat(void *opaque)
 	return ops->check_processor_compatibility();
 }
 
-bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
-{
-	return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
-}
-EXPORT_SYMBOL_GPL(kvm_vcpu_is_reset_bsp);
-
 bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
 {
 	return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;