LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV
@ 2018-05-25 15:36 Arnd Bergmann
2018-05-25 16:06 ` Vitaly Kuznetsov
2018-05-26 14:18 ` Radim Krčmář
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-05-25 15:36 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: Lan Tianyu, Arnd Bergmann, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Jim Mattson, Wanpeng Li, David Hildenbrand,
Vitaly Kuznetsov, kvm, linux-kernel
The global ms_hyperv variable is part of the hyperv support, so
we get a link error from accessing it in kernels that have this
turned off:
arch/x86/kvm/vmx.o: In function `alloc_loaded_vmcs':
vmx.c:(.text+0x1654a): undefined reference to `ms_hyperv'
vmx.c:(.text+0x1657a): undefined reference to `ms_hyperv'
This changes the condition to first check the compile-time
configuration symbol to avoid the link error.
Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kvm/vmx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ea098131dcce..e6d6ccab43c3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4232,7 +4232,8 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
goto out_vmcs;
memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE);
- if (static_branch_unlikely(&enable_evmcs) &&
+ if (IS_ENABLED(CONFIG_HYPERV) &&
+ static_branch_unlikely(&enable_evmcs) &&
(ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
struct hv_enlightened_vmcs *evmcs =
(struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;
--
2.9.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV
2018-05-25 15:36 [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV Arnd Bergmann
@ 2018-05-25 16:06 ` Vitaly Kuznetsov
2018-05-26 14:18 ` Radim Krčmář
1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2018-05-25 16:06 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Paolo Bonzini, Radim Krčmář,
Lan Tianyu, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Jim Mattson, Wanpeng Li, David Hildenbrand, kvm, linux-kernel
Arnd Bergmann <arnd@arndb.de> writes:
> The global ms_hyperv variable is part of the hyperv support, so
> we get a link error from accessing it in kernels that have this
> turned off:
>
> arch/x86/kvm/vmx.o: In function `alloc_loaded_vmcs':
> vmx.c:(.text+0x1654a): undefined reference to `ms_hyperv'
> vmx.c:(.text+0x1657a): undefined reference to `ms_hyperv'
>
> This changes the condition to first check the compile-time
> configuration symbol to avoid the link error.
>
> Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks,
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
(I don't really like this IS_ENABLED(CONFIG_HYPERV) spreading across KVM
but keeping stuff like this ms_hyperv structure defined when
!IS_ENABLED(CONFIG_HYPERV) is also ugly. It may make sense to define
helpers similar to kvm_para_has_feature() and define them to 'false'
when Hyper-V support code is compiled out. I'll look into this option
later, this patch should be taken to fix the immediate issue).
> ---
> arch/x86/kvm/vmx.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index ea098131dcce..e6d6ccab43c3 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -4232,7 +4232,8 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
> goto out_vmcs;
> memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE);
>
> - if (static_branch_unlikely(&enable_evmcs) &&
> + if (IS_ENABLED(CONFIG_HYPERV) &&
> + static_branch_unlikely(&enable_evmcs) &&
> (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
> struct hv_enlightened_vmcs *evmcs =
> (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;
--
Vitaly
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV
2018-05-25 15:36 [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV Arnd Bergmann
2018-05-25 16:06 ` Vitaly Kuznetsov
@ 2018-05-26 14:18 ` Radim Krčmář
1 sibling, 0 replies; 3+ messages in thread
From: Radim Krčmář @ 2018-05-26 14:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Paolo Bonzini, Lan Tianyu, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Jim Mattson, Wanpeng Li, David Hildenbrand,
Vitaly Kuznetsov, kvm, linux-kernel
2018-05-25 17:36+0200, Arnd Bergmann:
> The global ms_hyperv variable is part of the hyperv support, so
> we get a link error from accessing it in kernels that have this
> turned off:
>
> arch/x86/kvm/vmx.o: In function `alloc_loaded_vmcs':
> vmx.c:(.text+0x1654a): undefined reference to `ms_hyperv'
> vmx.c:(.text+0x1657a): undefined reference to `ms_hyperv'
>
> This changes the condition to first check the compile-time
> configuration symbol to avoid the link error.
>
> Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Queued, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-26 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 15:36 [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV Arnd Bergmann
2018-05-25 16:06 ` Vitaly Kuznetsov
2018-05-26 14:18 ` Radim Krčmář
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).