* [PATCH 0/3] KVM: x86: fix a couple of issues with Enlightened VMCS enablement
@ 2019-08-27 16:04 Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-27 16:04 UTC (permalink / raw)
To: kvm
Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Jim Mattson, Sean Christopherson, Roman Kagan
It was discovered that:
- hyperv_cpuid test fails on AMD
- hyperv_cpuid test crashes kernel on Intel when nested=0
The test itself is good, we need to fix the issues.
Vitaly Kuznetsov (3):
KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when
kvm_intel.nested is disabled
KVM: x86: svm: remove unneeded nested_enable_evmcs() hook
KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when
it is available
arch/x86/kvm/hyperv.c | 5 ++++-
arch/x86/kvm/svm.c | 17 ++---------------
arch/x86/kvm/vmx/vmx.c | 1 +
arch/x86/kvm/x86.c | 3 ++-
4 files changed, 9 insertions(+), 17 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled
2019-08-27 16:04 [PATCH 0/3] KVM: x86: fix a couple of issues with Enlightened VMCS enablement Vitaly Kuznetsov
@ 2019-08-27 16:04 ` Vitaly Kuznetsov
2019-08-27 17:09 ` Jim Mattson
2019-08-27 18:52 ` Radim Krčmář
2019-08-27 16:04 ` [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available Vitaly Kuznetsov
2 siblings, 2 replies; 10+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-27 16:04 UTC (permalink / raw)
To: kvm
Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Jim Mattson, Sean Christopherson, Roman Kagan
If kvm_intel is loaded with nested=0 parameter an attempt to perform
KVM_GET_SUPPORTED_HV_CPUID results in OOPS as nested_get_evmcs_version hook
in kvm_x86_ops is NULL (we assign it in nested_vmx_hardware_setup() and
this only happens in case nested is enabled).
Check that kvm_x86_ops->nested_get_evmcs_version is not NULL before
calling it. With this, we can remove the stub from svm as it is no
longer needed.
Fixes: e2e871ab2f02 ("x86/kvm/hyper-v: Introduce nested_get_evmcs_version() helper")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/hyperv.c | 5 ++++-
arch/x86/kvm/svm.c | 8 +-------
arch/x86/kvm/vmx/vmx.c | 1 +
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 58bf61b17431..3f5ad84853fb 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1785,7 +1785,7 @@ int kvm_vm_ioctl_hv_eventfd(struct kvm *kvm, struct kvm_hyperv_eventfd *args)
int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
struct kvm_cpuid_entry2 __user *entries)
{
- uint16_t evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu);
+ uint16_t evmcs_ver = 0;
struct kvm_cpuid_entry2 cpuid_entries[] = {
{ .function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS },
{ .function = HYPERV_CPUID_INTERFACE },
@@ -1797,6 +1797,9 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
};
int i, nent = ARRAY_SIZE(cpuid_entries);
+ if (kvm_x86_ops->nested_get_evmcs_version)
+ evmcs_ver = kvm_x86_ops->nested_get_evmcs_version(vcpu);
+
/* Skip NESTED_FEATURES if eVMCS is not supported */
if (!evmcs_ver)
--nent;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 572c7c4ca974..40175c42f116 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -7122,12 +7122,6 @@ static int svm_unregister_enc_region(struct kvm *kvm,
return ret;
}
-static uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu)
-{
- /* Not supported */
- return 0;
-}
-
static int nested_enable_evmcs(struct kvm_vcpu *vcpu,
uint16_t *vmcs_version)
{
@@ -7344,7 +7338,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
.mem_enc_unreg_region = svm_unregister_enc_region,
.nested_enable_evmcs = nested_enable_evmcs,
- .nested_get_evmcs_version = nested_get_evmcs_version,
+ .nested_get_evmcs_version = NULL,
.need_emulation_on_page_fault = svm_need_emulation_on_page_fault,
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 3c936e7366b9..c81e5210b159 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7812,6 +7812,7 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
.set_nested_state = NULL,
.get_vmcs12_pages = NULL,
.nested_enable_evmcs = NULL,
+ .nested_get_evmcs_version = NULL,
.need_emulation_on_page_fault = vmx_need_emulation_on_page_fault,
.apic_init_signal_blocked = vmx_apic_init_signal_blocked,
};
--
2.20.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook
2019-08-27 16:04 [PATCH 0/3] KVM: x86: fix a couple of issues with Enlightened VMCS enablement Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
@ 2019-08-27 16:04 ` Vitaly Kuznetsov
2019-08-27 16:57 ` Jim Mattson
2019-08-27 16:04 ` [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available Vitaly Kuznetsov
2 siblings, 1 reply; 10+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-27 16:04 UTC (permalink / raw)
To: kvm
Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Jim Mattson, Sean Christopherson, Roman Kagan
Since commit 5158917c7b019 ("KVM: x86: nVMX: Allow nested_enable_evmcs to
be NULL") the code in x86.c is prepared to see nested_enable_evmcs being
NULL and in VMX case it actually is when nesting is disabled. Remove the
unneeded stub from SVM code.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/svm.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 40175c42f116..6d52c65d625b 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -7122,13 +7122,6 @@ static int svm_unregister_enc_region(struct kvm *kvm,
return ret;
}
-static int nested_enable_evmcs(struct kvm_vcpu *vcpu,
- uint16_t *vmcs_version)
-{
- /* Intel-only feature */
- return -ENODEV;
-}
-
static bool svm_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
{
unsigned long cr4 = kvm_read_cr4(vcpu);
@@ -7337,7 +7330,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
.mem_enc_reg_region = svm_register_enc_region,
.mem_enc_unreg_region = svm_unregister_enc_region,
- .nested_enable_evmcs = nested_enable_evmcs,
+ .nested_enable_evmcs = NULL,
.nested_get_evmcs_version = NULL,
.need_emulation_on_page_fault = svm_need_emulation_on_page_fault,
--
2.20.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available
2019-08-27 16:04 [PATCH 0/3] KVM: x86: fix a couple of issues with Enlightened VMCS enablement Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook Vitaly Kuznetsov
@ 2019-08-27 16:04 ` Vitaly Kuznetsov
2019-08-27 16:54 ` Jim Mattson
2 siblings, 1 reply; 10+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-27 16:04 UTC (permalink / raw)
To: kvm
Cc: linux-kernel, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Jim Mattson, Sean Christopherson, Roman Kagan
It was discovered that after commit 65efa61dc0d5 ("selftests: kvm: provide
common function to enable eVMCS") hyperv_cpuid selftest is failing on AMD.
The reason is that the commit changed _vcpu_ioctl() to vcpu_ioctl() in the
test and this one can't fail.
Instead of fixing the test is seems to make more sense to not announce
KVM_CAP_HYPERV_ENLIGHTENED_VMCS support if it is definitely missing
(on svm and in case kvm_intel.nested=0).
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/kvm/x86.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d1cd0fcff9e7..ef2e8b138300 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3106,7 +3106,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_HYPERV_EVENTFD:
case KVM_CAP_HYPERV_TLBFLUSH:
case KVM_CAP_HYPERV_SEND_IPI:
- case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
case KVM_CAP_HYPERV_CPUID:
case KVM_CAP_PCI_SEGMENT:
case KVM_CAP_DEBUGREGS:
@@ -3183,6 +3182,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = kvm_x86_ops->get_nested_state ?
kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
break;
+ case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
+ r = kvm_x86_ops->nested_enable_evmcs != NULL;
default:
break;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available
2019-08-27 16:04 ` [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available Vitaly Kuznetsov
@ 2019-08-27 16:54 ` Jim Mattson
2019-08-27 19:52 ` Sean Christopherson
0 siblings, 1 reply; 10+ messages in thread
From: Jim Mattson @ 2019-08-27 16:54 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm list, LKML, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Sean Christopherson, Roman Kagan
On Tue, Aug 27, 2019 at 9:04 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> It was discovered that after commit 65efa61dc0d5 ("selftests: kvm: provide
> common function to enable eVMCS") hyperv_cpuid selftest is failing on AMD.
> The reason is that the commit changed _vcpu_ioctl() to vcpu_ioctl() in the
> test and this one can't fail.
>
> Instead of fixing the test is seems to make more sense to not announce
> KVM_CAP_HYPERV_ENLIGHTENED_VMCS support if it is definitely missing
> (on svm and in case kvm_intel.nested=0).
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/kvm/x86.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d1cd0fcff9e7..ef2e8b138300 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3106,7 +3106,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_HYPERV_EVENTFD:
> case KVM_CAP_HYPERV_TLBFLUSH:
> case KVM_CAP_HYPERV_SEND_IPI:
> - case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
> case KVM_CAP_HYPERV_CPUID:
> case KVM_CAP_PCI_SEGMENT:
> case KVM_CAP_DEBUGREGS:
> @@ -3183,6 +3182,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> r = kvm_x86_ops->get_nested_state ?
> kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
> break;
> + case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
> + r = kvm_x86_ops->nested_enable_evmcs != NULL;
You should probably have an explicit break here, in case someone later
adds another case below.
> default:
> break;
> }
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook
2019-08-27 16:04 ` [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook Vitaly Kuznetsov
@ 2019-08-27 16:57 ` Jim Mattson
0 siblings, 0 replies; 10+ messages in thread
From: Jim Mattson @ 2019-08-27 16:57 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm list, LKML, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Sean Christopherson, Roman Kagan
On Tue, Aug 27, 2019 at 9:04 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> Since commit 5158917c7b019 ("KVM: x86: nVMX: Allow nested_enable_evmcs to
> be NULL") the code in x86.c is prepared to see nested_enable_evmcs being
> NULL and in VMX case it actually is when nesting is disabled. Remove the
> unneeded stub from SVM code.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
@ 2019-08-27 17:09 ` Jim Mattson
2019-08-27 18:52 ` Radim Krčmář
1 sibling, 0 replies; 10+ messages in thread
From: Jim Mattson @ 2019-08-27 17:09 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm list, LKML, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Sean Christopherson, Roman Kagan
On Tue, Aug 27, 2019 at 9:04 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> If kvm_intel is loaded with nested=0 parameter an attempt to perform
> KVM_GET_SUPPORTED_HV_CPUID results in OOPS as nested_get_evmcs_version hook
> in kvm_x86_ops is NULL (we assign it in nested_vmx_hardware_setup() and
> this only happens in case nested is enabled).
>
> Check that kvm_x86_ops->nested_get_evmcs_version is not NULL before
> calling it. With this, we can remove the stub from svm as it is no
> longer needed.
>
> Fixes: e2e871ab2f02 ("x86/kvm/hyper-v: Introduce nested_get_evmcs_version() helper")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
2019-08-27 17:09 ` Jim Mattson
@ 2019-08-27 18:52 ` Radim Krčmář
1 sibling, 0 replies; 10+ messages in thread
From: Radim Krčmář @ 2019-08-27 18:52 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: kvm, linux-kernel, Paolo Bonzini, Joerg Roedel, Jim Mattson,
Sean Christopherson, Roman Kagan, stable
2019-08-27 18:04+0200, Vitaly Kuznetsov:
> If kvm_intel is loaded with nested=0 parameter an attempt to perform
> KVM_GET_SUPPORTED_HV_CPUID results in OOPS as nested_get_evmcs_version hook
> in kvm_x86_ops is NULL (we assign it in nested_vmx_hardware_setup() and
> this only happens in case nested is enabled).
>
> Check that kvm_x86_ops->nested_get_evmcs_version is not NULL before
> calling it. With this, we can remove the stub from svm as it is no
> longer needed.
>
Added
Cc: <stable@vger.kernel.org>
> Fixes: e2e871ab2f02 ("x86/kvm/hyper-v: Introduce nested_get_evmcs_version() helper")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
and applied, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available
2019-08-27 16:54 ` Jim Mattson
@ 2019-08-27 19:52 ` Sean Christopherson
2019-08-28 7:30 ` Vitaly Kuznetsov
0 siblings, 1 reply; 10+ messages in thread
From: Sean Christopherson @ 2019-08-27 19:52 UTC (permalink / raw)
To: Jim Mattson
Cc: Vitaly Kuznetsov, kvm list, LKML, Paolo Bonzini,
Radim Krčmář,
Joerg Roedel, Roman Kagan
On Tue, Aug 27, 2019 at 09:54:39AM -0700, Jim Mattson wrote:
> On Tue, Aug 27, 2019 at 9:04 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
> >
> > It was discovered that after commit 65efa61dc0d5 ("selftests: kvm: provide
> > common function to enable eVMCS") hyperv_cpuid selftest is failing on AMD.
> > The reason is that the commit changed _vcpu_ioctl() to vcpu_ioctl() in the
> > test and this one can't fail.
> >
> > Instead of fixing the test is seems to make more sense to not announce
> > KVM_CAP_HYPERV_ENLIGHTENED_VMCS support if it is definitely missing
> > (on svm and in case kvm_intel.nested=0).
> >
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> > ---
> > arch/x86/kvm/x86.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index d1cd0fcff9e7..ef2e8b138300 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -3106,7 +3106,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> > case KVM_CAP_HYPERV_EVENTFD:
> > case KVM_CAP_HYPERV_TLBFLUSH:
> > case KVM_CAP_HYPERV_SEND_IPI:
> > - case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
> > case KVM_CAP_HYPERV_CPUID:
> > case KVM_CAP_PCI_SEGMENT:
> > case KVM_CAP_DEBUGREGS:
> > @@ -3183,6 +3182,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> > r = kvm_x86_ops->get_nested_state ?
> > kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
> > break;
> > + case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
> > + r = kvm_x86_ops->nested_enable_evmcs != NULL;
>
> You should probably have an explicit break here, in case someone later
> adds another case below.
Yep, this will trigger a warning on compilers with -Wimplicit-fallthrough.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available
2019-08-27 19:52 ` Sean Christopherson
@ 2019-08-28 7:30 ` Vitaly Kuznetsov
0 siblings, 0 replies; 10+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-28 7:30 UTC (permalink / raw)
To: Sean Christopherson, Jim Mattson
Cc: kvm list, LKML, Paolo Bonzini, Radim Krčmář,
Joerg Roedel, Roman Kagan
Sean Christopherson <sean.j.christopherson@intel.com> writes:
> On Tue, Aug 27, 2019 at 09:54:39AM -0700, Jim Mattson wrote:
>> On Tue, Aug 27, 2019 at 9:04 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>> >
>> > It was discovered that after commit 65efa61dc0d5 ("selftests: kvm: provide
>> > common function to enable eVMCS") hyperv_cpuid selftest is failing on AMD.
>> > The reason is that the commit changed _vcpu_ioctl() to vcpu_ioctl() in the
>> > test and this one can't fail.
>> >
>> > Instead of fixing the test is seems to make more sense to not announce
>> > KVM_CAP_HYPERV_ENLIGHTENED_VMCS support if it is definitely missing
>> > (on svm and in case kvm_intel.nested=0).
>> >
>> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> > ---
>> > arch/x86/kvm/x86.c | 3 ++-
>> > 1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> > index d1cd0fcff9e7..ef2e8b138300 100644
>> > --- a/arch/x86/kvm/x86.c
>> > +++ b/arch/x86/kvm/x86.c
>> > @@ -3106,7 +3106,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>> > case KVM_CAP_HYPERV_EVENTFD:
>> > case KVM_CAP_HYPERV_TLBFLUSH:
>> > case KVM_CAP_HYPERV_SEND_IPI:
>> > - case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
>> > case KVM_CAP_HYPERV_CPUID:
>> > case KVM_CAP_PCI_SEGMENT:
>> > case KVM_CAP_DEBUGREGS:
>> > @@ -3183,6 +3182,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>> > r = kvm_x86_ops->get_nested_state ?
>> > kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
>> > break;
>> > + case KVM_CAP_HYPERV_ENLIGHTENED_VMCS:
>> > + r = kvm_x86_ops->nested_enable_evmcs != NULL;
>>
>> You should probably have an explicit break here, in case someone later
>> adds another case below.
>
> Yep, this will trigger a warning on compilers with -Wimplicit-fallthrough.
I always forget there's more than checkpatch.pl :-) Thanks you your
reviews guys, I'm going to send v2 of this patchset without PATCH1 which
was already queued by Radim.
--
Vitaly
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-08-28 7:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 16:04 [PATCH 0/3] KVM: x86: fix a couple of issues with Enlightened VMCS enablement Vitaly Kuznetsov
2019-08-27 16:04 ` [PATCH 1/3] KVM: x86: hyper-v: don't crash on KVM_GET_SUPPORTED_HV_CPUID when kvm_intel.nested is disabled Vitaly Kuznetsov
2019-08-27 17:09 ` Jim Mattson
2019-08-27 18:52 ` Radim Krčmář
2019-08-27 16:04 ` [PATCH 2/3] KVM: x86: svm: remove unneeded nested_enable_evmcs() hook Vitaly Kuznetsov
2019-08-27 16:57 ` Jim Mattson
2019-08-27 16:04 ` [PATCH 3/3] KVM: x86: announce KVM_CAP_HYPERV_ENLIGHTENED_VMCS support only when it is available Vitaly Kuznetsov
2019-08-27 16:54 ` Jim Mattson
2019-08-27 19:52 ` Sean Christopherson
2019-08-28 7:30 ` Vitaly Kuznetsov
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).