[libvirt] [PATCH 0/4] Revert unacked patches

I accidentally pushed "qemu: Use migratable host CPU model from QEMU" series which was not completely ACKed yet. The first three patches were OK so I left them in the tree. The rest is reverted by this series. Jiri Denemark (4): Revert "cpu: Drop feature filtering from virCPUUpdate" Revert "qemu: Pass migratable host model to virCPUUpdate" Revert "qemu: Store migratable host CPU model in qemuCaps" Revert "qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct" src/cpu/cpu_x86.c | 9 ++- src/qemu/qemu_capabilities.c | 143 +++++++++++-------------------------------- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_process.c | 4 +- tests/cputest.c | 7 +-- 6 files changed, 46 insertions(+), 122 deletions(-) -- 2.12.2

This reverts commit 5f96b3feb6b345d3c3bfb68b05b16194ad3fea9d which was pushed accidentally. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu_x86.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 53359ff9b..a771b251e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2549,7 +2549,8 @@ x86Baseline(virCPUDefPtr *cpus, static int x86UpdateHostModel(virCPUDefPtr guest, - const virCPUDef *host) + const virCPUDef *host, + virCPUx86MapPtr map) { virCPUDefPtr updated = NULL; size_t i; @@ -2558,9 +2559,11 @@ x86UpdateHostModel(virCPUDefPtr guest, if (!(updated = virCPUDefCopyWithoutModel(host))) goto cleanup; + /* Remove non-migratable features by default */ updated->type = VIR_CPU_TYPE_GUEST; updated->mode = VIR_CPU_MODE_CUSTOM; - if (virCPUDefCopyModel(updated, host, true) < 0) + if (virCPUDefCopyModelFilter(updated, host, true, + x86FeatureIsMigratable, map) < 0) goto cleanup; if (guest->vendor_id) { @@ -2624,7 +2627,7 @@ virCPUx86Update(virCPUDefPtr guest, if (guest->mode == VIR_CPU_MODE_HOST_MODEL || guest->match == VIR_CPU_MATCH_MINIMUM) - ret = x86UpdateHostModel(guest, host); + ret = x86UpdateHostModel(guest, host, map); else ret = 0; -- 2.12.2

This reverts commit 959e72d323d06d67a5c3a759869af6da49da0e0e which was pushed accidentally. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_capabilities.c | 19 +++++-------------- src/qemu/qemu_capabilities.h | 3 +-- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_process.c | 4 ++-- tests/cputest.c | 7 +------ 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d2eef4321..964299b01 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2446,20 +2446,12 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - bool migratable) + virDomainVirtType type) { - virQEMUCapsCPUModelPtr model; - if (type == VIR_DOMAIN_VIRT_KVM) - model = &qemuCaps->hostCPU.kvm; + return qemuCaps->hostCPU.kvm.full; else - model = &qemuCaps->hostCPU.tcg; - - if (migratable) - return model->migratable; - else - return model->full; + return qemuCaps->hostCPU.tcg.full; } @@ -2477,7 +2469,7 @@ virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch); case VIR_CPU_MODE_HOST_MODEL: - return !!virQEMUCapsGetHostModel(qemuCaps, type, false); + return !!virQEMUCapsGetHostModel(qemuCaps, type); case VIR_CPU_MODE_CUSTOM: if (type == VIR_DOMAIN_VIRT_KVM) @@ -5542,8 +5534,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype, VIR_CPU_MODE_HOST_MODEL)) { - virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype, - false); + virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype); domCaps->cpu.hostModel = virCPUDefCopy(cpu); } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 9959c71a6..cca9a12b5 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -450,8 +450,7 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, char ***names, size_t *count); virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - bool migratable); + virDomainVirtType type); bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virCapsPtr caps, virDomainVirtType type, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7049be20a..445c696d6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6887,7 +6887,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, if (def->cpu->mode == VIR_CPU_MODE_CUSTOM) cpuDef = def->cpu; else if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) - cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType, false); + cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType); if (cpuDef) { int svm = virCPUCheckFeature(def->os.arch, cpuDef, "svm"); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b4499beaf..8323a1831 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5304,12 +5304,12 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, if (def->cpu->check == VIR_CPU_CHECK_PARTIAL && virCPUCompare(caps->host.arch, - virQEMUCapsGetHostModel(qemuCaps, def->virtType, false), + virQEMUCapsGetHostModel(qemuCaps, def->virtType), def->cpu, true) < 0) return -1; if (virCPUUpdate(def->os.arch, def->cpu, - virQEMUCapsGetHostModel(qemuCaps, def->virtType, true)) < 0) + virQEMUCapsGetHostModel(qemuCaps, def->virtType)) < 0) goto cleanup; if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType, diff --git a/tests/cputest.c b/tests/cputest.c index d5e023c40..528030754 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -393,7 +393,6 @@ cpuTestUpdate(const void *arg) const struct data *data = arg; int ret = -1; virCPUDefPtr host = NULL; - virCPUDefPtr migHost = NULL; virCPUDefPtr cpu = NULL; char *result = NULL; @@ -401,10 +400,7 @@ cpuTestUpdate(const void *arg) !(cpu = cpuTestLoadXML(data->arch, data->name))) goto cleanup; - if (!(migHost = virCPUCopyMigratable(data->arch, host))) - goto cleanup; - - if (virCPUUpdate(host->arch, cpu, migHost) < 0) + if (virCPUUpdate(host->arch, cpu, host) < 0) goto cleanup; if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0) @@ -415,7 +411,6 @@ cpuTestUpdate(const void *arg) cleanup: virCPUDefFree(host); virCPUDefFree(cpu); - virCPUDefFree(migHost); VIR_FREE(result); return ret; } -- 2.12.2

This reverts commit dfc711dc8cf08e942b01e6ead3de117e6522e5cd which was pushed accidentally. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_capabilities.c | 91 ++++++++++---------------------------------- 1 file changed, 20 insertions(+), 71 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 964299b01..74fe2c258 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -373,14 +373,6 @@ struct virQEMUCapsMachineType { unsigned int maxCpus; bool hotplugCpus; }; - -typedef struct _virQEMUCapsCPUModel virQEMUCapsCPUModel; -typedef virQEMUCapsCPUModel *virQEMUCapsCPUModelPtr; -struct _virQEMUCapsCPUModel { - virCPUDefPtr full; - virCPUDefPtr migratable; -}; - /* * Update the XML parser/formatter when adding more * information to this struct so that it gets cached @@ -423,8 +415,8 @@ struct _virQEMUCaps { * time we probe QEMU or load the results from the cache. */ struct { - virQEMUCapsCPUModel kvm; - virQEMUCapsCPUModel tcg; + virCPUDefPtr kvm; + virCPUDefPtr tcg; } hostCPU; }; @@ -2109,20 +2101,12 @@ virQEMUCapsCopyHostCPUData(virQEMUCapsPtr dst, !(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo))) return -1; - if (src->hostCPU.kvm.full && - !(dst->hostCPU.kvm.full = virCPUDefCopy(src->hostCPU.kvm.full))) + if (src->hostCPU.kvm && + !(dst->hostCPU.kvm = virCPUDefCopy(src->hostCPU.kvm))) return -1; - if (src->hostCPU.kvm.migratable && - !(dst->hostCPU.kvm.migratable = virCPUDefCopy(src->hostCPU.kvm.migratable))) - return -1; - - if (src->hostCPU.tcg.full && - !(dst->hostCPU.tcg.full = virCPUDefCopy(src->hostCPU.tcg.full))) - return -1; - - if (src->hostCPU.tcg.migratable && - !(dst->hostCPU.tcg.migratable = virCPUDefCopy(src->hostCPU.tcg.migratable))) + if (src->hostCPU.tcg && + !(dst->hostCPU.tcg = virCPUDefCopy(src->hostCPU.tcg))) return -1; return 0; @@ -2217,10 +2201,8 @@ void virQEMUCapsDispose(void *obj) qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); - virCPUDefFree(qemuCaps->hostCPU.kvm.full); - virCPUDefFree(qemuCaps->hostCPU.kvm.migratable); - virCPUDefFree(qemuCaps->hostCPU.tcg.full); - virCPUDefFree(qemuCaps->hostCPU.tcg.migratable); + virCPUDefFree(qemuCaps->hostCPU.kvm); + virCPUDefFree(qemuCaps->hostCPU.tcg); } void @@ -2449,9 +2431,9 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, virDomainVirtType type) { if (type == VIR_DOMAIN_VIRT_KVM) - return qemuCaps->hostCPU.kvm.full; + return qemuCaps->hostCPU.kvm; else - return qemuCaps->hostCPU.tcg.full; + return qemuCaps->hostCPU.tcg; } @@ -3298,40 +3280,26 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, } -static virCPUDefPtr -virQEMUCapsNewHostCPUModel(void) -{ - virCPUDefPtr cpu; - - if (VIR_ALLOC(cpu) < 0) - return NULL; - - cpu->type = VIR_CPU_TYPE_GUEST; - cpu->mode = VIR_CPU_MODE_CUSTOM; - cpu->match = VIR_CPU_MATCH_EXACT; - cpu->fallback = VIR_CPU_FALLBACK_ALLOW; - - return cpu; -} - - void virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, virCapsPtr caps, virDomainVirtType type) { virCPUDefPtr cpu = NULL; - virCPUDefPtr migCPU = NULL; virCPUDefPtr hostCPU = NULL; - virQEMUCapsCPUModelPtr model; int rc; if (!caps || !virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch)) return; - if (!(cpu = virQEMUCapsNewHostCPUModel())) + if (VIR_ALLOC(cpu) < 0) goto error; + cpu->type = VIR_CPU_TYPE_GUEST; + cpu->mode = VIR_CPU_MODE_CUSTOM; + cpu->match = VIR_CPU_MATCH_EXACT; + cpu->fallback = VIR_CPU_FALLBACK_ALLOW; + if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) { goto error; } else if (rc == 1) { @@ -3345,26 +3313,10 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, goto error; } - if (!(migCPU = virQEMUCapsNewHostCPUModel())) - goto error; - - if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, migCPU, true)) < 0) { - goto error; - } else if (rc == 1) { - VIR_DEBUG("CPU migratibility not provided by QEMU"); - - virCPUDefFree(migCPU); - if (!(migCPU = virCPUCopyMigratable(qemuCaps->arch, cpu))) - goto error; - } - if (type == VIR_DOMAIN_VIRT_KVM) - model = &qemuCaps->hostCPU.kvm; + qemuCaps->hostCPU.kvm = cpu; else - model = &qemuCaps->hostCPU.tcg; - - model->full = cpu; - model->migratable = migCPU; + qemuCaps->hostCPU.tcg = cpu; cleanup: virCPUDefFree(hostCPU); @@ -3372,7 +3324,6 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, error: virCPUDefFree(cpu); - virCPUDefFree(migCPU); virResetLastError(); goto cleanup; } @@ -4120,10 +4071,8 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) qemuCaps->kvmCPUModelInfo = NULL; qemuCaps->tcgCPUModelInfo = NULL; - virCPUDefFree(qemuCaps->hostCPU.kvm.full); - virCPUDefFree(qemuCaps->hostCPU.kvm.migratable); - virCPUDefFree(qemuCaps->hostCPU.tcg.full); - virCPUDefFree(qemuCaps->hostCPU.tcg.migratable); + virCPUDefFree(qemuCaps->hostCPU.kvm); + virCPUDefFree(qemuCaps->hostCPU.tcg); memset(&qemuCaps->hostCPU, 0, sizeof(qemuCaps->hostCPU)); } -- 2.12.2

This reverts commit 68507d77d38c0f7b05f260177091e0ce1452758e which was pushed accidentally. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_capabilities.c | 65 ++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 74fe2c258..11fe3e2d9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -414,10 +414,8 @@ struct _virQEMUCaps { * re-computed from the other fields or external data sources every * time we probe QEMU or load the results from the cache. */ - struct { - virCPUDefPtr kvm; - virCPUDefPtr tcg; - } hostCPU; + virCPUDefPtr kvmCPUModel; + virCPUDefPtr tcgCPUModel; }; struct virQEMUCapsSearchData { @@ -2088,31 +2086,6 @@ virQEMUCapsNew(void) } -static int -virQEMUCapsCopyHostCPUData(virQEMUCapsPtr dst, - virQEMUCapsPtr src) -{ - - if (src->kvmCPUModelInfo && - !(dst->kvmCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->kvmCPUModelInfo))) - return -1; - - if (src->tcgCPUModelInfo && - !(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo))) - return -1; - - if (src->hostCPU.kvm && - !(dst->hostCPU.kvm = virCPUDefCopy(src->hostCPU.kvm))) - return -1; - - if (src->hostCPU.tcg && - !(dst->hostCPU.tcg = virCPUDefCopy(src->hostCPU.tcg))) - return -1; - - return 0; -} - - virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) { virQEMUCapsPtr ret = virQEMUCapsNew(); @@ -2150,7 +2123,20 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto error; } - if (virQEMUCapsCopyHostCPUData(ret, qemuCaps) < 0) + if (qemuCaps->kvmCPUModel && + !(ret->kvmCPUModel = virCPUDefCopy(qemuCaps->kvmCPUModel))) + goto error; + + if (qemuCaps->tcgCPUModel && + !(ret->tcgCPUModel = virCPUDefCopy(qemuCaps->tcgCPUModel))) + goto error; + + if (qemuCaps->kvmCPUModelInfo && + !(ret->kvmCPUModelInfo = qemuMonitorCPUModelInfoCopy(qemuCaps->kvmCPUModelInfo))) + goto error; + + if (qemuCaps->tcgCPUModelInfo && + !(ret->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(qemuCaps->tcgCPUModelInfo))) goto error; if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0) @@ -2201,8 +2187,8 @@ void virQEMUCapsDispose(void *obj) qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); - virCPUDefFree(qemuCaps->hostCPU.kvm); - virCPUDefFree(qemuCaps->hostCPU.tcg); + virCPUDefFree(qemuCaps->kvmCPUModel); + virCPUDefFree(qemuCaps->tcgCPUModel); } void @@ -2431,9 +2417,9 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, virDomainVirtType type) { if (type == VIR_DOMAIN_VIRT_KVM) - return qemuCaps->hostCPU.kvm; + return qemuCaps->kvmCPUModel; else - return qemuCaps->hostCPU.tcg; + return qemuCaps->tcgCPUModel; } @@ -3314,9 +3300,9 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, } if (type == VIR_DOMAIN_VIRT_KVM) - qemuCaps->hostCPU.kvm = cpu; + qemuCaps->kvmCPUModel = cpu; else - qemuCaps->hostCPU.tcg = cpu; + qemuCaps->tcgCPUModel = cpu; cleanup: virCPUDefFree(hostCPU); @@ -4071,9 +4057,10 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) qemuCaps->kvmCPUModelInfo = NULL; qemuCaps->tcgCPUModelInfo = NULL; - virCPUDefFree(qemuCaps->hostCPU.kvm); - virCPUDefFree(qemuCaps->hostCPU.tcg); - memset(&qemuCaps->hostCPU, 0, sizeof(qemuCaps->hostCPU)); + virCPUDefFree(qemuCaps->kvmCPUModel); + virCPUDefFree(qemuCaps->tcgCPUModel); + qemuCaps->kvmCPUModel = NULL; + qemuCaps->tcgCPUModel = NULL; } -- 2.12.2

On Fri, Apr 07, 2017 at 01:23:54PM +0200, Jiri Denemark wrote:
I accidentally pushed "qemu: Use migratable host CPU model from QEMU" series which was not completely ACKed yet. The first three patches were OK so I left them in the tree. The rest is reverted by this series.
Jiri Denemark (4): Revert "cpu: Drop feature filtering from virCPUUpdate" Revert "qemu: Pass migratable host model to virCPUUpdate" Revert "qemu: Store migratable host CPU model in qemuCaps" Revert "qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct"
src/cpu/cpu_x86.c | 9 ++- src/qemu/qemu_capabilities.c | 143 +++++++++++-------------------------------- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_process.c | 4 +- tests/cputest.c | 7 +-- 6 files changed, 46 insertions(+), 122 deletions(-)
ACK series Jan

On Fri, Apr 07, 2017 at 13:38:32 +0200, Ján Tomko wrote:
On Fri, Apr 07, 2017 at 01:23:54PM +0200, Jiri Denemark wrote:
I accidentally pushed "qemu: Use migratable host CPU model from QEMU" series which was not completely ACKed yet. The first three patches were OK so I left them in the tree. The rest is reverted by this series.
Jiri Denemark (4): Revert "cpu: Drop feature filtering from virCPUUpdate" Revert "qemu: Pass migratable host model to virCPUUpdate" Revert "qemu: Store migratable host CPU model in qemuCaps" Revert "qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct"
src/cpu/cpu_x86.c | 9 ++- src/qemu/qemu_capabilities.c | 143 +++++++++++-------------------------------- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_process.c | 4 +- tests/cputest.c | 7 +-- 6 files changed, 46 insertions(+), 122 deletions(-)
ACK series
Thanks, pushed (wearing pink bunny ears of shame). Jirka
participants (2)
-
Jiri Denemark
-
Ján Tomko