KVM: VMX: Stub out enable_evmcs static key for CONFIG_HYPERV=n
authorSean Christopherson <seanjc@google.com>
Sat, 11 Feb 2023 00:35:33 +0000 (00:35 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Mar 2023 14:28:57 +0000 (10:28 -0400)
commit19f10315fd53599d8186aa46a0363b233292eb3d
treebb3ad465263d06bed265805dce9dcf782ed32cc5
parent68ac4221497b9a54f32c452a774ae747da908a81
KVM: VMX: Stub out enable_evmcs static key for CONFIG_HYPERV=n

Wrap enable_evmcs in a helper and stub it out when CONFIG_HYPERV=n in
order to eliminate the static branch nop placeholders.  clang-14 is clever
enough to elide the nop, but gcc-12 is not.  Stubbing out the key reduces
the size of kvm-intel.ko by ~7.5% (200KiB) when compiled with gcc-12
(there are a _lot_ of VMCS accesses throughout KVM).

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230211003534.564198-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/hyperv.c
arch/x86/kvm/vmx/hyperv.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx_ops.h