[libvirt] [PATCH 00/14] Another round of CPU driver changes

This is another step in revisiting all APIs provided by the cpu driver and making them a bit more sane. As with the previous round(s), the updated APIs will gain virCPU prefix so that they can be easily distinguished from the ones that still need some work. Jiri Denemark (14): cpu: Rename cpuGetModels cpu: Rename and document cpuModelIsAllowed cpu: Rename cpuDataParse cpu: Rename cpuDataFormat cputest: Don't use preferred model for minimum match CPUs cputest: Don't use unsupported preferred model cputest: Don't use preferred model with forbidden fallback cputest: Don't use superfluous preferred model cputest: Don't use preferred CPU model at all cpu: Make models array in virCPUTranslate constant cputest: Don't test cpuGuestData cpu: Introduce virCPUConvertLegacy API cpu: Avoid adding <vendor> to custom CPUs cpu: Drop cpuGuestData src/conf/cpu_conf.c | 28 ++++- src/conf/cpu_conf.h | 3 +- src/cpu/cpu.c | 115 +++++++++++---------- src/cpu/cpu.h | 50 ++++----- src/cpu/cpu_arm.c | 12 +-- src/cpu/cpu_ppc64.c | 45 +++----- src/cpu/cpu_s390.c | 1 - src/cpu/cpu_x86.c | 36 ++----- src/libvirt_private.syms | 8 +- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 6 +- src/test/test_driver.c | 2 +- tests/cputest.c | 104 ++++++++----------- .../ppc64-host+guest,ppc_models-result.xml | 2 - .../ppc64-host+guest-legacy,ppc_models-result.xml | 2 - .../cputestdata/x86-host+guest,model486-result.xml | 16 ++- .../x86-host+guest,models,Penryn-result.xml | 13 --- .../x86-host+guest,models,qemu64-result.xml | 13 --- tests/cputestdata/x86-host+guest,models-result.xml | 16 +-- tests/cputestdata/x86-host+guest-result.xml | 18 ++-- ... => x86-host+host+host-model,models-result.xml} | 3 +- tests/cputestdata/x86-host+min.xml | 1 - tests/cputestdata/x86-host+penryn-force-result.xml | 5 +- tests/cputestdata/x86-host+pentium3.xml | 1 - .../x86-host+strict-force-extra-result.xml | 31 +++--- ...-host-Haswell-noTSX+Haswell,haswell-result.xml} | 4 +- ...Haswell-noTSX+Haswell-noTSX,haswell-result.xml} | 2 +- ...86-host-Haswell-noTSX+Haswell-noTSX-result.xml} | 2 +- .../x86-host-better+pentium3,core2duo-result.xml | 21 ---- .../x86-host-better+pentium3,pentium3-result.xml | 30 ------ .../x86-host-better+pentium3-result.xml | 27 +++-- tests/cputestdata/x86-host-worse+guest-result.xml | 18 +++- tests/qemumonitorjsontest.c | 2 +- 34 files changed, 273 insertions(+), 368 deletions(-) delete mode 100644 tests/cputestdata/x86-host+guest,models,Penryn-result.xml delete mode 100644 tests/cputestdata/x86-host+guest,models,qemu64-result.xml rename tests/cputestdata/{x86-host+host+host-model,models,Penryn-result.xml => x86-host+host+host-model,models-result.xml} (89%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml => x86-host-Haswell-noTSX+Haswell,haswell-result.xml} (77%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml => x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml} (77%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml => x86-host-Haswell-noTSX+Haswell-noTSX-result.xml} (64%) delete mode 100644 tests/cputestdata/x86-host-better+pentium3,core2duo-result.xml delete mode 100644 tests/cputestdata/x86-host-better+pentium3,pentium3-result.xml -- 2.10.2

The new name is virCPUGetModels. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 4 ++-- src/cpu/cpu.h | 6 +++--- src/cpu/cpu_ppc64.c | 4 ++-- src/cpu/cpu_x86.c | 4 ++-- src/libvirt_private.syms | 2 +- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/test/test_driver.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 995d925..0332d50 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -831,7 +831,7 @@ cpuModelIsAllowed(const char *model, } /** - * cpuGetModels: + * virCPUGetModels: * * @arch: CPU architecture * @models: where to store the NULL-terminated list of supported models @@ -845,7 +845,7 @@ cpuModelIsAllowed(const char *model, * or -1 on error. */ int -cpuGetModels(virArch arch, char ***models) +virCPUGetModels(virArch arch, char ***models) { struct cpuArchDriver *driver; diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 51bacb7..82912a4 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -105,7 +105,7 @@ typedef virCPUDataPtr (*cpuArchDataParse) (xmlXPathContextPtr ctxt); typedef int -(*cpuArchGetModels) (char ***models); +(*virCPUArchGetModels)(char ***models); typedef int (*virCPUArchTranslate)(virCPUDefPtr cpu, @@ -128,7 +128,7 @@ struct cpuArchDriver { virCPUArchDataCheckFeature dataCheckFeature; cpuArchDataFormat dataFormat; cpuArchDataParse dataParse; - cpuArchGetModels getModels; + virCPUArchGetModels getModels; virCPUArchTranslate translate; }; @@ -220,7 +220,7 @@ cpuModelIsAllowed(const char *model, ATTRIBUTE_NONNULL(1); int -cpuGetModels(virArch arch, char ***models); +virCPUGetModels(virArch arch, char ***models); int virCPUTranslate(virArch arch, diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 21ea0e1..bfe50a3 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -876,7 +876,7 @@ ppc64DriverBaseline(virCPUDefPtr *cpus, } static int -ppc64DriverGetModels(char ***models) +virCPUppc64DriverGetModels(char ***models) { struct ppc64_map *map; size_t i; @@ -921,5 +921,5 @@ struct cpuArchDriver cpuDriverPPC64 = { .guestData = ppc64DriverGuestData, .baseline = ppc64DriverBaseline, .update = virCPUppc64Update, - .getModels = ppc64DriverGetModels, + .getModels = virCPUppc64DriverGetModels, }; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 64f1c47..34c3e5b 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2668,7 +2668,7 @@ virCPUx86DataCheckFeature(const virCPUData *data, } static int -x86GetModels(char ***models) +virCPUx86GetModels(char ***models) { virCPUx86MapPtr map; size_t i; @@ -2767,6 +2767,6 @@ struct cpuArchDriver cpuDriverX86 = { .dataCheckFeature = virCPUx86DataCheckFeature, .dataFormat = x86CPUDataFormat, .dataParse = x86CPUDataParse, - .getModels = x86GetModels, + .getModels = virCPUx86GetModels, .translate = virCPUx86Translate, }; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ac6a1e1..8b16dc1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -980,13 +980,13 @@ cpuDataFree; cpuDataParse; cpuDecode; cpuEncode; -cpuGetModels; cpuGuestData; cpuNodeData; virCPUCheckFeature; virCPUCompare; virCPUCompareXML; virCPUDataCheckFeature; +virCPUGetModels; virCPUTranslate; virCPUUpdate; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ad98d68..cfd090c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4639,7 +4639,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, virDomainCapsCPUModelsPtr filtered = NULL; char **models = NULL; - if (cpuGetModels(domCaps->arch, &models) >= 0) { + if (virCPUGetModels(domCaps->arch, &models) >= 0) { filtered = virDomainCapsCPUModelsFilter(qemuCaps->cpuDefinitions, (const char **) models); virStringFreeList(models); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a82e58b..608b67b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18476,7 +18476,7 @@ qemuConnectGetCPUModelNames(virConnectPtr conn, return -1; } - return cpuGetModels(arch, models); + return virCPUGetModels(arch, models); } static int diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 236874f..cc300f0 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5943,7 +5943,7 @@ testConnectGetCPUModelNames(virConnectPtr conn ATTRIBUTE_UNUSED, return -1; } - return cpuGetModels(arch, models); + return virCPUGetModels(arch, models); } static int -- 2.10.2

The new name is virCPUModelIsAllowed. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 21 +++++++++++++++++---- src/cpu/cpu.h | 6 +++--- src/cpu/cpu_ppc64.c | 2 +- src/cpu/cpu_x86.c | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 0332d50..e8bcce8 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -813,10 +813,22 @@ cpuDataParse(const char *xmlStr) return data; } + +/** virCPUModelIsAllowed: + * + * @model: CPU model to be checked + * @models: list of supported CPU models + * @nmodels: number of models in @models + * + * Checks whether @model can be found in the list of supported @models. + * If @models is empty, all models are supported. + * + * Returns true if @model is supported, false otherwise. + */ bool -cpuModelIsAllowed(const char *model, - const char **models, - unsigned int nmodels) +virCPUModelIsAllowed(const char *model, + const char **models, + unsigned int nmodels) { size_t i; @@ -830,6 +842,7 @@ cpuModelIsAllowed(const char *model, return false; } + /** * virCPUGetModels: * @@ -898,7 +911,7 @@ virCPUTranslate(virArch arch, cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) return 0; - if (cpuModelIsAllowed(cpu->model, (const char **) models, nmodels)) + if (virCPUModelIsAllowed(cpu->model, (const char **) models, nmodels)) return 0; if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 82912a4..86cb96b 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -214,9 +214,9 @@ virCPUDataCheckFeature(const virCPUData *data, bool -cpuModelIsAllowed(const char *model, - const char **models, - unsigned int nmodels) +virCPUModelIsAllowed(const char *model, + const char **models, + unsigned int nmodels) ATTRIBUTE_NONNULL(1); int diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index bfe50a3..bdb026b 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -691,7 +691,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, goto cleanup; } - if (!cpuModelIsAllowed(model->name, models, nmodels)) { + if (!virCPUModelIsAllowed(model->name, models, nmodels)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU model %s is not supported by hypervisor"), model->name); diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 34c3e5b..5dfe549 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1833,7 +1833,7 @@ x86Decode(virCPUDefPtr cpu, */ for (i = map->nmodels - 1; i >= 0; i--) { candidate = map->models[i]; - if (!cpuModelIsAllowed(candidate->name, models, nmodels)) { + if (!virCPUModelIsAllowed(candidate->name, models, nmodels)) { if (preferred && STREQ(candidate->name, preferred)) { if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- 2.10.2

The new name is virCPUDataParse. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 4 ++-- src/cpu/cpu.h | 8 ++++---- src/cpu/cpu_x86.c | 4 ++-- src/libvirt_private.syms | 2 +- tests/cputest.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index e8bcce8..a357237 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -764,7 +764,7 @@ cpuDataFormat(const virCPUData *data) /** - * cpuDataParse: + * virCPUDataParse: * * @xmlStr: XML string produced by cpuDataFormat * @@ -773,7 +773,7 @@ cpuDataFormat(const virCPUData *data) * Returns internal CPU data structure parsed from the XML or NULL on error. */ virCPUDataPtr -cpuDataParse(const char *xmlStr) +virCPUDataParse(const char *xmlStr) { struct cpuArchDriver *driver; xmlDocPtr xml = NULL; diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 86cb96b..c2d6b12 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -102,7 +102,7 @@ typedef char * (*cpuArchDataFormat)(const virCPUData *data); typedef virCPUDataPtr -(*cpuArchDataParse) (xmlXPathContextPtr ctxt); +(*virCPUArchDataParse)(xmlXPathContextPtr ctxt); typedef int (*virCPUArchGetModels)(char ***models); @@ -127,7 +127,7 @@ struct cpuArchDriver { virCPUArchCheckFeature checkFeature; virCPUArchDataCheckFeature dataCheckFeature; cpuArchDataFormat dataFormat; - cpuArchDataParse dataParse; + virCPUArchDataParse dataParse; virCPUArchGetModels getModels; virCPUArchTranslate translate; }; @@ -230,12 +230,12 @@ virCPUTranslate(virArch arch, ATTRIBUTE_NONNULL(2); -/* cpuDataFormat and cpuDataParse are implemented for unit tests only and +/* cpuDataFormat and virCPUDataParse are implemented for unit tests only and * have no real-life usage */ char *cpuDataFormat(const virCPUData *data) ATTRIBUTE_NONNULL(1); -virCPUDataPtr cpuDataParse(const char *xmlStr) +virCPUDataPtr virCPUDataParse(const char *xmlStr) ATTRIBUTE_NONNULL(1); #endif /* __VIR_CPU_H__ */ diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 5dfe549..c3a3940 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1437,7 +1437,7 @@ x86CPUDataFormat(const virCPUData *data) static virCPUDataPtr -x86CPUDataParse(xmlXPathContextPtr ctxt) +virCPUx86DataParse(xmlXPathContextPtr ctxt) { xmlNodePtr *nodes = NULL; virCPUDataPtr cpuData = NULL; @@ -2766,7 +2766,7 @@ struct cpuArchDriver cpuDriverX86 = { .checkFeature = virCPUx86CheckFeature, .dataCheckFeature = virCPUx86DataCheckFeature, .dataFormat = x86CPUDataFormat, - .dataParse = x86CPUDataParse, + .dataParse = virCPUx86DataParse, .getModels = virCPUx86GetModels, .translate = virCPUx86Translate, }; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 8b16dc1..d09f340 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -977,7 +977,6 @@ cpuBaseline; cpuBaselineXML; cpuDataFormat; cpuDataFree; -cpuDataParse; cpuDecode; cpuEncode; cpuGuestData; @@ -986,6 +985,7 @@ virCPUCheckFeature; virCPUCompare; virCPUCompareXML; virCPUDataCheckFeature; +virCPUDataParse; virCPUGetModels; virCPUTranslate; virCPUUpdate; diff --git a/tests/cputest.c b/tests/cputest.c index 6842d27..0d7f3ec 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -472,7 +472,7 @@ cpuTestCPUID(bool guest, const void *arg) goto cleanup; if (virTestLoadFile(hostFile, &host) < 0 || - !(hostData = cpuDataParse(host))) + !(hostData = virCPUDataParse(host))) goto cleanup; if (VIR_ALLOC(cpu) < 0) -- 2.10.2

The new name is virCPUDataFormat. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 6 +++--- src/cpu/cpu.h | 8 ++++---- src/cpu/cpu_x86.c | 4 ++-- src/libvirt_private.syms | 2 +- tests/qemumonitorjsontest.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index a357237..5040669 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -734,7 +734,7 @@ virCPUDataCheckFeature(const virCPUData *data, /** - * cpuDataFormat: + * virCPUDataFormat: * * @data: internal CPU representation * @@ -743,7 +743,7 @@ virCPUDataCheckFeature(const virCPUData *data, * Returns string representation of the XML describing @data or NULL on error. */ char * -cpuDataFormat(const virCPUData *data) +virCPUDataFormat(const virCPUData *data) { struct cpuArchDriver *driver; @@ -766,7 +766,7 @@ cpuDataFormat(const virCPUData *data) /** * virCPUDataParse: * - * @xmlStr: XML string produced by cpuDataFormat + * @xmlStr: XML string produced by virCPUDataFormat * * Parses XML representation of virCPUData structure for test purposes. * diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index c2d6b12..917d847 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -99,7 +99,7 @@ typedef int const char *feature); typedef char * -(*cpuArchDataFormat)(const virCPUData *data); +(*virCPUArchDataFormat)(const virCPUData *data); typedef virCPUDataPtr (*virCPUArchDataParse)(xmlXPathContextPtr ctxt); @@ -126,7 +126,7 @@ struct cpuArchDriver { virCPUArchUpdate update; virCPUArchCheckFeature checkFeature; virCPUArchDataCheckFeature dataCheckFeature; - cpuArchDataFormat dataFormat; + virCPUArchDataFormat dataFormat; virCPUArchDataParse dataParse; virCPUArchGetModels getModels; virCPUArchTranslate translate; @@ -230,10 +230,10 @@ virCPUTranslate(virArch arch, ATTRIBUTE_NONNULL(2); -/* cpuDataFormat and virCPUDataParse are implemented for unit tests only and +/* virCPUDataFormat and virCPUDataParse are implemented for unit tests only and * have no real-life usage */ -char *cpuDataFormat(const virCPUData *data) +char *virCPUDataFormat(const virCPUData *data) ATTRIBUTE_NONNULL(1); virCPUDataPtr virCPUDataParse(const char *xmlStr) ATTRIBUTE_NONNULL(1); diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index c3a3940..4f2a111 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1412,7 +1412,7 @@ virCPUx86GetMap(void) static char * -x86CPUDataFormat(const virCPUData *data) +virCPUx86DataFormat(const virCPUData *data) { virCPUx86DataIterator iter = virCPUx86DataIteratorInit(&data->data.x86); virCPUx86CPUID *cpuid; @@ -2765,7 +2765,7 @@ struct cpuArchDriver cpuDriverX86 = { .update = virCPUx86Update, .checkFeature = virCPUx86CheckFeature, .dataCheckFeature = virCPUx86DataCheckFeature, - .dataFormat = x86CPUDataFormat, + .dataFormat = virCPUx86DataFormat, .dataParse = virCPUx86DataParse, .getModels = virCPUx86GetModels, .translate = virCPUx86Translate, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d09f340..41b674d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -975,7 +975,6 @@ virSecretObjSetValueSize; # cpu/cpu.h cpuBaseline; cpuBaselineXML; -cpuDataFormat; cpuDataFree; cpuDecode; cpuEncode; @@ -985,6 +984,7 @@ virCPUCheckFeature; virCPUCompare; virCPUCompareXML; virCPUDataCheckFeature; +virCPUDataFormat; virCPUDataParse; virCPUGetModels; virCPUTranslate; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index d8fd958..9f889a9 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2329,7 +2329,7 @@ testQemuMonitorJSONGetCPUData(const void *opaque) &cpuData) < 0) goto cleanup; - if (!(actual = cpuDataFormat(cpuData))) + if (!(actual = virCPUDataFormat(cpuData))) goto cleanup; if (virTestCompareToFile(actual, dataFile) < 0) -- 2.10.2

Guest CPUs with match='minimum' should always be updated to match host CPU model. Trying to get different results by supplying preferred models does not make sense. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 2 -- .../x86-host-better+pentium3,core2duo-result.xml | 21 --------------- .../x86-host-better+pentium3,pentium3-result.xml | 30 ---------------------- 3 files changed, 53 deletions(-) delete mode 100644 tests/cputestdata/x86-host-better+pentium3,core2duo-result.xml delete mode 100644 tests/cputestdata/x86-host-better+pentium3,pentium3-result.xml diff --git a/tests/cputest.c b/tests/cputest.c index 0d7f3ec..7f27521 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -792,8 +792,6 @@ mymain(void) /* computing guest data and decoding the data into a guest CPU XML */ DO_TEST_GUESTDATA("x86", "host", "guest", NULL, NULL, 0); DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, "pentium3", 0); - DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, "core2duo", 0); DO_TEST_GUESTDATA("x86", "host-worse", "guest", NULL, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "strict-force-extra", NULL, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, NULL, 0); diff --git a/tests/cputestdata/x86-host-better+pentium3,core2duo-result.xml b/tests/cputestdata/x86-host-better+pentium3,core2duo-result.xml deleted file mode 100644 index 2bf691c..0000000 --- a/tests/cputestdata/x86-host-better+pentium3,core2duo-result.xml +++ /dev/null @@ -1,21 +0,0 @@ -<cpu mode='custom' match='exact'> - <arch>x86_64</arch> - <model fallback='allow'>core2duo</model> - <feature policy='require' name='ds'/> - <feature policy='require' name='acpi'/> - <feature policy='require' name='ss'/> - <feature policy='require' name='ht'/> - <feature policy='require' name='tm'/> - <feature policy='require' name='pbe'/> - <feature policy='require' name='ds_cpl'/> - <feature policy='require' name='vmx'/> - <feature policy='require' name='est'/> - <feature policy='require' name='tm2'/> - <feature policy='require' name='cx16'/> - <feature policy='require' name='xtpr'/> - <feature policy='require' name='dca'/> - <feature policy='require' name='sse4.1'/> - <feature policy='require' name='sse4.2'/> - <feature policy='require' name='popcnt'/> - <feature policy='require' name='lahf_lm'/> -</cpu> diff --git a/tests/cputestdata/x86-host-better+pentium3,pentium3-result.xml b/tests/cputestdata/x86-host-better+pentium3,pentium3-result.xml deleted file mode 100644 index d1d0c4b..0000000 --- a/tests/cputestdata/x86-host-better+pentium3,pentium3-result.xml +++ /dev/null @@ -1,30 +0,0 @@ -<cpu mode='custom' match='exact'> - <arch>x86_64</arch> - <model fallback='allow'>pentium3</model> - <feature policy='require' name='apic'/> - <feature policy='require' name='clflush'/> - <feature policy='require' name='ds'/> - <feature policy='require' name='acpi'/> - <feature policy='require' name='sse2'/> - <feature policy='require' name='ss'/> - <feature policy='require' name='ht'/> - <feature policy='require' name='tm'/> - <feature policy='require' name='pbe'/> - <feature policy='require' name='pni'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='ds_cpl'/> - <feature policy='require' name='vmx'/> - <feature policy='require' name='est'/> - <feature policy='require' name='tm2'/> - <feature policy='require' name='ssse3'/> - <feature policy='require' name='cx16'/> - <feature policy='require' name='xtpr'/> - <feature policy='require' name='dca'/> - <feature policy='require' name='sse4.1'/> - <feature policy='require' name='sse4.2'/> - <feature policy='require' name='popcnt'/> - <feature policy='require' name='syscall'/> - <feature policy='require' name='nx'/> - <feature policy='require' name='lm'/> - <feature policy='require' name='lahf_lm'/> -</cpu> -- 2.10.2

Using a preferred CPU model which is not in the list of CPU models supported by a hypervisor does not make sense. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 2 -- tests/cputestdata/x86-host+guest,models,Penryn-result.xml | 13 ------------- tests/cputestdata/x86-host+guest,models,qemu64-result.xml | 13 ------------- 3 files changed, 28 deletions(-) delete mode 100644 tests/cputestdata/x86-host+guest,models,Penryn-result.xml delete mode 100644 tests/cputestdata/x86-host+guest,models,qemu64-result.xml diff --git a/tests/cputest.c b/tests/cputest.c index 7f27521..16be61b 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -797,8 +797,6 @@ mymain(void) DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "guest", model486, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "guest", models, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", models, "Penryn", 0); - DO_TEST_GUESTDATA("x86", "host", "guest", models, "qemu64", 0); DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, NULL, -1); DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, "Penryn", -1); DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, "Penryn", 0); diff --git a/tests/cputestdata/x86-host+guest,models,Penryn-result.xml b/tests/cputestdata/x86-host+guest,models,Penryn-result.xml deleted file mode 100644 index 6cd0668..0000000 --- a/tests/cputestdata/x86-host+guest,models,Penryn-result.xml +++ /dev/null @@ -1,13 +0,0 @@ -<cpu mode='custom' match='exact'> - <arch>x86_64</arch> - <model fallback='allow'>Nehalem</model> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='xtpr'/> - <feature policy='require' name='dca'/> - <feature policy='require' name='3dnowext'/> - <feature policy='require' name='svm'/> - <feature policy='disable' name='sse'/> - <feature policy='disable' name='sse4.2'/> - <feature policy='disable' name='popcnt'/> -</cpu> diff --git a/tests/cputestdata/x86-host+guest,models,qemu64-result.xml b/tests/cputestdata/x86-host+guest,models,qemu64-result.xml deleted file mode 100644 index 8b170e5..0000000 --- a/tests/cputestdata/x86-host+guest,models,qemu64-result.xml +++ /dev/null @@ -1,13 +0,0 @@ -<cpu mode='custom' match='exact'> - <arch>x86_64</arch> - <model fallback='allow'>qemu64</model> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='ssse3'/> - <feature policy='require' name='xtpr'/> - <feature policy='require' name='dca'/> - <feature policy='require' name='sse4.1'/> - <feature policy='require' name='3dnowext'/> - <feature policy='require' name='lahf_lm'/> - <feature policy='disable' name='sse'/> -</cpu> -- 2.10.2

Using a preferred model for guest CPUs with forbidden fallback masks a bug in the code. It would just happily use another CPU model supported by a hypervisor even though it is explicitly forbidden in the CPU XML. This patch temporarily changes the expected result to -2, which is used when the result XML file cannot be found (but it was supposed not to be found since the tested API should have failed). The result will be switched back to -1 few commits later when the original bug gets fixed. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index 16be61b..7496156 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -798,16 +798,14 @@ mymain(void) DO_TEST_GUESTDATA("x86", "host", "guest", model486, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "guest", models, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, NULL, -1); - DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, "Penryn", -1); + DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, NULL, /*-1*/ -2); DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, "Penryn", 0); - DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", - models, "Penryn", -1); + DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, NULL, /*-1*/ -2); DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, "Haswell", 0); DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, "Haswell-noTSX", 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", - haswell, "Haswell-noTSX", -1); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, NULL, /*-1*/ -2); DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, "Haswell-noTSX", 0); -- 2.10.2

In some cases preferred model doesn't really do anything since the result remains the same even if it is removed. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 13 +++++-------- ...esult.xml => x86-host+host+host-model,models-result.xml} | 0 ...ml => x86-host-Haswell-noTSX+Haswell,haswell-result.xml} | 0 ...x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml} | 0 ....xml => x86-host-Haswell-noTSX+Haswell-noTSX-result.xml} | 0 5 files changed, 5 insertions(+), 8 deletions(-) rename tests/cputestdata/{x86-host+host+host-model,models,Penryn-result.xml => x86-host+host+host-model,models-result.xml} (100%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml => x86-host-Haswell-noTSX+Haswell,haswell-result.xml} (100%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml => x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml} (100%) rename tests/cputestdata/{x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml => x86-host-Haswell-noTSX+Haswell-noTSX-result.xml} (100%) diff --git a/tests/cputest.c b/tests/cputest.c index 7496156..6810832 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -799,18 +799,15 @@ mymain(void) DO_TEST_GUESTDATA("x86", "host", "guest", models, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, NULL, -1); DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, "Penryn", 0); + DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, NULL, 0); DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", - haswell, "Haswell", 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", - haswell, "Haswell-noTSX", 0); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, NULL, 0); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, NULL, 0); DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", - NULL, "Haswell-noTSX", 0); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, NULL, 0); DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, "POWER8", -1); + DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, NULL, -1); DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, NULL, 0); DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, NULL, -1); DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, NULL, -1); diff --git a/tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml b/tests/cputestdata/x86-host+host+host-model,models-result.xml similarity index 100% rename from tests/cputestdata/x86-host+host+host-model,models,Penryn-result.xml rename to tests/cputestdata/x86-host+host+host-model,models-result.xml diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml similarity index 100% rename from tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell,Haswell-result.xml rename to tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml similarity index 100% rename from tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell,Haswell-noTSX-result.xml rename to tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml similarity index 100% rename from tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,Haswell-noTSX-result.xml rename to tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml -- 2.10.2

Now that all tests pass NULL as the preferred model, we can just drop that test parameter. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 69 +++++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index 6810832..6aebfb0 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -62,7 +62,6 @@ struct data { const char **models; const char *modelsName; unsigned int nmodels; - const char *preferred; unsigned int flags; int result; }; @@ -269,7 +268,7 @@ cpuTestGuestData(const void *arg) guest->match = VIR_CPU_MATCH_EXACT; guest->fallback = cpu->fallback; if (cpuDecode(guest, guestData, data->models, - data->nmodels, data->preferred) < 0) { + data->nmodels, NULL) < 0) { ret = -1; goto cleanup; } @@ -277,8 +276,6 @@ cpuTestGuestData(const void *arg) virBufferAsprintf(&buf, "%s+%s", data->host, data->name); if (data->nmodels) virBufferAsprintf(&buf, ",%s", data->modelsName); - if (data->preferred) - virBufferAsprintf(&buf, ",%s", data->preferred); virBufferAddLit(&buf, "-result"); if (virBufferError(&buf)) { @@ -588,12 +585,12 @@ mymain(void) #endif #define DO_TEST(arch, api, name, host, cpu, \ - models, nmodels, preferred, flags, result) \ + models, nmodels, flags, result) \ do { \ struct data data = { \ arch, host, cpu, models, \ models == NULL ? NULL : #models, \ - nmodels, preferred, flags, result \ + nmodels, flags, result \ }; \ char *testLabel; \ char *tmp; \ @@ -624,12 +621,12 @@ mymain(void) #define DO_TEST_COMPARE(arch, host, cpu, result) \ DO_TEST(arch, cpuTestCompare, \ host "/" cpu " (" #result ")", \ - host, cpu, NULL, 0, NULL, 0, result) + host, cpu, NULL, 0, 0, result) #define DO_TEST_UPDATE_ONLY(arch, host, cpu) \ DO_TEST(arch, cpuTestUpdate, \ cpu " on " host, \ - host, cpu, NULL, 0, NULL, 0, 0) \ + host, cpu, NULL, 0, 0, 0) #define DO_TEST_UPDATE(arch, host, cpu, result) \ do { \ @@ -649,7 +646,7 @@ mymain(void) ret = -1; \ } else { \ DO_TEST(arch, cpuTestBaseline, label, NULL, \ - "baseline-" name, NULL, 0, NULL, flags, result); \ + "baseline-" name, NULL, 0, flags, result); \ } \ VIR_FREE(label); \ } while (0) @@ -657,21 +654,21 @@ mymain(void) #define DO_TEST_HASFEATURE(arch, host, feature, result) \ DO_TEST(arch, cpuTestHasFeature, \ host "/" feature " (" #result ")", \ - host, feature, NULL, 0, NULL, 0, result) + host, feature, NULL, 0, 0, result) -#define DO_TEST_GUESTDATA(arch, host, cpu, models, preferred, result) \ +#define DO_TEST_GUESTDATA(arch, host, cpu, models, result) \ DO_TEST(arch, cpuTestGuestData, \ - host "/" cpu " (" #models ", pref=" #preferred ")", \ + host "/" cpu " (" #models ")", \ host, cpu, models, \ models == NULL ? 0 : sizeof(models) / sizeof(char *), \ - preferred, 0, result) + 0, result) #if WITH_QEMU && WITH_YAJL # define DO_TEST_CPUID_JSON(arch, host, json) \ do { \ if (json) { \ DO_TEST(arch, cpuTestJSONCPUID, host, host, \ - NULL, NULL, 0, NULL, 0, 0); \ + NULL, NULL, 0, 0, 0); \ } \ } while (0) #else @@ -681,9 +678,9 @@ mymain(void) #define DO_TEST_CPUID(arch, host, json) \ do { \ DO_TEST(arch, cpuTestHostCPUID, host, host, \ - NULL, NULL, 0, NULL, 0, 0); \ + NULL, NULL, 0, 0, 0); \ DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, 0, NULL, 0, 0); \ + NULL, NULL, 0, 0, 0); \ DO_TEST_CPUID_JSON(arch, host, json); \ } while (0) @@ -790,27 +787,27 @@ mymain(void) DO_TEST_HASFEATURE("x86", "host", "foo", FAIL); /* computing guest data and decoding the data into a guest CPU XML */ - DO_TEST_GUESTDATA("x86", "host", "guest", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host-worse", "guest", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "strict-force-extra", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", model486, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", models, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, NULL, -1); - DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, NULL, 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, NULL, 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, NULL, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, NULL, 0); + DO_TEST_GUESTDATA("x86", "host", "guest", NULL, 0); + DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, 0); + DO_TEST_GUESTDATA("x86", "host-worse", "guest", NULL, 0); + DO_TEST_GUESTDATA("x86", "host", "strict-force-extra", NULL, 0); + DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, 0); + DO_TEST_GUESTDATA("x86", "host", "guest", model486, 0); + DO_TEST_GUESTDATA("x86", "host", "guest", models, 0); + DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, -1); + DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, /*-1*/ -2); + DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, 0); + DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, /*-1*/ -2); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, 0); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, /*-1*/ -2); + DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, NULL, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, NULL, -1); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, NULL, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, NULL, -1); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, NULL, -1); + DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, 0); + DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, -1); + DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, 0); + DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1); + DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, -1); DO_TEST_CPUID("x86", "A10-5800K", true); DO_TEST_CPUID("x86", "Atom-D510", false); -- 2.10.2

The API doesn't change the array so let's make it constant. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 6 +++--- src/cpu/cpu.h | 2 +- src/qemu/qemu_process.c | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 5040669..9d34206 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -896,7 +896,7 @@ virCPUGetModels(virArch arch, char ***models) int virCPUTranslate(virArch arch, virCPUDefPtr cpu, - char **models, + const char **models, unsigned int nmodels) { struct cpuArchDriver *driver; @@ -911,7 +911,7 @@ virCPUTranslate(virArch arch, cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) return 0; - if (virCPUModelIsAllowed(cpu->model, (const char **) models, nmodels)) + if (virCPUModelIsAllowed(cpu->model, models, nmodels)) return 0; if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { @@ -928,7 +928,7 @@ virCPUTranslate(virArch arch, return -1; } - if (driver->translate(cpu, (const char **) models, nmodels) < 0) + if (driver->translate(cpu, models, nmodels) < 0) return -1; VIR_DEBUG("model=%s", NULLSTR(cpu->model)); diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 917d847..5ad8112 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -225,7 +225,7 @@ virCPUGetModels(virArch arch, char ***models); int virCPUTranslate(virArch arch, virCPUDefPtr cpu, - char **models, + const char **models, unsigned int nmodels) ATTRIBUTE_NONNULL(2); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 09b2a72..14c799e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5083,7 +5083,8 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, goto cleanup; if (virQEMUCapsGetCPUDefinitions(qemuCaps, &models, &nmodels) < 0 || - virCPUTranslate(def->os.arch, def->cpu, models, nmodels) < 0) + virCPUTranslate(def->os.arch, def->cpu, + (const char **) models, nmodels) < 0) goto cleanup; def->cpu->fallback = VIR_CPU_FALLBACK_FORBID; -- 2.10.2

The API is no longer used anywhere else since it was replaced by a much saner work flow utilizing new APIs that work on virCPUDefPtr directly: virCPUCompare, virCPUUpdate, and virCPUTranslate. Not testing the new work flow caused some bugs to be hidden. This patch reveals them, but doesn't attempt to fix them. To make sure all test still pass after this patch, all affected test results are modified to pretend the tests succeeded. All of the bugs will be fixed in the following commits and the artificial modifications will be reverted. The following is the list of bugs in the new CPU model work flow: - a guest CPU with mode='custom' and missing <vendor/> gets the vendor copied from host's CPU (the vendor should only be copied to host-model CPUs): DO_TEST_UPDATE("x86", "host", "min", VIR_CPU_COMPARE_IDENTICAL) DO_TEST_UPDATE("x86", "host", "pentium3", VIR_CPU_COMPARE_IDENTICAL) DO_TEST_GUESTCPU("x86", "host-better", "pentium3", NULL, 0) - when a guest CPU with mode='custom' needs to be translated into another model because the original model is not supported by a hypervisor, the result will have its vendor set to the vendor of the original CPU model as specified in cpu_map.xml even if the original guest CPU XML didn't contain <vendor/>: DO_TEST_GUESTCPU("x86", "host", "guest", model486, 0) DO_TEST_GUESTCPU("x86", "host", "guest", models, 0) DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0) - legacy POWERx_v* model names are not recognized: DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, 0) Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- tests/cputest.c | 65 +++++++++------------- .../ppc64-host+guest,ppc_models-result.xml | 2 - .../ppc64-host+guest-legacy,ppc_models-result.xml | 2 - .../cputestdata/x86-host+guest,model486-result.xml | 17 ++++-- tests/cputestdata/x86-host+guest,models-result.xml | 17 ++++-- tests/cputestdata/x86-host+guest-result.xml | 18 ++++-- .../x86-host+host+host-model,models-result.xml | 3 +- tests/cputestdata/x86-host+penryn-force-result.xml | 5 +- .../x86-host+strict-force-extra-result.xml | 31 +++++------ ...6-host-Haswell-noTSX+Haswell,haswell-result.xml | 4 +- ...-Haswell-noTSX+Haswell-noTSX,haswell-result.xml | 3 +- ...x86-host-Haswell-noTSX+Haswell-noTSX-result.xml | 2 +- .../x86-host-better+pentium3-result.xml | 28 +++++----- tests/cputestdata/x86-host-worse+guest-result.xml | 18 ++++-- 14 files changed, 113 insertions(+), 102 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index 6aebfb0..1d7f6bc 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -237,14 +237,12 @@ cpuTestCompare(const void *arg) static int -cpuTestGuestData(const void *arg) +cpuTestGuestCPU(const void *arg) { const struct data *data = arg; int ret = -2; virCPUDefPtr host = NULL; virCPUDefPtr cpu = NULL; - virCPUDefPtr guest = NULL; - virCPUDataPtr guestData = NULL; virCPUCompareResult cmpResult; virBuffer buf = VIR_BUFFER_INITIALIZER; char *result = NULL; @@ -253,22 +251,15 @@ cpuTestGuestData(const void *arg) !(cpu = cpuTestLoadXML(data->arch, data->name))) goto cleanup; - cmpResult = cpuGuestData(host, cpu, &guestData, NULL); + cmpResult = virCPUCompare(host->arch, host, cpu, false); if (cmpResult == VIR_CPU_COMPARE_ERROR || cmpResult == VIR_CPU_COMPARE_INCOMPATIBLE) { ret = -1; goto cleanup; } - if (VIR_ALLOC(guest) < 0) - goto cleanup; - - guest->arch = host->arch; - guest->type = VIR_CPU_TYPE_GUEST; - guest->match = VIR_CPU_MATCH_EXACT; - guest->fallback = cpu->fallback; - if (cpuDecode(guest, guestData, data->models, - data->nmodels, NULL) < 0) { + if (virCPUUpdate(host->arch, cpu, host) < 0 || + virCPUTranslate(host->arch, cpu, data->models, data->nmodels) < 0) { ret = -1; goto cleanup; } @@ -284,17 +275,15 @@ cpuTestGuestData(const void *arg) } result = virBufferContentAndReset(&buf); - if (cpuTestCompareXML(data->arch, guest, result, false) < 0) + if (cpuTestCompareXML(data->arch, cpu, result, false) < 0) goto cleanup; ret = 0; cleanup: VIR_FREE(result); - cpuDataFree(guestData); virCPUDefFree(host); virCPUDefFree(cpu); - virCPUDefFree(guest); if (ret == data->result) { /* We got the result we expected, whether it was @@ -656,8 +645,8 @@ mymain(void) host "/" feature " (" #result ")", \ host, feature, NULL, 0, 0, result) -#define DO_TEST_GUESTDATA(arch, host, cpu, models, result) \ - DO_TEST(arch, cpuTestGuestData, \ +#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \ + DO_TEST(arch, cpuTestGuestCPU, \ host "/" cpu " (" #models ")", \ host, cpu, models, \ models == NULL ? 0 : sizeof(models) / sizeof(char *), \ @@ -787,27 +776,27 @@ mymain(void) DO_TEST_HASFEATURE("x86", "host", "foo", FAIL); /* computing guest data and decoding the data into a guest CPU XML */ - DO_TEST_GUESTDATA("x86", "host", "guest", NULL, 0); - DO_TEST_GUESTDATA("x86", "host-better", "pentium3", NULL, 0); - DO_TEST_GUESTDATA("x86", "host-worse", "guest", NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "strict-force-extra", NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "penryn-force", NULL, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", model486, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", models, 0); - DO_TEST_GUESTDATA("x86", "host", "guest", nomodel, -1); - DO_TEST_GUESTDATA("x86", "host", "guest-nofallback", models, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host", "host+host-model", models, 0); - DO_TEST_GUESTDATA("x86", "host", "host+host-model-nofallback", models, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell", haswell, 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, /*-1*/ -2); - DO_TEST_GUESTDATA("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, 0); + DO_TEST_GUESTCPU("x86", "host", "guest", NULL, 0); + DO_TEST_GUESTCPU("x86", "host-better", "pentium3", NULL, 0); + DO_TEST_GUESTCPU("x86", "host-worse", "guest", NULL, 0); + DO_TEST_GUESTCPU("x86", "host", "strict-force-extra", NULL, 0); + DO_TEST_GUESTCPU("x86", "host", "penryn-force", NULL, 0); + DO_TEST_GUESTCPU("x86", "host", "guest", model486, 0); + DO_TEST_GUESTCPU("x86", "host", "guest", models, 0); + DO_TEST_GUESTCPU("x86", "host", "guest", nomodel, -1); + DO_TEST_GUESTCPU("x86", "host", "guest-nofallback", models, -1); + DO_TEST_GUESTCPU("x86", "host", "host+host-model", models, 0); + DO_TEST_GUESTCPU("x86", "host", "host+host-model-nofallback", models, -1); + DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell", haswell, 0); + DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", haswell, 0); + DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX-nofallback", haswell, -1); + DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX", NULL, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest", ppc_models, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest-nofallback", ppc_models, -1); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy", ppc_models, 0); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1); - DO_TEST_GUESTDATA("ppc64", "host", "guest-legacy-invalid", ppc_models, -1); + DO_TEST_GUESTCPU("ppc64", "host", "guest", ppc_models, 0); + DO_TEST_GUESTCPU("ppc64", "host", "guest-nofallback", ppc_models, -1); + DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, /*0*/ -1); + DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1); + DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-invalid", ppc_models, -1); DO_TEST_CPUID("x86", "A10-5800K", true); DO_TEST_CPUID("x86", "Atom-D510", false); diff --git a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml index 3548c0e..7fac4b7 100644 --- a/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml +++ b/tests/cputestdata/ppc64-host+guest,ppc_models-result.xml @@ -1,5 +1,3 @@ <cpu mode='custom' match='exact'> - <arch>ppc64</arch> <model fallback='allow'>POWER7</model> - <vendor>IBM</vendor> </cpu> diff --git a/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml b/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml index 3548c0e..7fac4b7 100644 --- a/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml +++ b/tests/cputestdata/ppc64-host+guest-legacy,ppc_models-result.xml @@ -1,5 +1,3 @@ <cpu mode='custom' match='exact'> - <arch>ppc64</arch> <model fallback='allow'>POWER7</model> - <vendor>IBM</vendor> </cpu> diff --git a/tests/cputestdata/x86-host+guest,model486-result.xml b/tests/cputestdata/x86-host+guest,model486-result.xml index 8bd425d..88df467 100644 --- a/tests/cputestdata/x86-host+guest,model486-result.xml +++ b/tests/cputestdata/x86-host+guest,model486-result.xml @@ -1,6 +1,7 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>486</model> + <vendor>Intel</vendor> + <topology sockets='2' cores='4' threads='1'/> <feature policy='require' name='de'/> <feature policy='require' name='tsc'/> <feature policy='require' name='msr'/> @@ -19,9 +20,9 @@ <feature policy='require' name='mmx'/> <feature policy='require' name='fxsr'/> <feature policy='require' name='sse2'/> - <feature policy='require' name='pbe'/> + <feature policy='force' name='pbe'/> <feature policy='require' name='pni'/> - <feature policy='require' name='monitor'/> + <feature policy='force' name='monitor'/> <feature policy='require' name='ssse3'/> <feature policy='require' name='cx16'/> <feature policy='require' name='xtpr'/> @@ -30,8 +31,14 @@ <feature policy='require' name='syscall'/> <feature policy='require' name='nx'/> <feature policy='require' name='lm'/> - <feature policy='require' name='3dnowext'/> + <feature policy='force' name='3dnowext'/> <feature policy='require' name='lahf_lm'/> - <feature policy='require' name='svm'/> + <feature policy='force' name='svm'/> <feature policy='disable' name='vme'/> + <feature policy='disable' name='sse4.2'/> + <feature policy='disable' name='3dnow'/> + <feature policy='disable' name='vmx'/> + <feature policy='disable' name='ds_cpl'/> + <feature policy='disable' name='sse'/> + <feature policy='forbid' name='popcnt'/> </cpu> diff --git a/tests/cputestdata/x86-host+guest,models-result.xml b/tests/cputestdata/x86-host+guest,models-result.xml index 6cd0668..e7a77c2 100644 --- a/tests/cputestdata/x86-host+guest,models-result.xml +++ b/tests/cputestdata/x86-host+guest,models-result.xml @@ -1,13 +1,18 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Nehalem</model> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> + <vendor>Intel</vendor> + <topology sockets='2' cores='4' threads='1'/> + <feature policy='force' name='pbe'/> + <feature policy='force' name='monitor'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='dca'/> - <feature policy='require' name='3dnowext'/> - <feature policy='require' name='svm'/> + <feature policy='force' name='3dnowext'/> + <feature policy='force' name='svm'/> <feature policy='disable' name='sse'/> <feature policy='disable' name='sse4.2'/> - <feature policy='disable' name='popcnt'/> + <feature policy='forbid' name='popcnt'/> + <feature policy='disable' name='3dnow'/> + <feature policy='require' name='ssse3'/> + <feature policy='disable' name='vmx'/> + <feature policy='disable' name='ds_cpl'/> </cpu> diff --git a/tests/cputestdata/x86-host+guest-result.xml b/tests/cputestdata/x86-host+guest-result.xml index 6082b7b..137a3d6 100644 --- a/tests/cputestdata/x86-host+guest-result.xml +++ b/tests/cputestdata/x86-host+guest-result.xml @@ -1,11 +1,17 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Penryn</model> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='xtpr'/> + <topology sockets='2' cores='4' threads='1'/> <feature policy='require' name='dca'/> - <feature policy='require' name='3dnowext'/> - <feature policy='require' name='svm'/> + <feature policy='require' name='xtpr'/> + <feature policy='disable' name='sse4.2'/> + <feature policy='disable' name='3dnow'/> + <feature policy='require' name='ssse3'/> + <feature policy='disable' name='vmx'/> + <feature policy='disable' name='ds_cpl'/> <feature policy='disable' name='sse'/> + <feature policy='force' name='monitor'/> + <feature policy='force' name='pbe'/> + <feature policy='force' name='3dnowext'/> + <feature policy='force' name='svm'/> + <feature policy='forbid' name='popcnt'/> </cpu> diff --git a/tests/cputestdata/x86-host+host+host-model,models-result.xml b/tests/cputestdata/x86-host+host+host-model,models-result.xml index 63d5e90..4be4701 100644 --- a/tests/cputestdata/x86-host+host+host-model,models-result.xml +++ b/tests/cputestdata/x86-host+host+host-model,models-result.xml @@ -1,5 +1,4 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>core2duo</model> <vendor>Intel</vendor> <feature policy='require' name='ds'/> @@ -17,4 +16,6 @@ <feature policy='require' name='dca'/> <feature policy='require' name='sse4.1'/> <feature policy='require' name='lahf_lm'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='vme'/> </cpu> diff --git a/tests/cputestdata/x86-host+penryn-force-result.xml b/tests/cputestdata/x86-host+penryn-force-result.xml index ef0a2c0..bb624c0 100644 --- a/tests/cputestdata/x86-host+penryn-force-result.xml +++ b/tests/cputestdata/x86-host+penryn-force-result.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Penryn</model> - <feature policy='require' name='sse4.2'/> - <feature policy='require' name='popcnt'/> + <feature policy='force' name='popcnt'/> + <feature policy='force' name='sse4.2'/> </cpu> diff --git a/tests/cputestdata/x86-host+strict-force-extra-result.xml b/tests/cputestdata/x86-host+strict-force-extra-result.xml index 958d458..74b3327 100644 --- a/tests/cputestdata/x86-host+strict-force-extra-result.xml +++ b/tests/cputestdata/x86-host+strict-force-extra-result.xml @@ -1,19 +1,18 @@ -<cpu mode='custom' match='exact'> - <arch>x86_64</arch> +<cpu mode='custom' match='strict'> <model fallback='allow'>Penryn</model> - <feature policy='require' name='vme'/> - <feature policy='require' name='ds'/> - <feature policy='require' name='acpi'/> - <feature policy='require' name='ss'/> - <feature policy='require' name='ht'/> - <feature policy='require' name='tm'/> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='ds_cpl'/> - <feature policy='require' name='vmx'/> - <feature policy='require' name='est'/> - <feature policy='require' name='tm2'/> - <feature policy='require' name='xtpr'/> <feature policy='require' name='dca'/> - <feature policy='require' name='3dnow'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='est'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='vme'/> + <feature policy='force' name='3dnow'/> </cpu> diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml index dfdca13..2dbe06c 100644 --- a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml +++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell,haswell-result.xml @@ -1,6 +1,6 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Haswell</model> - <feature policy='disable' name='hle'/> + <topology sockets='1' cores='2' threads='2'/> <feature policy='disable' name='rtm'/> + <feature policy='disable' name='hle'/> </cpu> diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml index dfdca13..5902f6c 100644 --- a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml +++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml @@ -1,6 +1,7 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Haswell</model> + <vendor>Intel</vendor> + <topology sockets='1' cores='2' threads='2'/> <feature policy='disable' name='hle'/> <feature policy='disable' name='rtm'/> </cpu> diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml index f5a67fb..3b74089 100644 --- a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml +++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX-result.xml @@ -1,4 +1,4 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Haswell-noTSX</model> + <topology sockets='1' cores='2' threads='2'/> </cpu> diff --git a/tests/cputestdata/x86-host-better+pentium3-result.xml b/tests/cputestdata/x86-host-better+pentium3-result.xml index a37b368..12336da 100644 --- a/tests/cputestdata/x86-host-better+pentium3-result.xml +++ b/tests/cputestdata/x86-host-better+pentium3-result.xml @@ -1,18 +1,18 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Nehalem</model> - <feature policy='require' name='vme'/> - <feature policy='require' name='ds'/> - <feature policy='require' name='acpi'/> - <feature policy='require' name='ss'/> - <feature policy='require' name='ht'/> - <feature policy='require' name='tm'/> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='ds_cpl'/> - <feature policy='require' name='vmx'/> - <feature policy='require' name='est'/> - <feature policy='require' name='tm2'/> - <feature policy='require' name='xtpr'/> + <vendor>Intel</vendor> <feature policy='require' name='dca'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='est'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='monitor'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='ds'/> + <feature policy='require' name='vme'/> </cpu> diff --git a/tests/cputestdata/x86-host-worse+guest-result.xml b/tests/cputestdata/x86-host-worse+guest-result.xml index 6b9c74a..2edc875 100644 --- a/tests/cputestdata/x86-host-worse+guest-result.xml +++ b/tests/cputestdata/x86-host-worse+guest-result.xml @@ -1,9 +1,17 @@ <cpu mode='custom' match='exact'> - <arch>x86_64</arch> <model fallback='allow'>Penryn</model> - <feature policy='require' name='pbe'/> - <feature policy='require' name='monitor'/> - <feature policy='require' name='3dnowext'/> - <feature policy='require' name='svm'/> + <topology sockets='2' cores='4' threads='1'/> + <feature policy='disable' name='dca'/> + <feature policy='disable' name='xtpr'/> + <feature policy='disable' name='sse4.2'/> + <feature policy='disable' name='3dnow'/> + <feature policy='require' name='ssse3'/> + <feature policy='disable' name='vmx'/> + <feature policy='disable' name='ds_cpl'/> <feature policy='disable' name='sse'/> + <feature policy='force' name='monitor'/> + <feature policy='force' name='pbe'/> + <feature policy='force' name='3dnowext'/> + <feature policy='force' name='svm'/> + <feature policy='forbid' name='popcnt'/> </cpu> -- 2.10.2

PPC driver needs to convert POWERx_v* legacy CPU model names into POWERx to maintain backward compatibility with existing domains. This patch adds a new step into the guest CPU configuration work flow which CPU drivers can use to convert legacy CPU definitions. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 35 +++++++++++++++++++++++++++++++++++ src/cpu/cpu.h | 8 ++++++++ src/cpu/cpu_ppc64.c | 30 ++++++++++++------------------ src/libvirt_private.syms | 1 + src/qemu/qemu_process.c | 3 +++ tests/cputest.c | 5 ++++- 6 files changed, 63 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 9d34206..4a5fbb1 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -934,3 +934,38 @@ virCPUTranslate(virArch arch, VIR_DEBUG("model=%s", NULLSTR(cpu->model)); return 0; } + + +/** + * virCPUConvertLegacy: + * + * @arch: CPU architecture + * @cpu: CPU definition to be converted + * + * Convert legacy CPU definition into one that the corresponding cpu driver + * will be able to work with. Currently this is only implemented by the PPC + * driver, which needs to convert legacy POWERx_v* names into POWERx. + * + * Returns -1 on error, 0 on success. + */ +int +virCPUConvertLegacy(virArch arch, + virCPUDefPtr cpu) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("arch=%s, cpu=%p, model=%s", + virArchToString(arch), cpu, NULLSTR(cpu->model)); + + if (!(driver = cpuGetSubDriver(arch))) + return -1; + + if (!driver->convertLegacy) + return 0; + + if (driver->convertLegacy(cpu) < 0) + return -1; + + VIR_DEBUG("model=%s", NULLSTR(cpu->model)); + return 0; +} diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 5ad8112..ff48fb5 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -112,6 +112,9 @@ typedef int const char **models, unsigned int nmodels); +typedef int +(*virCPUArchConvertLegacy)(virCPUDefPtr cpu); + struct cpuArchDriver { const char *name; const virArch *arch; @@ -130,6 +133,7 @@ struct cpuArchDriver { virCPUArchDataParse dataParse; virCPUArchGetModels getModels; virCPUArchTranslate translate; + virCPUArchConvertLegacy convertLegacy; }; @@ -229,6 +233,10 @@ virCPUTranslate(virArch arch, unsigned int nmodels) ATTRIBUTE_NONNULL(2); +int +virCPUConvertLegacy(virArch arch, + virCPUDefPtr cpu) + ATTRIBUTE_NONNULL(2); /* virCPUDataFormat and virCPUDataParse are implemented for unit tests only and * have no real-life usage diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index bdb026b..8b71ef5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -63,26 +63,18 @@ struct ppc64_map { * POWER7_v2.3 => POWER7 * POWER7+_v2.1 => POWER7 * POWER8_v1.0 => POWER8 */ -static virCPUDefPtr -ppc64ConvertLegacyCPUDef(const virCPUDef *legacy) +static int +virCPUppc64ConvertLegacy(virCPUDefPtr cpu) { - virCPUDefPtr cpu; - - if (!(cpu = virCPUDefCopy(legacy))) - goto out; - - if (!cpu->model || - !(STREQ(cpu->model, "POWER7_v2.1") || - STREQ(cpu->model, "POWER7_v2.3") || - STREQ(cpu->model, "POWER7+_v2.1") || - STREQ(cpu->model, "POWER8_v1.0"))) { - goto out; + if (cpu->model && + (STREQ(cpu->model, "POWER7_v2.1") || + STREQ(cpu->model, "POWER7_v2.3") || + STREQ(cpu->model, "POWER7+_v2.1") || + STREQ(cpu->model, "POWER8_v1.0"))) { + cpu->model[strlen("POWERx")] = 0; } - cpu->model[strlen("POWERx")] = 0; - - out: - return cpu; + return 0; } /* Some hosts can run guests in compatibility mode, but not all @@ -519,7 +511,8 @@ ppc64Compute(virCPUDefPtr host, size_t i; /* Ensure existing configurations are handled correctly */ - if (!(cpu = ppc64ConvertLegacyCPUDef(other))) + if (!(cpu = virCPUDefCopy(other)) || + virCPUppc64ConvertLegacy(cpu) < 0) goto cleanup; if (cpu->arch != VIR_ARCH_NONE) { @@ -922,4 +915,5 @@ struct cpuArchDriver cpuDriverPPC64 = { .baseline = ppc64DriverBaseline, .update = virCPUppc64Update, .getModels = virCPUppc64DriverGetModels, + .convertLegacy = virCPUppc64ConvertLegacy, }; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 41b674d..38f8ecb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -983,6 +983,7 @@ cpuNodeData; virCPUCheckFeature; virCPUCompare; virCPUCompareXML; +virCPUConvertLegacy; virCPUDataCheckFeature; virCPUDataFormat; virCPUDataParse; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 14c799e..3552a31 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5066,6 +5066,9 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, return -1; } + if (virCPUConvertLegacy(caps->host.arch, def->cpu) < 0) + return -1; + /* nothing to update for host-passthrough */ if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) return 0; diff --git a/tests/cputest.c b/tests/cputest.c index 1d7f6bc..8612e92 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -251,6 +251,9 @@ cpuTestGuestCPU(const void *arg) !(cpu = cpuTestLoadXML(data->arch, data->name))) goto cleanup; + if (virCPUConvertLegacy(host->arch, cpu) < 0) + goto cleanup; + cmpResult = virCPUCompare(host->arch, host, cpu, false); if (cmpResult == VIR_CPU_COMPARE_ERROR || cmpResult == VIR_CPU_COMPARE_INCOMPATIBLE) { @@ -794,7 +797,7 @@ mymain(void) DO_TEST_GUESTCPU("ppc64", "host", "guest", ppc_models, 0); DO_TEST_GUESTCPU("ppc64", "host", "guest-nofallback", ppc_models, -1); - DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, /*0*/ -1); + DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, 0); DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-incompatible", ppc_models, -1); DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy-invalid", ppc_models, -1); -- 2.10.2

Guest CPU definitions with mode='custom' and missing <vendor> are expected to run on a host CPU from any vendor as long as the required CPU model can be used as a guest CPU on the host. But even though no CPU vendor was explicitly requested we would sometimes force it due to a bug in virCPUUpdate and virCPUTranslate. The bug would effectively forbid cross vendor migrations even if they were previously working just fine. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/conf/cpu_conf.c | 28 +++++++++++++++++++--- src/conf/cpu_conf.h | 3 ++- src/cpu/cpu_arm.c | 2 +- src/cpu/cpu_x86.c | 5 ++-- .../cputestdata/x86-host+guest,model486-result.xml | 1 - tests/cputestdata/x86-host+guest,models-result.xml | 1 - tests/cputestdata/x86-host+min.xml | 1 - tests/cputestdata/x86-host+pentium3.xml | 1 - ...-Haswell-noTSX+Haswell-noTSX,haswell-result.xml | 1 - .../x86-host-better+pentium3-result.xml | 1 - 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index f174529..9eb69c9 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -132,20 +132,42 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst, } +/** + * virCPUDefStealModel: + * + * Move CPU model related parts virCPUDef from @src to @dst. If @keepVendor + * is true, the function keeps the original vendor/vendor_id in @dst rather + * than overwriting it with the values from @src. + */ void virCPUDefStealModel(virCPUDefPtr dst, - virCPUDefPtr src) + virCPUDefPtr src, + bool keepVendor) { + char *vendor; + char *vendor_id; + + if (keepVendor) { + VIR_STEAL_PTR(vendor, dst->vendor); + VIR_STEAL_PTR(vendor_id, dst->vendor_id); + } + virCPUDefFreeModel(dst); VIR_STEAL_PTR(dst->model, src->model); - VIR_STEAL_PTR(dst->vendor, src->vendor); - VIR_STEAL_PTR(dst->vendor_id, src->vendor_id); VIR_STEAL_PTR(dst->features, src->features); dst->nfeatures_max = src->nfeatures_max; src->nfeatures_max = 0; dst->nfeatures = src->nfeatures; src->nfeatures = 0; + + if (keepVendor) { + dst->vendor = vendor; + dst->vendor_id = vendor_id; + } else { + VIR_STEAL_PTR(dst->vendor, src->vendor); + VIR_STEAL_PTR(dst->vendor_id, src->vendor_id); + } } diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index e084392..cc3fbf0 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -139,7 +139,8 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst, void virCPUDefStealModel(virCPUDefPtr dst, - virCPUDefPtr src); + virCPUDefPtr src, + bool keepVendor); virCPUDefPtr virCPUDefCopy(const virCPUDef *cpu); diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index db603a6..b5002c3 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -67,7 +67,7 @@ virCPUarmUpdate(virCPUDefPtr guest, if (virCPUDefCopyModel(updated, host, true) < 0) goto cleanup; - virCPUDefStealModel(guest, updated); + virCPUDefStealModel(guest, updated, false); guest->mode = VIR_CPU_MODE_CUSTOM; guest->match = VIR_CPU_MATCH_EXACT; ret = 0; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 4f2a111..851ec5d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2576,7 +2576,8 @@ x86UpdateHostModel(virCPUDefPtr guest, goto cleanup; } - virCPUDefStealModel(guest, updated); + virCPUDefStealModel(guest, updated, + guest->mode == VIR_CPU_MODE_CUSTOM); guest->mode = VIR_CPU_MODE_CUSTOM; guest->match = VIR_CPU_MATCH_EXACT; ret = 0; @@ -2737,7 +2738,7 @@ virCPUx86Translate(virCPUDefPtr cpu, goto cleanup; } - virCPUDefStealModel(cpu, translated); + virCPUDefStealModel(cpu, translated, true); ret = 0; cleanup: diff --git a/tests/cputestdata/x86-host+guest,model486-result.xml b/tests/cputestdata/x86-host+guest,model486-result.xml index 88df467..85564ff 100644 --- a/tests/cputestdata/x86-host+guest,model486-result.xml +++ b/tests/cputestdata/x86-host+guest,model486-result.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>486</model> - <vendor>Intel</vendor> <topology sockets='2' cores='4' threads='1'/> <feature policy='require' name='de'/> <feature policy='require' name='tsc'/> diff --git a/tests/cputestdata/x86-host+guest,models-result.xml b/tests/cputestdata/x86-host+guest,models-result.xml index e7a77c2..f79ed32 100644 --- a/tests/cputestdata/x86-host+guest,models-result.xml +++ b/tests/cputestdata/x86-host+guest,models-result.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>Nehalem</model> - <vendor>Intel</vendor> <topology sockets='2' cores='4' threads='1'/> <feature policy='force' name='pbe'/> <feature policy='force' name='monitor'/> diff --git a/tests/cputestdata/x86-host+min.xml b/tests/cputestdata/x86-host+min.xml index a284767..8101151 100644 --- a/tests/cputestdata/x86-host+min.xml +++ b/tests/cputestdata/x86-host+min.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>Penryn</model> - <vendor>Intel</vendor> <feature policy='require' name='dca'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='tm2'/> diff --git a/tests/cputestdata/x86-host+pentium3.xml b/tests/cputestdata/x86-host+pentium3.xml index a284767..8101151 100644 --- a/tests/cputestdata/x86-host+pentium3.xml +++ b/tests/cputestdata/x86-host+pentium3.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>Penryn</model> - <vendor>Intel</vendor> <feature policy='require' name='dca'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='tm2'/> diff --git a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml index 5902f6c..5d149bb 100644 --- a/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml +++ b/tests/cputestdata/x86-host-Haswell-noTSX+Haswell-noTSX,haswell-result.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>Haswell</model> - <vendor>Intel</vendor> <topology sockets='1' cores='2' threads='2'/> <feature policy='disable' name='hle'/> <feature policy='disable' name='rtm'/> diff --git a/tests/cputestdata/x86-host-better+pentium3-result.xml b/tests/cputestdata/x86-host-better+pentium3-result.xml index 12336da..9d4f98f 100644 --- a/tests/cputestdata/x86-host-better+pentium3-result.xml +++ b/tests/cputestdata/x86-host-better+pentium3-result.xml @@ -1,6 +1,5 @@ <cpu mode='custom' match='exact'> <model fallback='allow'>Nehalem</model> - <vendor>Intel</vendor> <feature policy='require' name='dca'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='tm2'/> -- 2.10.2

The API is not used anywhere in the code. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/cpu/cpu.c | 41 ----------------------------------------- src/cpu/cpu.h | 14 -------------- src/cpu/cpu_arm.c | 10 ---------- src/cpu/cpu_ppc64.c | 9 --------- src/cpu/cpu_s390.c | 1 - src/cpu/cpu_x86.c | 17 ----------------- src/libvirt_private.syms | 1 - 7 files changed, 93 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 4a5fbb1..64419ee 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -373,47 +373,6 @@ cpuNodeData(virArch arch) /** - * cpuGuestData: - * - * @host: host CPU definition - * @guest: guest CPU definition - * @data: computed guest CPU data - * @msg: error message describing why the @guest and @host CPUs are considered - * incompatible - * - * Computes guest CPU data for the @guest CPU definition when run on the @host - * CPU. - * - * Returns VIR_CPU_COMPARE_ERROR on error, VIR_CPU_COMPARE_INCOMPATIBLE when - * the two CPUs are incompatible (@msg will describe the incompatibility), - * VIR_CPU_COMPARE_IDENTICAL when the two CPUs are identical, - * VIR_CPU_COMPARE_SUPERSET when the @guest CPU is a superset of the @host CPU. - */ -virCPUCompareResult -cpuGuestData(virCPUDefPtr host, - virCPUDefPtr guest, - virCPUDataPtr *data, - char **msg) -{ - struct cpuArchDriver *driver; - - VIR_DEBUG("host=%p, guest=%p, data=%p, msg=%p", host, guest, data, msg); - - if ((driver = cpuGetSubDriver(host->arch)) == NULL) - return VIR_CPU_COMPARE_ERROR; - - if (driver->guestData == NULL) { - virReportError(VIR_ERR_NO_SUPPORT, - _("cannot compute guest CPU data for %s architecture"), - virArchToString(host->arch)); - return VIR_CPU_COMPARE_ERROR; - } - - return driver->guestData(host, guest, data, msg); -} - - -/** * cpuBaselineXML: * * @xmlCPUs: list of host CPU XML descriptions diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index ff48fb5..69c17e7 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -73,12 +73,6 @@ typedef void typedef virCPUDataPtr (*cpuArchNodeData) (virArch arch); -typedef virCPUCompareResult -(*cpuArchGuestData) (virCPUDefPtr host, - virCPUDefPtr guest, - virCPUDataPtr *data, - char **message); - typedef virCPUDefPtr (*cpuArchBaseline) (virCPUDefPtr *cpus, unsigned int ncpus, @@ -124,7 +118,6 @@ struct cpuArchDriver { cpuArchEncode encode; cpuArchDataFree free; cpuArchNodeData nodeData; - cpuArchGuestData guestData; cpuArchBaseline baseline; virCPUArchUpdate update; virCPUArchCheckFeature checkFeature; @@ -175,13 +168,6 @@ cpuDataFree (virCPUDataPtr data); virCPUDataPtr cpuNodeData (virArch arch); -virCPUCompareResult -cpuGuestData(virCPUDefPtr host, - virCPUDefPtr guest, - virCPUDataPtr *data, - char **msg) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); - char * cpuBaselineXML(const char **xmlCPUs, unsigned int ncpus, diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index b5002c3..653b06b 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -78,15 +78,6 @@ virCPUarmUpdate(virCPUDefPtr guest, } -static virCPUCompareResult -armGuestData(virCPUDefPtr host ATTRIBUTE_UNUSED, - virCPUDefPtr guest ATTRIBUTE_UNUSED, - virCPUDataPtr *data ATTRIBUTE_UNUSED, - char **message ATTRIBUTE_UNUSED) -{ - return VIR_CPU_COMPARE_IDENTICAL; -} - static virCPUDefPtr armBaseline(virCPUDefPtr *cpus, unsigned int ncpus ATTRIBUTE_UNUSED, @@ -128,7 +119,6 @@ struct cpuArchDriver cpuDriverArm = { .encode = NULL, .free = armDataFree, .nodeData = NULL, - .guestData = armGuestData, .baseline = armBaseline, .update = virCPUarmUpdate, }; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 8b71ef5..225fb6d 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -745,14 +745,6 @@ ppc64DriverNodeData(virArch arch) return NULL; } -static virCPUCompareResult -ppc64DriverGuestData(virCPUDefPtr host, - virCPUDefPtr guest, - virCPUDataPtr *data, - char **message) -{ - return ppc64Compute(host, guest, data, message); -} static int virCPUppc64Update(virCPUDefPtr guest, @@ -911,7 +903,6 @@ struct cpuArchDriver cpuDriverPPC64 = { .encode = NULL, .free = ppc64DriverFree, .nodeData = ppc64DriverNodeData, - .guestData = ppc64DriverGuestData, .baseline = ppc64DriverBaseline, .update = virCPUppc64Update, .getModels = virCPUppc64DriverGetModels, diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index fb352a0..04a6bea 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -80,7 +80,6 @@ struct cpuArchDriver cpuDriverS390 = { .encode = NULL, .free = s390DataFree, .nodeData = s390NodeData, - .guestData = NULL, .baseline = NULL, .update = NULL, }; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 851ec5d..e91850f 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1725,22 +1725,6 @@ virCPUx86Compare(virCPUDefPtr host, } -static virCPUCompareResult -x86GuestData(virCPUDefPtr host, - virCPUDefPtr guest, - virCPUDataPtr *data, - char **message) -{ - if (!guest->model) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("no guest CPU model specified")); - return VIR_CPU_COMPARE_ERROR; - } - - return x86Compute(host, guest, data, message); -} - - /* * Checks whether a candidate model is a better fit for the CPU data than the * current model. @@ -2761,7 +2745,6 @@ struct cpuArchDriver cpuDriverX86 = { #else .nodeData = NULL, #endif - .guestData = x86GuestData, .baseline = x86Baseline, .update = virCPUx86Update, .checkFeature = virCPUx86CheckFeature, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 38f8ecb..baff82b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -978,7 +978,6 @@ cpuBaselineXML; cpuDataFree; cpuDecode; cpuEncode; -cpuGuestData; cpuNodeData; virCPUCheckFeature; virCPUCompare; -- 2.10.2

On Thu, Nov 10, 2016 at 11:39:25PM +0100, Jiri Denemark wrote:
This is another step in revisiting all APIs provided by the cpu driver and making them a bit more sane. As with the previous round(s), the updated APIs will gain virCPU prefix so that they can be easily distinguished from the ones that still need some work.
Jiri Denemark (14): cpu: Rename cpuGetModels cpu: Rename and document cpuModelIsAllowed cpu: Rename cpuDataParse cpu: Rename cpuDataFormat cputest: Don't use preferred model for minimum match CPUs cputest: Don't use unsupported preferred model cputest: Don't use preferred model with forbidden fallback cputest: Don't use superfluous preferred model cputest: Don't use preferred CPU model at all cpu: Make models array in virCPUTranslate constant cputest: Don't test cpuGuestData cpu: Introduce virCPUConvertLegacy API cpu: Avoid adding <vendor> to custom CPUs cpu: Drop cpuGuestData
ACK series Pavel

On Tue, Nov 15, 2016 at 15:30:35 +0100, Pavel Hrdina wrote:
On Thu, Nov 10, 2016 at 11:39:25PM +0100, Jiri Denemark wrote:
This is another step in revisiting all APIs provided by the cpu driver and making them a bit more sane. As with the previous round(s), the updated APIs will gain virCPU prefix so that they can be easily distinguished from the ones that still need some work.
Jiri Denemark (14): cpu: Rename cpuGetModels cpu: Rename and document cpuModelIsAllowed cpu: Rename cpuDataParse cpu: Rename cpuDataFormat cputest: Don't use preferred model for minimum match CPUs cputest: Don't use unsupported preferred model cputest: Don't use preferred model with forbidden fallback cputest: Don't use superfluous preferred model cputest: Don't use preferred CPU model at all cpu: Make models array in virCPUTranslate constant cputest: Don't test cpuGuestData cpu: Introduce virCPUConvertLegacy API cpu: Avoid adding <vendor> to custom CPUs cpu: Drop cpuGuestData
ACK series
Thanks, pushed. Jirka

On Thu, 2016-11-10 at 23:39 +0100, Jiri Denemark wrote:
This is another step in revisiting all APIs provided by the cpu driver and making them a bit more sane. As with the previous round(s), the updated APIs will gain virCPU prefix so that they can be easily distinguished from the ones that still need some work. Jiri Denemark (14): cpu: Rename cpuGetModels cpu: Rename and document cpuModelIsAllowed cpu: Rename cpuDataParse cpu: Rename cpuDataFormat cputest: Don't use preferred model for minimum match CPUs cputest: Don't use unsupported preferred model cputest: Don't use preferred model with forbidden fallback cputest: Don't use superfluous preferred model cputest: Don't use preferred CPU model at all cpu: Make models array in virCPUTranslate constant cputest: Don't test cpuGuestData cpu: Introduce virCPUConvertLegacy API cpu: Avoid adding <vendor> to custom CPUs cpu: Drop cpuGuestData
These changes don't seem to be user-visible, right? If they aren't we can safely keep them out of the NEWS file, or just go for a very broad "CPU driver improvements"... -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Jiri Denemark
-
Pavel Hrdina