thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-target-i386-kvm-Add-nested-migration-blocker-only-wh.patch

4ec855
From a99cae3466f0fae8a46c58f4e07ed6b6a481a0a5 Mon Sep 17 00:00:00 2001
4ec855
From: Paolo Bonzini <pbonzini@redhat.com>
4ec855
Date: Mon, 22 Jul 2019 18:22:17 +0100
4ec855
Subject: [PATCH 36/39] target/i386: kvm: Add nested migration blocker only
4ec855
 when kernel lacks required capabilities
4ec855
4ec855
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
4ec855
Message-id: <20190722182220.19374-16-pbonzini@redhat.com>
4ec855
Patchwork-id: 89632
4ec855
O-Subject: [RHEL-8.1.0 PATCH qemu-kvm v3 15/18] target/i386: kvm: Add nested migration blocker only when kernel lacks required capabilities
4ec855
Bugzilla: 1689269
4ec855
RH-Acked-by: Peter Xu <zhexu@redhat.com>
4ec855
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
4ec855
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4ec855
4ec855
From: Liran Alon <liran.alon@oracle.com>
4ec855
4ec855
Previous commits have added support for migration of nested virtualization
4ec855
workloads. This was done by utilising two new KVM capabilities:
4ec855
KVM_CAP_NESTED_STATE and KVM_CAP_EXCEPTION_PAYLOAD. Both which are
4ec855
required in order to correctly migrate such workloads.
4ec855
4ec855
Therefore, change code to add a migration blocker for vCPUs exposed with
4ec855
Intel VMX or AMD SVM in case one of these kernel capabilities is
4ec855
missing.
4ec855
4ec855
Signed-off-by: Liran Alon <liran.alon@oracle.com>
4ec855
Reviewed-by: Maran Wilson <maran.wilson@oracle.com>
4ec855
Message-Id: <20190619162140.133674-11-liran.alon@oracle.com>
4ec855
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4ec855
(cherry picked from commit 12604092e26cdace44c901bc429e7e4c7c3e0cab)
4ec855
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
4ec855
---
4ec855
 target/i386/kvm.c | 9 +++++++--
4ec855
 1 file changed, 7 insertions(+), 2 deletions(-)
4ec855
4ec855
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
4ec855
index aa2d589..0619aba 100644
4ec855
--- a/target/i386/kvm.c
4ec855
+++ b/target/i386/kvm.c
4ec855
@@ -1159,9 +1159,14 @@ int kvm_arch_init_vcpu(CPUState *cs)
4ec855
                                   !!(c->ecx & CPUID_EXT_SMX);
4ec855
     }
4ec855
 
4ec855
-    if (cpu_has_vmx(env) && !nested_virt_mig_blocker) {
4ec855
+    if (cpu_has_vmx(env) && !nested_virt_mig_blocker &&
4ec855
+        ((kvm_max_nested_state_length() <= 0) || !has_exception_payload)) {
4ec855
         error_setg(&nested_virt_mig_blocker,
4ec855
-                   "Nested virtualization does not support live migration yet");
4ec855
+                   "Kernel do not provide required capabilities for "
4ec855
+                   "nested virtualization migration. "
4ec855
+                   "(CAP_NESTED_STATE=%d, CAP_EXCEPTION_PAYLOAD=%d)",
4ec855
+                   kvm_max_nested_state_length() > 0,
4ec855
+                   has_exception_payload);
4ec855
         r = migrate_add_blocker(nested_virt_mig_blocker, &local_err);
4ec855
         if (local_err) {
4ec855
             error_report_err(local_err);
4ec855
-- 
4ec855
1.8.3.1
4ec855