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

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