Skip to contentSkip to conversation

target/i386: kvm: add VMX migration blocker

PATCH In review Paolo Bonzini 3 participants 9 messages Nov 19, 2018 – Apr 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target/i386: kvm: add VMX migration blocker

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

---
 target/i386/kvm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
target/i386/kvm.c +12 -0
index f524e7d929..27dcca5365 100644
@@ -854,6 +854,7 @@ static int hyperv_init_vcpu(X86CPU *cpu)
 }
 
 static Error *invtsc_mig_blocker;
+static Error *vmx_mig_blocker;
 
 #define KVM_MAX_CPUID_ENTRIES  100
 
@@ -1246,6 +1247,17 @@ int kvm_arch_init_vcpu(CPUState *cs)
                                   !!(c->ecx & CPUID_EXT_SMX);
     }
 
+    if ((env->features[FEAT_1_ECX] & CPUID_EXT_VMX) && !vmx_mig_blocker) {
+        error_setg(&vmx_mig_blocker,
+                   "Nested VMX virtualization does not support live migration yet");
+        r = migrate_add_blocker(vmx_mig_blocker, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+            error_free(vmx_mig_blocker);
+            return r;
+        }
+    }
+
     if (env->mcg_cap & MCG_LMCE_P) {
         has_msr_mcg_ext_ctl = has_msr_feature_control = true;
     }
Signature · 1 line
2.19.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · * Paolo Bonzini ([email protected]) wrote:

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

Quoted 37 lines
---
 target/i386/kvm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
target/i386/kvm.c +12 -0
index f524e7d929..27dcca5365 100644
@@ -854,6 +854,7 @@ static int hyperv_init_vcpu(X86CPU *cpu)
 }
 
 static Error *invtsc_mig_blocker;
+static Error *vmx_mig_blocker;
 
 #define KVM_MAX_CPUID_ENTRIES  100
 
@@ -1246,6 +1247,17 @@ int kvm_arch_init_vcpu(CPUState *cs)
                                   !!(c->ecx & CPUID_EXT_SMX);
     }
 
+    if ((env->features[FEAT_1_ECX] & CPUID_EXT_VMX) && !vmx_mig_blocker) {
+        error_setg(&vmx_mig_blocker,
+                   "Nested VMX virtualization does not support live migration yet");
+        r = migrate_add_blocker(vmx_mig_blocker, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+            error_free(vmx_mig_blocker);
+            return r;
+        }
+    }
+
     if (env->mcg_cap & MCG_LMCE_P) {
         has_msr_mcg_ext_ctl = has_msr_feature_control = true;
     }
Signature · 1 line
2.19.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#2 lore raw
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Paolo Bonzini ([email protected]) wrote:

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Quoted 8 lines
Quoted 4 lines

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

Yes, of course.

Paolo

#3 lore raw
In reply to Dr. David Alan Gilbert
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Paolo Bonzini ([email protected]) wrote:

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Quoted 9 lines
Quoted 4 lines

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Any ideas on how to resolve this?

FYI it's the root of this bug though there's libvirt issues mixed in:
https://bugzilla.redhat.com/show_bug.cgi?id=1697997

Thanks,
Cole

#4 lore raw
Quoted 15 lines · Cole Robinson
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Paolo Bonzini ([email protected]) wrote:

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Quoted 9 lines
Quoted 4 lines

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

Quoted 7 lines

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Any ideas on how to resolve this?

I think the simplest solution is just to finish implementation of nested VMX live migration and backport it to Fedora 30.

Paolo

#5 lore raw
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines · Cole Robinson
Quoted 4 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Paolo Bonzini ([email protected]) wrote:

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Quoted 9 lines
Quoted 4 lines

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Quoted 5 lines
Quoted 1 line

Any ideas on how to resolve this?

I think the simplest solution is just to finish implementation of nested VMX live migration and backport it to Fedora 30.

That would simplify things :) Any guess on the timeframe? This is kernel work I presume?

If changes aren't landing in the near term I think we should disable nested VMX by default in Fedora, maybe just with modules.d/kvm.conf override. (Or revert this patch downstream, but I presume that's not a good idea).

The alternative of just letting it sit is going to generate a lot of complaints I suspect. And the only solutions will be 1) disable nested VMx for your whole machine and reboot, or 2) run this virt-xml command to disable VMX in your domain config... and probably forget that it's there and then a year later when this is all sorted out file a bug asking why nested virt isn't working for this one VM ;)

I guess #2 might not be avoidable anyways for the amount of people that have already opted into nested VMX

Thanks,
Cole

#6 lore raw

[Qemu-devel] R: Re: [PATCH v2] target/i386: kvm: add VMX migration blocker

----- Cole Robinson <[email protected]> ha scritto:

Quoted 23 lines · Paolo Bonzini
Quoted 22 lines · Cole Robinson
Quoted 21 lines · Dr. David Alan Gilbert
Quoted 13 lines · * Paolo Bonzini ([email protected]) wrote:
Quoted 7 lines

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Any ideas on how to resolve this?

I think the simplest solution is just to finish implementation of nested VMX live migration and backport it to Fedora 30.

That would simplify things :) Any guess on the timeframe? This is kernel work I presume?

No, the kernel part is already in. As a contingency plan, you could just revert this QEMU patch.

Paolo

Quoted 18 lines

If changes aren't landing in the near term I think we should disable nested VMX by default in Fedora, maybe just with modules.d/kvm.conf override. (Or revert this patch downstream, but I presume that's not a good idea).

The alternative of just letting it sit is going to generate a lot of complaints I suspect. And the only solutions will be 1) disable nested VMx for your whole machine and reboot, or 2) run this virt-xml command to disable VMX in your domain config... and probably forget that it's there and then a year later when this is all sorted out file a bug asking why nested virt isn't working for this one VM ;)

I guess #2 might not be avoidable anyways for the amount of people that have already opted into nested VMX

Thanks,
Cole

#7 lore raw

Re: [Qemu-devel] R: Re: [PATCH v2] target/i386: kvm: add VMX migration blocker

Quoted 27 lines · * Paolo Bonzini ([email protected]) wrote:

----- Cole Robinson <[email protected]> ha scritto:

Quoted 25 lines · Paolo Bonzini
Quoted 24 lines · Cole Robinson
Quoted 22 lines · Dr. David Alan Gilbert
Quoted 13 lines · * Paolo Bonzini ([email protected]) wrote:
Quoted 7 lines

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Any ideas on how to resolve this?

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I think the simplest solution is just to finish implementation of nested VMX live migration and backport it to Fedora 30.

That would simplify things :) Any guess on the timeframe? This is kernel work I presume?

No, the kernel part is already in. As a contingency plan, you could just revert this QEMU patch.

With a new-enough kernel, how hard is it to detect that this actual migration is safe?

Dave

Quoted 21 lines

Paolo

Quoted 18 lines

If changes aren't landing in the near term I think we should disable nested VMX by default in Fedora, maybe just with modules.d/kvm.conf override. (Or revert this patch downstream, but I presume that's not a good idea).

The alternative of just letting it sit is going to generate a lot of complaints I suspect. And the only solutions will be 1) disable nested VMx for your whole machine and reboot, or 2) run this virt-xml command to disable VMX in your domain config... and probably forget that it's there and then a year later when this is all sorted out file a bug asking why nested virt isn't working for this one VM ;)

I guess #2 might not be avoidable anyways for the amount of people that have already opted into nested VMX

Thanks,
Cole

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#8 lore raw

Re: [Qemu-devel] R: Re: [PATCH v2] target/i386: kvm: add VMX migration blocker

Quoted 32 lines · Dr. David Alan Gilbert
Quoted 31 lines · * Paolo Bonzini ([email protected]) wrote:

----- Cole Robinson <[email protected]> ha scritto:

Quoted 29 lines · Paolo Bonzini
Quoted 27 lines · Cole Robinson
Quoted 15 lines · Dr. David Alan Gilbert
Quoted 13 lines · * Paolo Bonzini ([email protected]) wrote:
Quoted 7 lines

Nested VMX does not support live migration yet. Add a blocker until that is worked out.

Nested SVM only does not support it, but unfortunately it is enabled by default for -cpu host so we cannot really disable it.

So I'm OK with this, but it does need a release note warning whenever it goes in, because it'll surprise those who've already enabled nesting but don't use it on all their VMs.

Quoted 7 lines

We are hitting this in Fedora 30. Now that nested VMX is enabled by default at the kernel level, and virt-manager/boxes will use the equivalent of -cpu host by default, libvirt managedsave (migrate to file) and virt-manager snapshots (savevm) are rejected for default created VMs on intel. That's quite unfortunate.

Any ideas on how to resolve this?

I think the simplest solution is just to finish implementation of nested VMX live migration and backport it to Fedora 30.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

That would simplify things :) Any guess on the timeframe? This is kernel work I presume?

No, the kernel part is already in. As a contingency plan, you could just revert this QEMU patch.

With a new-enough kernel, how hard is it to detect that this actual migration is safe?

Not hard, but it would fail whenever the KVM kernel module is loaded, so pretty much for all Linux guests.

Paolo