cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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