]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_map: Drop pconfig from Icelake-Server CPU model
authorJiri Denemark <jdenemar@redhat.com>
Fri, 18 Oct 2019 12:33:00 +0000 (14:33 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 12 Nov 2019 19:14:16 +0000 (20:14 +0100)
The pconfig feature was enabled in QEMU by accident in 3.1.0. All other
newer versions do not support it and it was removed from the
Icelake-Server CPU model in QEMU.

We don't normally change our CPU models even when QEMU does so to avoid
breaking migrations between different versions of libvirt. But we can
safely do so in this specific case. QEMU never supported enabling
pconfig so any domain which was able to start has pconfig disabled.

With a small compatibility hack which explicitly disables pconfig when
CPU model equals Icelake-Server in migratable domain definition, only
one migration scenario stays broken (and there's nothing we can do about
it): from any host to a host with libvirt < 5.10.0 and QEMU > 3.1.0.

https://bugzilla.redhat.com/show_bug.cgi?id=1749672

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/cpu_map/x86_Icelake-Server.xml
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_migration_cookie.c
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml
tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml

index ecd21cf5c70759f809e3785554afa80b80b50d8d..a5653719771bf627a0454fa188f921f18f0bc9f3 100644 (file)
@@ -54,7 +54,6 @@
     <feature name='pat'/>
     <feature name='pcid'/>
     <feature name='pclmuldq'/>
-    <feature name='pconfig'/>
     <feature name='pdpe1gb'/>
     <feature name='pge'/>
     <feature name='pku'/>
index 9c517597bb6a5279165b041269c72b74d6f670ef..1d1683a0382873bbcd698331f9d84747ce30a1f7 100644 (file)
@@ -8910,6 +8910,26 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
 }
 
 
+int
+qemuDomainMakeCPUMigratable(virCPUDefPtr cpu)
+{
+    if (cpu->mode == VIR_CPU_MODE_CUSTOM &&
+        STREQ_NULLABLE(cpu->model, "Icelake-Server")) {
+        /* Originally Icelake-Server CPU model contained pconfig CPU feature.
+         * It was never actually enabled and thus it was removed. To enable
+         * migration to QEMU 3.1.0 (with both new and old libvirt), we
+         * explicitly disable pconfig in migration XML (otherwise old libvirt
+         * would think it was implicitly enabled on the source). New libvirt
+         * will drop it from the XML before starting the domain on new QEMU.
+         */
+        if (virCPUDefUpdateFeature(cpu, "pconfig", VIR_CPU_FEATURE_DISABLE) < 0)
+            return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
                                virQEMUCapsPtr qemuCaps,
@@ -9092,6 +9112,9 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
             if (!(def->cpu = virCPUDefCopy(origCPU)))
                 goto cleanup;
         }
+
+        if (qemuDomainMakeCPUMigratable(def->cpu) < 0)
+            goto cleanup;
     }
 
  format:
index 88d1acb64ff404b8c9d19cfc6c618585cc1fd1e2..ab00b257892977682c488f2113085836a021af00 100644 (file)
@@ -1225,3 +1225,6 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
 int
 qemuDomainSupportsCheckpointsBlockjobs(virDomainObjPtr vm)
     G_GNUC_WARN_UNUSED_RESULT;
+
+int
+qemuDomainMakeCPUMigratable(virCPUDefPtr cpu);
index 0bc0ee864d4e28c1acd8af5585f6481d3bb4f32f..6f567642424eb7d9c1b3dcfb40d0216998f99424 100644 (file)
@@ -535,6 +535,9 @@ qemuMigrationCookieAddCPU(qemuMigrationCookiePtr mig,
     if (!(mig->cpu = virCPUDefCopy(vm->def->cpu)))
         return -1;
 
+    if (qemuDomainMakeCPUMigratable(mig->cpu) < 0)
+        return -1;
+
     mig->flags |= QEMU_MIGRATION_COOKIE_CPU;
 
     return 0;
index 6ca2099b338569170349dcab755f9d0febaff39d..4676f3aa7dfcfabbb6b5b4ab25eb9958e57a3e48 100644 (file)
@@ -32,5 +32,4 @@
   <feature policy='require' name='rdctl-no'/>
   <feature policy='require' name='ibrs-all'/>
   <feature policy='require' name='skip-l1dfl-vmentry'/>
-  <feature policy='disable' name='pconfig'/>
 </cpu>
index 31af20bc852040b6cceaaa0ff7971891058280b1..35b9e39629442da6c2c2661f490c99f0cdac5dc8 100644 (file)
@@ -1,6 +1,6 @@
 <cpu>
   <arch>x86_64</arch>
-  <model>Icelake-Client</model>
+  <model>Icelake-Server</model>
   <vendor>Intel</vendor>
   <feature name='ds'/>
   <feature name='acpi'/>
   <feature name='osxsave'/>
   <feature name='tsc_adjust'/>
   <feature name='cmt'/>
-  <feature name='avx512f'/>
-  <feature name='avx512dq'/>
   <feature name='avx512ifma'/>
-  <feature name='clflushopt'/>
-  <feature name='clwb'/>
-  <feature name='avx512cd'/>
   <feature name='sha-ni'/>
-  <feature name='avx512bw'/>
-  <feature name='avx512vl'/>
   <feature name='ospke'/>
-  <feature name='la57'/>
   <feature name='stibp'/>
   <feature name='arch-capabilities'/>
   <feature name='xsaves'/>
   <feature name='mbm_total'/>
   <feature name='mbm_local'/>
-  <feature name='pdpe1gb'/>
   <feature name='invtsc'/>
   <feature name='rdctl-no'/>
   <feature name='ibrs-all'/>
index b043db58d745875dee815e9dfd9fcedba335768f..ada11d26085bd2efdf8b39b07d8781cf7ab44cdd 100644 (file)
@@ -13,5 +13,4 @@
   <feature policy='require' name='ibrs-all'/>
   <feature policy='require' name='skip-l1dfl-vmentry'/>
   <feature policy='disable' name='intel-pt'/>
-  <feature policy='disable' name='pconfig'/>
 </cpu>