From 059091703401ef3029a1ffdbec8de97d5d5a1fd1 Mon Sep 17 00:00:00 2001 Message-Id: <059091703401ef3029a1ffdbec8de97d5d5a1fd1@dist-git> From: Jiri Denemark Date: Fri, 15 Nov 2019 17:52:36 +0100 Subject: [PATCH] cpu_map: Drop pconfig from Icelake-Server CPU model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel P. Berrangé (cherry picked from commit 9cd03f7957e114892ae54e7ccb3758b6fb440644) https://bugzilla.redhat.com/show_bug.cgi?id=1756156 https://bugzilla.redhat.com/show_bug.cgi?id=1721608 Conflicts: src/cpu_map/x86_Icelake-Server.xml - still monolithic cpu_map.xml downstream src/qemu/qemu_domain.h - context Signed-off-by: Jiri Denemark Message-Id: <6c06dac67da208e6ba8c07798c31405644acfb16.1573836581.git.jdenemar@redhat.com> Reviewed-by: Michal Privoznik --- src/cpu/cpu_map.xml | 1 - src/qemu/qemu_domain.c | 23 +++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_migration_cookie.c | 3 +++ .../x86_64-cpuid-Ice-Lake-Server-guest.xml | 1 - .../x86_64-cpuid-Ice-Lake-Server-host.xml | 11 +-------- .../x86_64-cpuid-Ice-Lake-Server-json.xml | 1 - 7 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml index acd9dad7dc..7b9f8bb452 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -2176,7 +2176,6 @@ - diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c9899b9e6d..f45d7d427e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7348,6 +7348,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, virDomainDefPtr def, @@ -7522,6 +7542,9 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, if (!(def->cpu = virCPUDefCopy(origCPU))) goto cleanup; } + + if (qemuDomainMakeCPUMigratable(def->cpu) < 0) + goto cleanup; } format: diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 8463a8b706..a29a678771 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1072,4 +1072,7 @@ char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv); virDomainEventResumedDetailType qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason); +int +qemuDomainMakeCPUMigratable(virCPUDefPtr cpu); + #endif /* __QEMU_DOMAIN_H__ */ diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index 60df449d53..c270896944 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -543,6 +543,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; diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml index 6ca2099b33..4676f3aa7d 100644 --- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml +++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-guest.xml @@ -32,5 +32,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml index 31af20bc85..35b9e39629 100644 --- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml +++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-host.xml @@ -1,6 +1,6 @@ x86_64 - Icelake-Client + Icelake-Server Intel @@ -21,23 +21,14 @@ - - - - - - - - - diff --git a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml index b043db58d7..ada11d2608 100644 --- a/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Ice-Lake-Server-json.xml @@ -13,5 +13,4 @@ - -- 2.24.0