From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129851957325.86146645340193; Wed, 4 Oct 2017 08:10:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDFF13B73A; Wed, 4 Oct 2017 15:10:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B8D660472; Wed, 4 Oct 2017 15:10:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 625F918355C4; Wed, 4 Oct 2017 15:10:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwrFP006792 for ; Wed, 4 Oct 2017 10:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA9835EE04; Wed, 4 Oct 2017 14:58:53 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98CC763629 for ; Wed, 4 Oct 2017 14:58:51 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 2BA3910008B; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CDFF13B73A Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:25 +0200 Message-Id: <2a43786dfea140f4e5add1db69a7732126e72f3f.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/23] util: Introduce virStringListCopy X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Oct 2017 15:10:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The API makes a deep copy of a NULL-terminated string list. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/util/virstring.c | 37 +++++++++++++++++++++++++++++++++++++ src/util/virstring.h | 3 +++ 2 files changed, 40 insertions(+) diff --git a/src/util/virstring.c b/src/util/virstring.c index 0288d1e677..820b282ac5 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -239,6 +239,43 @@ virStringListRemove(char ***strings, } =20 =20 +/** + * virStringListCopy: + * @dst: where to store the copy of @strings + * @src: a NULL-terminated array of strings + * + * Makes a deep copy of the @src string list and stores it in @dst. Callers + * are responsible for freeing both @dst and @src. + * + * Returns 0 on success, -1 on error. + */ +int +virStringListCopy(char ***dst, + const char **src) +{ + char **copy =3D NULL; + size_t i; + + if (!src) + return 0; + + if (VIR_ALLOC_N(copy, virStringListLength(src) + 1) < 0) + goto error; + + for (i =3D 0; src[i]; i++) { + if (VIR_STRDUP(copy[i], src[i]) < 0) + goto error; + } + + *dst =3D copy; + return 0; + + error: + virStringListFree(copy); + return -1; +} + + /** * virStringListFree: * @str_array: a NULL-terminated array of strings to free diff --git a/src/util/virstring.h b/src/util/virstring.h index 1290fcce15..cfd91be314 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -46,6 +46,9 @@ char **virStringListAdd(const char **strings, void virStringListRemove(char ***strings, const char *item); =20 +int virStringListCopy(char ***dst, + const char **src); + void virStringListFree(char **strings); void virStringListFreeCount(char **strings, size_t count); --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129875046610.9338149485877; Wed, 4 Oct 2017 08:11:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F5D8C059B7C; Wed, 4 Oct 2017 15:11:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC6CE5C8B2; Wed, 4 Oct 2017 15:11:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6851718355C5; Wed, 4 Oct 2017 15:11:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewsx7006805 for ; Wed, 4 Oct 2017 10:58:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0DC9E5C8B2; Wed, 4 Oct 2017 14:58:54 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF80F5C8BA for ; Wed, 4 Oct 2017 14:58:51 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 2DA5410174C; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F5D8C059B7C Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:26 +0200 Message-Id: <323787c916bf5c1f05909ff206778332d434e37e.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/23] conf: Add usability blockers to virDomainCapsCPUModel X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Oct 2017 15:11:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When a hypervisor marks a CPU model as unusable on the current host, it may also give us a list of features which prevent the model from being usable. Storing this list in virDomainCapsCPUModel will help the CPU driver with creating a host-model CPU configuration. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/conf/domain_capabilities.c | 30 ++++++++++++++++++++++-------- src/conf/domain_capabilities.h | 7 +++++-- src/qemu/qemu_capabilities.c | 11 ++++++----- tests/domaincapstest.c | 6 +++--- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index f62038b96c..be34576204 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -163,7 +163,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr ol= d) for (i =3D 0; i < old->nmodels; i++) { if (virDomainCapsCPUModelsAdd(cpuModels, old->models[i].name, -1, - old->models[i].usable) < 0) + old->models[i].usable, + old->models[i].blockers) < 0) goto error; } =20 @@ -195,7 +196,8 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr = old, =20 if (virDomainCapsCPUModelsAdd(cpuModels, old->models[i].name, -1, - old->models[i].usable) < 0) + old->models[i].usable, + old->models[i].blockers) < 0) goto error; } =20 @@ -210,7 +212,8 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr = old, int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels, char **name, - virDomainCapsCPUUsable usable) + virDomainCapsCPUUsable usable, + char ***blockers) { if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max, cpuModels->nmodels, 1) < 0) @@ -218,6 +221,10 @@ virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsP= tr cpuModels, =20 cpuModels->models[cpuModels->nmodels].usable =3D usable; VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].name, *name); + + if (blockers) + VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].blockers, *blo= ckers); + cpuModels->nmodels++; return 0; } @@ -227,20 +234,27 @@ int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, ssize_t nameLen, - virDomainCapsCPUUsable usable) + virDomainCapsCPUUsable usable, + char **blockers) { - char *copy =3D NULL; + char *nameCopy =3D NULL; + char **blockersCopy =3D NULL; =20 - if (VIR_STRNDUP(copy, name, nameLen) < 0) + if (VIR_STRNDUP(nameCopy, name, nameLen) < 0) goto error; =20 - if (virDomainCapsCPUModelsAddSteal(cpuModels, ©, usable) < 0) + if (virStringListCopy(&blockersCopy, (const char **)blockers) < 0) + goto error; + + if (virDomainCapsCPUModelsAddSteal(cpuModels, &nameCopy, + usable, &blockersCopy) < 0) goto error; =20 return 0; =20 error: - VIR_FREE(copy); + VIR_FREE(nameCopy); + virStringListFree(blockersCopy); return -1; } =20 diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 82183c4524..8c71dec21e 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -116,6 +116,7 @@ typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr; struct _virDomainCapsCPUModel { char *name; virDomainCapsCPUUsable usable; + char **blockers; /* NULL-terminated list of usability blockers */ }; =20 typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels; @@ -171,11 +172,13 @@ virDomainCapsCPUModelsPtr virDomainCapsCPUModelsFilte= r(virDomainCapsCPUModelsPtr const char **blackl= ist); int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels, char **name, - virDomainCapsCPUUsable usable); + virDomainCapsCPUUsable usable, + char ***blockers); int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, ssize_t nameLen, - virDomainCapsCPUUsable usable); + virDomainCapsCPUUsable usable, + char **blockers); =20 # define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \ do { \ diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 085910dd4d..b20dd6ec32 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -795,7 +795,7 @@ virQEMUCapsParseX86Models(const char *output, } =20 if (virDomainCapsCPUModelsAdd(cpus, p, len, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0) + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= ) < 0) goto error; } while ((p =3D next)); =20 @@ -853,7 +853,7 @@ virQEMUCapsParsePPCModels(const char *output, continue; =20 if (virDomainCapsCPUModelsAdd(cpus, p, t - p - 1, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0) + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= ) < 0) goto error; } while ((p =3D next)); =20 @@ -2524,7 +2524,7 @@ virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps, } =20 for (i =3D 0; i < count; i++) { - if (virDomainCapsCPUModelsAdd(cpus, name[i], -1, usable) < 0) + if (virDomainCapsCPUModelsAdd(cpus, name[i], -1, usable, NULL) < 0) return -1; } =20 @@ -3005,7 +3005,8 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemu= Caps, else if (cpus[i]->usable =3D=3D VIR_TRISTATE_BOOL_NO) usable =3D VIR_DOMCAPS_CPU_USABLE_NO; =20 - if (virDomainCapsCPUModelsAddSteal(models, &cpus[i]->name, usable)= < 0) + if (virDomainCapsCPUModelsAddSteal(models, &cpus[i]->name, usable, + NULL) < 0) goto cleanup; } =20 @@ -3768,7 +3769,7 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, goto cleanup; } =20 - if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable) < 0) + if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable, NULL) < 0) goto cleanup; } =20 diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 2719473244..7aeac4507f 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -88,11 +88,11 @@ fillAllCaps(virDomainCapsPtr domCaps) cpu->hostModel =3D virCPUDefCopy(&host); if (!(cpu->custom =3D virDomainCapsCPUModelsNew(3)) || virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 || + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL) < = 0 || virDomainCapsCPUModelsAdd(cpu->custom, "Model2", -1, - VIR_DOMCAPS_CPU_USABLE_NO) < 0 || + VIR_DOMCAPS_CPU_USABLE_NO, NULL) < 0 || virDomainCapsCPUModelsAdd(cpu->custom, "Model3", -1, - VIR_DOMCAPS_CPU_USABLE_YES) < 0) + VIR_DOMCAPS_CPU_USABLE_YES, NULL) < 0) return -1; =20 disk->supported =3D true; --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130319042840.2832300367168; Wed, 4 Oct 2017 08:18:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 151BD7EAA1; Wed, 4 Oct 2017 15:18:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1C2A6362E; Wed, 4 Oct 2017 15:18:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9A0D73FAD1; Wed, 4 Oct 2017 15:18:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwrTU006797 for ; Wed, 4 Oct 2017 10:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA0F75C8B2; Wed, 4 Oct 2017 14:58:53 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEF5D5C8B5 for ; Wed, 4 Oct 2017 14:58:51 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 30F28101D39; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 151BD7EAA1 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:27 +0200 Message-Id: <804fa566c0a9b07f01b5b51bac1273cf77b03360.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/23] qemu: Store CPU usability blockers in caps cache X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Oct 2017 15:18:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 51 ++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b20dd6ec32..1ce2aa375f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3727,6 +3727,10 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, size_t i; int n; int ret =3D -1; + xmlNodePtr node; + xmlNodePtr *blockerNodes =3D NULL; + char **blockers =3D NULL; + int nblockers; =20 if (type =3D=3D VIR_DOMAIN_VIRT_KVM) n =3D virXPathNodeSet("./cpu[@type=3D'kvm']", ctxt, &nodes); @@ -3769,7 +3773,34 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, goto cleanup; } =20 - if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable, NULL) < 0) + node =3D ctxt->node; + ctxt->node =3D nodes[i]; + nblockers =3D virXPathNodeSet("./blocker", ctxt, &blockerNodes); + ctxt->node =3D node; + + if (nblockers < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to parse qemu capabilities cpus")); + goto cleanup; + } + + if (nblockers > 0) { + size_t j; + + if (VIR_ALLOC_N(blockers, nblockers + 1) < 0) + goto cleanup; + + for (j =3D 0; j < nblockers; j++) { + if (!(blockers[j] =3D virXMLPropString(blockerNodes[j], "n= ame"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing blocker name in QEMU " + "capabilities cache")); + goto cleanup; + } + } + } + + if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable, &blockers) = < 0) goto cleanup; } =20 @@ -3778,6 +3809,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, cleanup: VIR_FREE(nodes); VIR_FREE(str); + VIR_FREE(blockerNodes); + virStringListFree(blockers); return ret; } =20 @@ -4135,7 +4168,21 @@ virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps, virBufferAsprintf(buf, " usable=3D'%s'", virDomainCapsCPUUsableTypeToString(cpu->usab= le)); } - virBufferAddLit(buf, "/>\n"); + + if (cpu->blockers) { + size_t j; + + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + + for (j =3D 0; cpu->blockers[j]; j++) + virBufferAsprintf(buf, "\n", cpu->bl= ockers[j]); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "/>\n"); + } } } =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129535538333.88917309954377; Wed, 4 Oct 2017 08:05:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C62E883D6; Wed, 4 Oct 2017 15:05:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3343963630; Wed, 4 Oct 2017 15:05:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F00793FAD1; Wed, 4 Oct 2017 15:05:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwwCE006905 for ; Wed, 4 Oct 2017 10:58:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 197246FDD8; Wed, 4 Oct 2017 14:58:58 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43AEA6FDDF for ; Wed, 4 Oct 2017 14:58:51 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 3682B101EEC; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5C62E883D6 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:28 +0200 Message-Id: <092a4ec2f3c6ac395152f09654b95ef22768a673.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/23] qemu: Parse unavailable features for CPU models X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Oct 2017 15:05:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" query-cpu-definitions QMP command returns a list of unavailable features which prevent CPU models from being usable on the current host. So far we only checked whether the list was empty to mark CPU models as (un)usable. This patch parses all unavailable features for each CPU model and stores them in virDomainCapsCPUModel as a list of usability blockers. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_monitor.c | 2 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 26 +- tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1102 +++++++++++++++++= ++-- tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 236 ++++- tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 154 ++- tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 154 ++- 8 files changed, 1556 insertions(+), 121 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1ce2aa375f..7ddc6cafd4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3006,7 +3006,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemu= Caps, usable =3D VIR_DOMCAPS_CPU_USABLE_NO; =20 if (virDomainCapsCPUModelsAddSteal(models, &cpus[i]->name, usable, - NULL) < 0) + &cpus[i]->blockers) < 0) goto cleanup; } =20 diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 363ad76cfe..04bf1ab5c1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3736,6 +3736,8 @@ qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cp= u) { if (!cpu) return; + + virStringListFree(cpu->blockers); VIR_FREE(cpu->name); VIR_FREE(cpu); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6414d2483a..ee6f27cf35 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -972,6 +972,7 @@ typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr; struct _qemuMonitorCPUDefInfo { virTristateBool usable; char *name; + char **blockers; /* NULL-terminated string list */ }; =20 int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index c63d250d36..fcdd58b369 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5076,6 +5076,8 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, =20 if (virJSONValueObjectHasKey(child, "unavailable-features")) { virJSONValuePtr blockers; + size_t j; + int len; =20 blockers =3D virJSONValueObjectGetArray(child, "unavailable-features"); @@ -5086,10 +5088,32 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, goto cleanup; } =20 - if (virJSONValueArraySize(blockers) > 0) + len =3D virJSONValueArraySize(blockers); + + if (len !=3D 0) cpu->usable =3D VIR_TRISTATE_BOOL_NO; else cpu->usable =3D VIR_TRISTATE_BOOL_YES; + + if (len > 0 && VIR_ALLOC_N(cpu->blockers, len + 1) < 0) + goto cleanup; + + for (j =3D 0; j < len; j++) { + virJSONValuePtr blocker =3D virJSONValueArrayGet(blockers,= j); + char *name; + + if (blocker->type !=3D VIR_JSON_TYPE_STRING) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected value in unavailable-feat= ures " + "array")); + goto cleanup; + } + + if (VIR_STRDUP(name, virJSONValueGetString(blocker)) < 0) + goto cleanup; + + cpu->blockers[j] =3D name; + } } } =20 diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.s390x.xml index 2806345b9d..1d3edc527b 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -241,72 +241,1050 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.10.0.x86_64.xml index 8a31431c09..1a4a73e0fb 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml @@ -700,7 +700,14 @@ - + + + + + + + + @@ -709,31 +716,104 @@ - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + - + + + + - - + + + + + + + + + + + + + + - + + + - + + + + @@ -744,22 +824,132 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.8.0.x86_64.xml index 761f9d1415..7cea98cb36 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -216,7 +216,14 @@ - + + + + + + + + @@ -225,14 +232,32 @@ - + + + + + - - - + + + + + + + + + + + + + + + + + @@ -243,10 +268,15 @@ - + + + - + + + + @@ -257,21 +287,111 @@ - - + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 3641d03323..c54ac89929 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -693,7 +693,14 @@ - + + + + + + + + @@ -702,14 +709,32 @@ - + + + + + - - - + + + + + + + + + + + + + + + + + @@ -721,11 +746,16 @@ - + + + - + + + + @@ -736,21 +766,111 @@ - - + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150712993184389.60367988405528; Wed, 4 Oct 2017 08:12:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF6A0C04AC7E; Wed, 4 Oct 2017 15:12:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9917C6027E; Wed, 4 Oct 2017 15:12:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6151918355C2; Wed, 4 Oct 2017 15:12:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwtxM006849 for ; Wed, 4 Oct 2017 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC3CC63626; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 499FC63630 for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 389B8101E2C; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BF6A0C04AC7E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:29 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/23] cpu: Use virDomainCapsCPUModelsPtr in cpu driver APIs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 04 Oct 2017 15:12:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All APIs which expect a list of CPU models supported by hypervisors were switched from char **models and int models to just accept a pointer to virDomainCapsCPUModels object stored in domain capabilities. This avoids the need to transform virDomainCapsCPUModelsPtr into a NULL-terminated list of model names and also allows the various cpu driver APIs to access additional details (such as its usability) about each CPU model. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/cpu/cpu.c | 78 +++++++++++++----------------------- src/cpu/cpu.h | 28 +++++-------- src/cpu/cpu_arm.c | 3 +- src/cpu/cpu_ppc64.c | 13 +++--- src/cpu/cpu_x86.c | 25 +++++------- src/libxl/libxl_capabilities.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_capabilities.c | 63 ++++++------------------------ src/qemu/qemu_capabilities.h | 6 +-- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 9 +---- src/test/test_driver.c | 2 +- tests/cputest.c | 89 ++++++++++++++++++++++++++++++--------= ---- 13 files changed, 138 insertions(+), 184 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index dc72ed42d8..842b0db2cd 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -192,7 +192,6 @@ virCPUCompare(virArch arch, * @cpu: CPU definition stub to be filled in * @data: internal CPU data to be decoded into @cpu definition * @models: list of CPU models that can be considered when decoding @data - * @nmodels: number of CPU models in @models * @preferred: CPU models that should be used if possible * * Decodes internal CPU data into a CPU definition consisting of a CPU mod= el @@ -214,24 +213,17 @@ virCPUCompare(virArch arch, int cpuDecode(virCPUDefPtr cpu, const virCPUData *data, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred) { struct cpuArchDriver *driver; =20 - VIR_DEBUG("cpu=3D%p, data=3D%p, nmodels=3D%u, preferred=3D%s", - cpu, data, nmodels, NULLSTR(preferred)); + VIR_DEBUG("cpu=3D%p, data=3D%p, models=3D%p, preferred=3D%s", + cpu, data, models, NULLSTR(preferred)); if (models) { size_t i; - for (i =3D 0; i < nmodels; i++) - VIR_DEBUG("models[%zu]=3D%s", i, NULLSTR(models[i])); - } - - if (models =3D=3D NULL && nmodels !=3D 0) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("nonzero nmodels doesn't match with NULL models")= ); - return -1; + for (i =3D 0; i < models->nmodels; i++) + VIR_DEBUG("models[%zu]=3D%s", i, models->models[i].name); } =20 if (cpu->type > VIR_CPU_TYPE_GUEST || @@ -251,7 +243,7 @@ cpuDecode(virCPUDefPtr cpu, return -1; } =20 - return driver->decode(cpu, data, models, nmodels, preferred); + return driver->decode(cpu, data, models, preferred); } =20 =20 @@ -384,7 +376,6 @@ virCPUGetHostIsSupported(virArch arch) * @type: requested type of the CPU * @nodeInfo: simplified CPU topology (optional) * @models: list of CPU models that can be considered for host CPU - * @nmodels: number of CPU models in @models * * Create CPU definition describing the host's CPU. * @@ -412,15 +403,14 @@ virCPUDefPtr virCPUGetHost(virArch arch, virCPUType type, virNodeInfoPtr nodeInfo, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { struct cpuArchDriver *driver; virCPUDefPtr cpu =3D NULL; =20 - VIR_DEBUG("arch=3D%s, type=3D%s, nodeInfo=3D%p, models=3D%p, nmodels= =3D%u", + VIR_DEBUG("arch=3D%s, type=3D%s, nodeInfo=3D%p, models=3D%p", virArchToString(arch), virCPUTypeToString(type), nodeInfo, - models, nmodels); + models); =20 if (!(driver =3D cpuGetSubDriver(arch))) return NULL; @@ -462,7 +452,7 @@ virCPUGetHost(virArch arch, * filled in. */ if (driver->getHost) { - if (driver->getHost(cpu, models, nmodels) < 0 && + if (driver->getHost(cpu, models) < 0 && !nodeInfo) goto error; } else if (nodeInfo) { @@ -491,7 +481,7 @@ virCPUProbeHost(virArch arch) if (virCapabilitiesGetNodeInfo(&nodeinfo)) return NULL; =20 - return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL, 0); + return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL); } =20 =20 @@ -501,11 +491,10 @@ virCPUProbeHost(virArch arch) * @cpus: list of host CPU definitions * @ncpus: number of CPUs in @cpus * @models: list of CPU models that can be considered for the baseline CPU - * @nmodels: number of CPU models in @models * @migratable: requests non-migratable features to be removed from the re= sult * * Computes the most feature-rich CPU which is compatible with all given - * host CPUs. If @models array is NULL, all models supported by libvirt wi= ll + * host CPUs. If @models is NULL, all models supported by libvirt will * be considered when computing the baseline CPU model, otherwise the base= line * CPU model will be one of the provided CPU @models. * @@ -514,21 +503,20 @@ virCPUProbeHost(virArch arch) virCPUDefPtr cpuBaseline(virCPUDefPtr *cpus, unsigned int ncpus, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, bool migratable) { struct cpuArchDriver *driver; size_t i; =20 - VIR_DEBUG("ncpus=3D%u, nmodels=3D%u", ncpus, nmodels); + VIR_DEBUG("ncpus=3D%u", ncpus); if (cpus) { for (i =3D 0; i < ncpus; i++) VIR_DEBUG("cpus[%zu]=3D%p", i, cpus[i]); } if (models) { - for (i =3D 0; i < nmodels; i++) - VIR_DEBUG("models[%zu]=3D%s", i, NULLSTR(models[i])); + for (i =3D 0; i < models->nmodels; i++) + VIR_DEBUG("models[%zu]=3D%s", i, models->models[i].name); } =20 if (cpus =3D=3D NULL && ncpus !=3D 0) { @@ -555,12 +543,6 @@ cpuBaseline(virCPUDefPtr *cpus, } } =20 - if (models =3D=3D NULL && nmodels !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("nonzero nmodels doesn't match with NULL mo= dels")); - return NULL; - } - if ((driver =3D cpuGetSubDriver(cpus[0]->arch)) =3D=3D NULL) return NULL; =20 @@ -571,7 +553,7 @@ cpuBaseline(virCPUDefPtr *cpus, return NULL; } =20 - return driver->baseline(cpus, ncpus, models, nmodels, migratable); + return driver->baseline(cpus, ncpus, models, migratable); } =20 =20 @@ -844,25 +826,23 @@ virCPUDataParse(const char *xmlStr) * * @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. + * If @models is NULL, all models are supported. * * Returns true if @model is supported, false otherwise. */ bool virCPUModelIsAllowed(const char *model, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { size_t i; =20 - if (!models || !nmodels) + if (!models) return true; =20 - for (i =3D 0; i < nmodels; i++) { - if (models[i] && STREQ(models[i], model)) + for (i =3D 0; i < models->nmodels; i++) { + if (STREQ(models->models[i].name, model)) return true; } return false; @@ -908,8 +888,7 @@ virCPUGetModels(virArch arch, char ***models) * * @arch: CPU architecture * @cpu: CPU definition to be translated - * @models: NULL-terminated list of allowed CPU models (NULL if all are al= lowed) - * @nmodels: number of CPU models in @models + * @models: list of allowed CPU models (NULL if all are allowed) * * Translates @cpu model (if allowed by @cpu->fallback) to a closest CPU m= odel * from @models list. @@ -922,13 +901,12 @@ virCPUGetModels(virArch arch, char ***models) int virCPUTranslate(virArch arch, virCPUDefPtr cpu, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { struct cpuArchDriver *driver; =20 - VIR_DEBUG("arch=3D%s, cpu=3D%p, model=3D%s, models=3D%p, nmodels=3D%u", - virArchToString(arch), cpu, NULLSTR(cpu->model), models, nmo= dels); + VIR_DEBUG("arch=3D%s, cpu=3D%p, model=3D%s, models=3D%p", + virArchToString(arch), cpu, NULLSTR(cpu->model), models); =20 if (!(driver =3D cpuGetSubDriver(arch))) return -1; @@ -937,7 +915,7 @@ virCPUTranslate(virArch arch, cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) return 0; =20 - if (virCPUModelIsAllowed(cpu->model, models, nmodels)) + if (virCPUModelIsAllowed(cpu->model, models)) return 0; =20 if (cpu->fallback !=3D VIR_CPU_FALLBACK_ALLOW) { @@ -954,7 +932,7 @@ virCPUTranslate(virArch arch, return -1; } =20 - if (driver->translate(cpu, models, nmodels) < 0) + if (driver->translate(cpu, models) < 0) return -1; =20 VIR_DEBUG("model=3D%s", NULLSTR(cpu->model)); diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 5daff186c4..d325fe3d04 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -27,6 +27,7 @@ # include "virerror.h" # include "datatypes.h" # include "virarch.h" +# include "domain_capabilities.h" # include "cpu_conf.h" # include "cpu_x86_data.h" # include "cpu_ppc64_data.h" @@ -52,8 +53,7 @@ typedef virCPUCompareResult typedef int (*cpuArchDecode) (virCPUDefPtr cpu, const virCPUData *data, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred); =20 typedef int @@ -71,14 +71,12 @@ typedef void =20 typedef int (*virCPUArchGetHost)(virCPUDefPtr cpu, - const char **models, - unsigned int nmodels); + virDomainCapsCPUModelsPtr models); =20 typedef virCPUDefPtr (*cpuArchBaseline) (virCPUDefPtr *cpus, unsigned int ncpus, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, bool migratable); =20 typedef int @@ -109,8 +107,7 @@ typedef int =20 typedef int (*virCPUArchTranslate)(virCPUDefPtr cpu, - const char **models, - unsigned int nmodels); + virDomainCapsCPUModelsPtr models); =20 typedef int (*virCPUArchConvertLegacy)(virCPUDefPtr cpu); @@ -165,8 +162,7 @@ virCPUCompare(virArch arch, int cpuDecode (virCPUDefPtr cpu, const virCPUData *data, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 @@ -194,8 +190,7 @@ virCPUDefPtr virCPUGetHost(virArch arch, virCPUType type, virNodeInfoPtr nodeInfo, - const char **models, - unsigned int nmodels); + virDomainCapsCPUModelsPtr models); =20 virCPUDefPtr virCPUProbeHost(virArch arch); @@ -203,8 +198,7 @@ virCPUProbeHost(virArch arch); virCPUDefPtr cpuBaseline (virCPUDefPtr *cpus, unsigned int ncpus, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, bool migratable); =20 int @@ -235,8 +229,7 @@ virCPUDataCheckFeature(const virCPUData *data, =20 bool virCPUModelIsAllowed(const char *model, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) ATTRIBUTE_NONNULL(1); =20 int @@ -245,8 +238,7 @@ virCPUGetModels(virArch arch, char ***models); int virCPUTranslate(virArch arch, virCPUDefPtr cpu, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) ATTRIBUTE_NONNULL(2); =20 int diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 474777656c..44cb4fea68 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -75,8 +75,7 @@ virCPUarmUpdate(virCPUDefPtr guest, static virCPUDefPtr armBaseline(virCPUDefPtr *cpus, unsigned int ncpus ATTRIBUTE_UNUSED, - const char **models ATTRIBUTE_UNUSED, - unsigned int nmodels ATTRIBUTE_UNUSED, + virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED, bool migratable ATTRIBUTE_UNUSED) { virCPUDefPtr cpu =3D NULL; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index b58e80a647..e5ae3a609f 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -663,8 +663,7 @@ virCPUppc64Compare(virCPUDefPtr host, static int ppc64DriverDecode(virCPUDefPtr cpu, const virCPUData *data, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred ATTRIBUTE_UNUSED) { int ret =3D -1; @@ -681,7 +680,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, goto cleanup; } =20 - if (!virCPUModelIsAllowed(model->name, models, nmodels)) { + if (!virCPUModelIsAllowed(model->name, models)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU model %s is not supported by hypervisor"), model->name); @@ -714,8 +713,7 @@ virCPUppc64DataFree(virCPUDataPtr data) =20 static int virCPUppc64GetHost(virCPUDefPtr cpu, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { virCPUDataPtr cpuData =3D NULL; virCPUppc64Data *data; @@ -737,7 +735,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu, #endif data->pvr[0].mask =3D 0xfffffffful; =20 - ret =3D ppc64DriverDecode(cpu, cpuData, models, nmodels, NULL); + ret =3D ppc64DriverDecode(cpu, cpuData, models, NULL); =20 cleanup: virCPUppc64DataFree(cpuData); @@ -766,8 +764,7 @@ virCPUppc64Update(virCPUDefPtr guest, static virCPUDefPtr ppc64DriverBaseline(virCPUDefPtr *cpus, unsigned int ncpus, - const char **models ATTRIBUTE_UNUSED, - unsigned int nmodels ATTRIBUTE_UNUSED, + virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED, bool migratable ATTRIBUTE_UNUSED) { struct ppc64_map *map; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 5ce205f9c1..3f9e83ca72 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1820,8 +1820,7 @@ x86DataFilterTSX(virCPUx86Data *data, static int x86Decode(virCPUDefPtr cpu, const virCPUx86Data *cpuData, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred, bool migratable) { @@ -1855,7 +1854,7 @@ x86Decode(virCPUDefPtr cpu, */ for (i =3D map->nmodels - 1; i >=3D 0; i--) { candidate =3D map->models[i]; - if (!virCPUModelIsAllowed(candidate->name, models, nmodels)) { + if (!virCPUModelIsAllowed(candidate->name, models)) { if (preferred && STREQ(candidate->name, preferred)) { if (cpu->fallback !=3D VIR_CPU_FALLBACK_ALLOW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -1946,11 +1945,10 @@ x86Decode(virCPUDefPtr cpu, static int x86DecodeCPUData(virCPUDefPtr cpu, const virCPUData *data, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, const char *preferred) { - return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, fal= se); + return x86Decode(cpu, &data->data.x86, models, preferred, false); } =20 =20 @@ -2402,8 +2400,7 @@ cpuidSet(uint32_t base, virCPUDataPtr data) =20 static int virCPUx86GetHost(virCPUDefPtr cpu, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { virCPUDataPtr cpuData =3D NULL; int ret =3D -1; @@ -2415,7 +2412,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, cpuidSet(CPUX86_EXTENDED, cpuData) < 0) goto cleanup; =20 - ret =3D x86DecodeCPUData(cpu, cpuData, models, nmodels, NULL); + ret =3D x86DecodeCPUData(cpu, cpuData, models, NULL); =20 cleanup: virCPUx86DataFree(cpuData); @@ -2427,8 +2424,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, static virCPUDefPtr x86Baseline(virCPUDefPtr *cpus, unsigned int ncpus, - const char **models, - unsigned int nmodels, + virDomainCapsCPUModelsPtr models, bool migratable) { virCPUx86MapPtr map =3D NULL; @@ -2523,7 +2519,7 @@ x86Baseline(virCPUDefPtr *cpus, virCPUx86DataAddCPUIDInt(&base_model->data, &vendor->cpuid) < 0) goto error; =20 - if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, migr= atable) < 0) + if (x86Decode(cpu, &base_model->data, models, modelName, migratable) <= 0) goto error; =20 if (STREQ_NULLABLE(cpu->model, modelName)) @@ -2805,8 +2801,7 @@ virCPUx86GetModels(char ***models) =20 static int virCPUx86Translate(virCPUDefPtr cpu, - const char **models, - unsigned int nmodels) + virDomainCapsCPUModelsPtr models) { virCPUDefPtr translated =3D NULL; virCPUx86MapPtr map; @@ -2830,7 +2825,7 @@ virCPUx86Translate(virCPUDefPtr cpu, if (!(translated =3D virCPUDefCopyWithoutModel(cpu))) goto cleanup; =20 - if (x86Decode(translated, &model->data, models, nmodels, NULL, false) = < 0) + if (x86Decode(translated, &model->data, models, NULL, false) < 0) goto cleanup; =20 for (i =3D 0; i < cpu->nfeatures; i++) { diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index e0959202b3..4def561143 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -192,7 +192,7 @@ libxlCapsInitCPU(virCapsPtr caps, libxl_physinfo *phy_i= nfo, ret =3D 0; =20 if (!(data =3D libxlCapsNodeData(cpu, phy_info->hw_cap, version)) || - cpuDecode(cpu, data, NULL, 0, NULL) < 0) { + cpuDecode(cpu, data, NULL, NULL) < 0) { VIR_WARN("Failed to initialize host cpu features"); goto error; } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index bf3625e34a..34235fc57d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6463,7 +6463,7 @@ libxlConnectBaselineCPU(virConnectPtr conn, if (!(cpus =3D virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST))) goto cleanup; =20 - if (!(cpu =3D cpuBaseline(cpus, ncpus, NULL, 0, + if (!(cpu =3D cpuBaseline(cpus, ncpus, NULL, !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE= )))) goto cleanup; =20 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7ddc6cafd4..225cee4ef9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1167,18 +1167,8 @@ virQEMUCapsProbeHostCPUForEmulator(virArch hostArch, virQEMUCapsPtr qemuCaps, virDomainVirtType type) { - size_t nmodels; - char **models; - virCPUDefPtr cpu; - - if (virQEMUCapsGetCPUDefinitions(qemuCaps, type, &models, &nmodels) < = 0) - return NULL; - - cpu =3D virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL, - (const char **) models, nmodels); - - virStringListFreeCount(models, nmodels); - return cpu; + return virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL, + virQEMUCapsGetCPUDefinitions(qemuCaps, type)); } =20 =20 @@ -2532,45 +2522,16 @@ virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCap= s, } =20 =20 -int +virDomainCapsCPUModelsPtr virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - char ***names, - size_t *count) + virDomainVirtType type) { - size_t i; - char **models =3D NULL; - virDomainCapsCPUModelsPtr cpus; - - *count =3D 0; - if (names) - *names =3D NULL; - if (type =3D=3D VIR_DOMAIN_VIRT_KVM) - cpus =3D qemuCaps->kvmCPUModels; + return qemuCaps->kvmCPUModels; else - cpus =3D qemuCaps->tcgCPUModels; + return qemuCaps->tcgCPUModels; =20 - if (!cpus) - return 0; - - if (names && VIR_ALLOC_N(models, cpus->nmodels) < 0) - return -1; - - for (i =3D 0; i < cpus->nmodels; i++) { - virDomainCapsCPUModelPtr cpu =3D cpus->models + i; - if (models && VIR_STRDUP(models[i], cpu->name) < 0) - goto error; - } - - if (names) - *names =3D models; - *count =3D cpus->nmodels; - return 0; - - error: - virStringListFreeCount(models, i); - return -1; + return NULL; } =20 =20 @@ -3392,8 +3353,6 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, virCPUDataPtr data =3D NULL; unsigned long long sigFamily =3D 0; unsigned long long sigModel =3D 0; - size_t nmodels =3D 0; - char **models =3D NULL; int ret =3D -1; size_t i; =20 @@ -3438,15 +3397,15 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0) goto cleanup; =20 - if (virQEMUCapsGetCPUDefinitions(qemuCaps, type, &models, &nmodels) < = 0 || - cpuDecode(cpu, data, (const char **) models, nmodels, NULL) < 0) + if (cpuDecode(cpu, data, + virQEMUCapsGetCPUDefinitions(qemuCaps, type), + NULL) < 0) goto cleanup; =20 ret =3D 0; =20 cleanup: virCPUDataFree(data); - virStringListFreeCount(models, nmodels); return ret; } =20 @@ -3532,7 +3491,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, } else if (type =3D=3D VIR_DOMAIN_VIRT_KVM && virCPUGetHostIsSupported(qemuCaps->arch)) { if (!(fullCPU =3D virCPUGetHost(qemuCaps->arch, VIR_CPU_TYPE_GUEST, - NULL, NULL, 0))) + NULL, NULL))) goto error; =20 for (i =3D 0; i < cpu->nfeatures; i++) { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 214734ff2c..3b6fd26109 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -469,10 +469,8 @@ int virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCa= ps, const char **name, size_t count, virDomainCapsCPUUsable usable); -int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - char ***names, - size_t *count); +virDomainCapsCPUModelsPtr virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemu= Caps, + virDomainVirtType t= ype); =20 typedef enum { /* Host CPU definition reported in domain capabilities. */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4855c9047d..55d8616ada 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13051,7 +13051,7 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE= _UNUSED, if (!(cpus =3D virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST))) goto cleanup; =20 - if (!(baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, + if (!(baseline =3D cpuBaseline(cpus, ncpus, NULL, !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRA= TABLE)))) goto cleanup; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bde3ba462a..4341187852 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5157,8 +5157,6 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, unsigned int flags) { int ret =3D -1; - size_t nmodels =3D 0; - char **models =3D NULL; =20 if (!def->cpu) return 0; @@ -5210,17 +5208,14 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, VIR_QEMU_CAPS_HOST_CPU_MIGRAT= ABLE)) < 0) goto cleanup; =20 - if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType, - &models, &nmodels) < 0 || - virCPUTranslate(def->os.arch, def->cpu, - (const char **) models, nmodels) < 0) + if (virCPUTranslate(def->os.arch, def->cpu, + virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtTy= pe)) < 0) goto cleanup; =20 def->cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; ret =3D 0; =20 cleanup: - virStringListFreeCount(models, nmodels); return ret; } =20 diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 9b434e9a04..eeda5b224c 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1545,7 +1545,7 @@ testConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_U= NUSED, if (!(cpus =3D virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST))) goto cleanup; =20 - if (!(cpu =3D cpuBaseline(cpus, ncpus, NULL, 0, false))) + if (!(cpu =3D cpuBaseline(cpus, ncpus, NULL, false))) goto cleanup; =20 if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && diff --git a/tests/cputest.c b/tests/cputest.c index 913ca77231..552c07e2c5 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -61,9 +61,8 @@ struct data { virArch arch; const char *host; const char *name; - const char **models; + virDomainCapsCPUModelsPtr models; const char *modelsName; - unsigned int nmodels; unsigned int flags; int result; }; @@ -264,13 +263,13 @@ cpuTestGuestCPU(const void *arg) } =20 if (virCPUUpdate(host->arch, cpu, host) < 0 || - virCPUTranslate(host->arch, cpu, data->models, data->nmodels) < 0)= { + virCPUTranslate(host->arch, cpu, data->models) < 0) { ret =3D -1; goto cleanup; } =20 virBufferAsprintf(&buf, "%s+%s", data->host, data->name); - if (data->nmodels) + if (data->modelsName) virBufferAsprintf(&buf, ",%s", data->modelsName); virBufferAddLit(&buf, "-result"); =20 @@ -322,7 +321,7 @@ cpuTestBaseline(const void *arg) if (!(cpus =3D cpuTestLoadMultiXML(data->arch, data->name, &ncpus))) goto cleanup; =20 - baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, + baseline =3D cpuBaseline(cpus, ncpus, NULL, !!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRA= TABLE)); =20 if (baseline && @@ -492,7 +491,7 @@ cpuTestCPUID(bool guest, const void *arg) cpu->type =3D VIR_CPU_TYPE_HOST; } =20 - if (cpuDecode(cpu, hostData, NULL, 0, NULL) < 0) + if (cpuDecode(cpu, hostData, NULL, NULL) < 0) goto cleanup; =20 if (virAsprintf(&result, "cpuid-%s-%s", @@ -729,15 +728,43 @@ cpuTestJSONCPUID(const void *arg) #endif =20 =20 -static const char *model486[] =3D { "486" }; -static const char *nomodel[] =3D { "nomodel" }; -static const char *models[] =3D { "qemu64", "core2duo", "Nehalem" }; -static const char *haswell[] =3D { "SandyBridge", "Haswell" }; -static const char *ppc_models[] =3D { "POWER6", "POWER7", "POWER8" }; +static const char *model486_list[] =3D { "486", NULL }; +static const char *nomodel_list[] =3D { "nomodel", NULL }; +static const char *models_list[] =3D { "qemu64", "core2duo", "Nehalem"= , NULL }; +static const char *haswell_list[] =3D { "SandyBridge", "Haswell", NULL = }; +static const char *ppc_models_list[] =3D { "POWER6", "POWER7", "POWER8", N= ULL }; + +static virDomainCapsCPUModelsPtr +cpuTestInitModels(const char **list) +{ + virDomainCapsCPUModelsPtr cpus; + const char **model; + + if (!(cpus =3D virDomainCapsCPUModelsNew(0))) + return NULL; + + for (model =3D list; *model; model++) { + if (virDomainCapsCPUModelsAdd(cpus, *model, -1, + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= ) < 0) + goto error; + } + + return cpus; + + error: + virObjectUnref(cpus); + return NULL; +} + =20 static int mymain(void) { + virDomainCapsCPUModelsPtr model486 =3D NULL; + virDomainCapsCPUModelsPtr nomodel =3D NULL; + virDomainCapsCPUModelsPtr models =3D NULL; + virDomainCapsCPUModelsPtr haswell =3D NULL; + virDomainCapsCPUModelsPtr ppc_models =3D NULL; int ret =3D 0; =20 #if WITH_QEMU && WITH_YAJL @@ -747,13 +774,22 @@ mymain(void) virEventRegisterDefaultImpl(); #endif =20 + if (!(model486 =3D cpuTestInitModels(model486_list)) || + !(nomodel =3D cpuTestInitModels(nomodel_list)) || + !(models =3D cpuTestInitModels(models_list)) || + !(haswell =3D cpuTestInitModels(haswell_list)) || + !(ppc_models =3D cpuTestInitModels(ppc_models_list))) { + ret =3D -1; + goto cleanup; + } + #define DO_TEST(arch, api, name, host, cpu, \ - models, nmodels, flags, result) \ + models, flags, result) \ do { \ struct data data =3D { \ arch, host, cpu, models, \ models =3D=3D NULL ? NULL : #models, = \ - nmodels, flags, result \ + flags, result \ }; \ char *testLabel; \ char *tmp; \ @@ -784,12 +820,12 @@ mymain(void) #define DO_TEST_COMPARE(arch, host, cpu, result) \ DO_TEST(arch, cpuTestCompare, \ host "/" cpu " (" #result ")", \ - host, cpu, NULL, 0, 0, result) + host, cpu, NULL, 0, result) =20 #define DO_TEST_UPDATE_ONLY(arch, host, cpu) \ DO_TEST(arch, cpuTestUpdate, \ cpu " on " host, \ - host, cpu, NULL, 0, 0, 0) + host, cpu, NULL, 0, 0) =20 #define DO_TEST_UPDATE(arch, host, cpu, result) \ do { \ @@ -809,7 +845,7 @@ mymain(void) ret =3D -1; \ } else { \ DO_TEST(arch, cpuTestBaseline, label, NULL, \ - "baseline-" name, NULL, 0, flags, result); \ + "baseline-" name, NULL, flags, result); \ } \ VIR_FREE(label); \ } while (0) @@ -817,21 +853,19 @@ mymain(void) #define DO_TEST_HASFEATURE(arch, host, feature, result) \ DO_TEST(arch, cpuTestHasFeature, \ host "/" feature " (" #result ")", \ - host, feature, NULL, 0, 0, result) + host, feature, NULL, 0, result) =20 #define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \ DO_TEST(arch, cpuTestGuestCPU, \ host "/" cpu " (" #models ")", \ - host, cpu, models, \ - models =3D=3D NULL ? 0 : sizeof(models) / sizeof(char *), = \ - 0, result) + host, cpu, models, 0, result) =20 #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, 0, 0); \ + NULL, NULL, 0, 0); \ } \ } while (0) #else @@ -841,13 +875,13 @@ mymain(void) #define DO_TEST_CPUID(arch, host, json) \ do { \ DO_TEST(arch, cpuTestHostCPUID, host, host, \ - NULL, NULL, 0, 0, 0); \ + NULL, NULL, 0, 0); \ DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, 0, 0, 0); \ + NULL, NULL, 0, 0); \ DO_TEST_CPUID_JSON(arch, host, json); \ if (json) { \ DO_TEST(arch, cpuTestUpdateLive, host, host, \ - NULL, NULL, 0, 0, 0); \ + NULL, NULL, 0, 0); \ } \ } while (0) =20 @@ -1012,10 +1046,17 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", true); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", false); =20 + cleanup: #if WITH_QEMU && WITH_YAJL qemuTestDriverFree(&driver); #endif =20 + virObjectUnref(model486); + virObjectUnref(nomodel); + virObjectUnref(models); + virObjectUnref(haswell); + virObjectUnref(ppc_models); + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150712945503917.121215895208934; Wed, 4 Oct 2017 08:04:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6D5B5F2987; Wed, 4 Oct 2017 15:04:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F3246362B; Wed, 4 Oct 2017 15:04:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C34E43FAD0; Wed, 4 Oct 2017 15:04:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwtdM006826 for ; Wed, 4 Oct 2017 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9351C5C8BB; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FABA5C542 for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 3DC19103032; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B6D5B5F2987 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:30 +0200 Message-Id: <296e5b86798e14f6a3602f0567edfaeb9e41f968.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/23] cpu: Drop unused parameter from cpuDecode X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Oct 2017 15:04:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The "preferred" parameter is not used by any caller of cpuDecode anymore. It's only used internally in cpu_x86 to implement cpuBaseline. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/cpu/cpu.c | 15 ++++----------- src/cpu/cpu.h | 6 ++---- src/cpu/cpu_ppc64.c | 5 ++--- src/cpu/cpu_x86.c | 7 +++---- src/libxl/libxl_capabilities.c | 2 +- src/qemu/qemu_capabilities.c | 4 +--- tests/cputest.c | 2 +- 7 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 842b0db2cd..b815ed383a 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -192,34 +192,27 @@ virCPUCompare(virArch arch, * @cpu: CPU definition stub to be filled in * @data: internal CPU data to be decoded into @cpu definition * @models: list of CPU models that can be considered when decoding @data - * @preferred: CPU models that should be used if possible * * Decodes internal CPU data into a CPU definition consisting of a CPU mod= el * and a list of CPU features. The @cpu model stub is supposed to have arc= h, * type, match and fallback members set, this function will add the rest. = If * @models list is NULL, all models supported by libvirt will be considered * when decoding the data. In general, this function will select the model - * closest to the CPU specified by @data unless @preferred is non-NULL, in - * which case the @preferred model will be used as long as it is compatible - * with @data. + * closest to the CPU specified by @data. * * For VIR_ARCH_I686 and VIR_ARCH_X86_64 architectures this means the comp= uted * CPU definition will have the shortest possible list of additional featu= res. - * When @preferred is non-NULL, the @preferred model will be used even if - * other models would result in a shorter list of additional features. * * Returns 0 on success, -1 on error. */ int cpuDecode(virCPUDefPtr cpu, const virCPUData *data, - virDomainCapsCPUModelsPtr models, - const char *preferred) + virDomainCapsCPUModelsPtr models) { struct cpuArchDriver *driver; =20 - VIR_DEBUG("cpu=3D%p, data=3D%p, models=3D%p, preferred=3D%s", - cpu, data, models, NULLSTR(preferred)); + VIR_DEBUG("cpu=3D%p, data=3D%p, models=3D%p", cpu, data, models); if (models) { size_t i; for (i =3D 0; i < models->nmodels; i++) @@ -243,7 +236,7 @@ cpuDecode(virCPUDefPtr cpu, return -1; } =20 - return driver->decode(cpu, data, models, preferred); + return driver->decode(cpu, data, models); } =20 =20 diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index d325fe3d04..83d5bcb63f 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -53,8 +53,7 @@ typedef virCPUCompareResult typedef int (*cpuArchDecode) (virCPUDefPtr cpu, const virCPUData *data, - virDomainCapsCPUModelsPtr models, - const char *preferred); + virDomainCapsCPUModelsPtr models); =20 typedef int (*cpuArchEncode) (virArch arch, @@ -162,8 +161,7 @@ virCPUCompare(virArch arch, int cpuDecode (virCPUDefPtr cpu, const virCPUData *data, - virDomainCapsCPUModelsPtr models, - const char *preferred) + virDomainCapsCPUModelsPtr models) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 int diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index e5ae3a609f..7eb27c59bd 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -663,8 +663,7 @@ virCPUppc64Compare(virCPUDefPtr host, static int ppc64DriverDecode(virCPUDefPtr cpu, const virCPUData *data, - virDomainCapsCPUModelsPtr models, - const char *preferred ATTRIBUTE_UNUSED) + virDomainCapsCPUModelsPtr models) { int ret =3D -1; struct ppc64_map *map; @@ -735,7 +734,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu, #endif data->pvr[0].mask =3D 0xfffffffful; =20 - ret =3D ppc64DriverDecode(cpu, cpuData, models, NULL); + ret =3D ppc64DriverDecode(cpu, cpuData, models); =20 cleanup: virCPUppc64DataFree(cpuData); diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 3f9e83ca72..84ec878d1b 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1945,10 +1945,9 @@ x86Decode(virCPUDefPtr cpu, static int x86DecodeCPUData(virCPUDefPtr cpu, const virCPUData *data, - virDomainCapsCPUModelsPtr models, - const char *preferred) + virDomainCapsCPUModelsPtr models) { - return x86Decode(cpu, &data->data.x86, models, preferred, false); + return x86Decode(cpu, &data->data.x86, models, NULL, false); } =20 =20 @@ -2412,7 +2411,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, cpuidSet(CPUX86_EXTENDED, cpuData) < 0) goto cleanup; =20 - ret =3D x86DecodeCPUData(cpu, cpuData, models, NULL); + ret =3D x86DecodeCPUData(cpu, cpuData, models); =20 cleanup: virCPUx86DataFree(cpuData); diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 4def561143..18596c7c72 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -192,7 +192,7 @@ libxlCapsInitCPU(virCapsPtr caps, libxl_physinfo *phy_i= nfo, ret =3D 0; =20 if (!(data =3D libxlCapsNodeData(cpu, phy_info->hw_cap, version)) || - cpuDecode(cpu, data, NULL, NULL) < 0) { + cpuDecode(cpu, data, NULL) < 0) { VIR_WARN("Failed to initialize host cpu features"); goto error; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 225cee4ef9..5c8b1d76b0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3397,9 +3397,7 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0) goto cleanup; =20 - if (cpuDecode(cpu, data, - virQEMUCapsGetCPUDefinitions(qemuCaps, type), - NULL) < 0) + if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type))= < 0) goto cleanup; =20 ret =3D 0; diff --git a/tests/cputest.c b/tests/cputest.c index 552c07e2c5..cc95f1d551 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -491,7 +491,7 @@ cpuTestCPUID(bool guest, const void *arg) cpu->type =3D VIR_CPU_TYPE_HOST; } =20 - if (cpuDecode(cpu, hostData, NULL, NULL) < 0) + if (cpuDecode(cpu, hostData, NULL) < 0) goto cleanup; =20 if (virAsprintf(&result, "cpuid-%s-%s", --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129975295307.19906600733214; Wed, 4 Oct 2017 08:12:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 423167EAA5; Wed, 4 Oct 2017 15:12:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1428860467; Wed, 4 Oct 2017 15:12:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C8FDA1806100; Wed, 4 Oct 2017 15:12:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewvbt006886 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id B92F960491; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C14F60472 for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 40155102353; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 423167EAA5 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:31 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/23] cpu: Return model from virCPUModelIsAllowed X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Oct 2017 15:12:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a given CPU model is supported by the hypervisor, we want to know more about it, e.g., what features may block its usage on the current host and such details are stored in the virDomainCapsCPUModelsPtr list which virCPUModelIsAllowed uses to check whether the CPU model is supported. Thus if the CPU model is found in the list we can directly return a pointer to the corresponding virDomainCapsCPUModel if the caller needs to look at the details. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/cpu/cpu.c | 18 ++++++++++++++---- src/cpu/cpu.h | 3 ++- src/cpu/cpu_ppc64.c | 2 +- src/cpu/cpu_x86.c | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b815ed383a..48290a471b 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -819,24 +819,34 @@ virCPUDataParse(const char *xmlStr) * * @model: CPU model to be checked * @models: list of supported CPU models + * @hvModel: pointer to matching model from @models will be returned here * * Checks whether @model can be found in the list of supported @models. - * If @models is NULL, all models are supported. + * If @models is NULL, all models are supported. If both @models and @hvMo= del + * are non-NULL and @model is found in the list of supported models, @hvMo= del + * will be filled with the pointer to the matching CPU model from @models. * * Returns true if @model is supported, false otherwise. */ bool virCPUModelIsAllowed(const char *model, - virDomainCapsCPUModelsPtr models) + virDomainCapsCPUModelsPtr models, + virDomainCapsCPUModelPtr *hvModel) { size_t i; =20 + if (hvModel) + *hvModel =3D NULL; + if (!models) return true; =20 for (i =3D 0; i < models->nmodels; i++) { - if (STREQ(models->models[i].name, model)) + if (STREQ(models->models[i].name, model)) { + if (hvModel) + *hvModel =3D models->models + i; return true; + } } return false; } @@ -908,7 +918,7 @@ virCPUTranslate(virArch arch, cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) return 0; =20 - if (virCPUModelIsAllowed(cpu->model, models)) + if (virCPUModelIsAllowed(cpu->model, models, NULL)) return 0; =20 if (cpu->fallback !=3D VIR_CPU_FALLBACK_ALLOW) { diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 83d5bcb63f..2d81927a0b 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -227,7 +227,8 @@ virCPUDataCheckFeature(const virCPUData *data, =20 bool virCPUModelIsAllowed(const char *model, - virDomainCapsCPUModelsPtr models) + virDomainCapsCPUModelsPtr models, + virDomainCapsCPUModelPtr *hvModel) ATTRIBUTE_NONNULL(1); =20 int diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 7eb27c59bd..9f990a3fb5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -679,7 +679,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, goto cleanup; } =20 - if (!virCPUModelIsAllowed(model->name, models)) { + if (!virCPUModelIsAllowed(model->name, models, NULL)) { 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 84ec878d1b..198e80a5c2 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1854,7 +1854,7 @@ x86Decode(virCPUDefPtr cpu, */ for (i =3D map->nmodels - 1; i >=3D 0; i--) { candidate =3D map->models[i]; - if (!virCPUModelIsAllowed(candidate->name, models)) { + if (!virCPUModelIsAllowed(candidate->name, models, NULL)) { if (preferred && STREQ(candidate->name, preferred)) { if (cpu->fallback !=3D VIR_CPU_FALLBACK_ALLOW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129894964717.2076507553293; Wed, 4 Oct 2017 08:11:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E97C661469; Wed, 4 Oct 2017 15:11:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDC4560179; Wed, 4 Oct 2017 15:11:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7F3033FAD0; Wed, 4 Oct 2017 15:11:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewtax006819 for ; Wed, 4 Oct 2017 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A6A063626; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 499476362F for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 42C57103035; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E97C661469 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:32 +0200 Message-Id: <4dcf8138c641a4dd7898d95165a7c6d738779b44.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/23] cpu_x86: Move x86FeatureFind* to avoid forward prototypes X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Oct 2017 15:11:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/cpu/cpu_x86.c | 61 ++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 198e80a5c2..e197e31310 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -240,6 +240,37 @@ x86cpuidAndBits(virCPUx86CPUID *cpuid, cpuid->edx &=3D mask->edx; } =20 + +static virCPUx86FeaturePtr +x86FeatureFind(virCPUx86MapPtr map, + const char *name) +{ + size_t i; + + for (i =3D 0; i < map->nfeatures; i++) { + if (STREQ(map->features[i]->name, name)) + return map->features[i]; + } + + return NULL; +} + + +static virCPUx86FeaturePtr +x86FeatureFindInternal(const char *name) +{ + size_t i; + size_t count =3D ARRAY_CARDINALITY(x86_kvm_features); + + for (i =3D 0; i < count; i++) { + if (STREQ(x86_kvm_features[i].name, name)) + return x86_kvm_features + i; + } + + return NULL; +} + + static int virCPUx86CPUIDSorter(const void *a, const void *b) { @@ -753,36 +784,6 @@ x86FeatureFree(virCPUx86FeaturePtr feature) } =20 =20 -static virCPUx86FeaturePtr -x86FeatureFind(virCPUx86MapPtr map, - const char *name) -{ - size_t i; - - for (i =3D 0; i < map->nfeatures; i++) { - if (STREQ(map->features[i]->name, name)) - return map->features[i]; - } - - return NULL; -} - - -static virCPUx86FeaturePtr -x86FeatureFindInternal(const char *name) -{ - size_t i; - size_t count =3D ARRAY_CARDINALITY(x86_kvm_features); - - for (i =3D 0; i < count; i++) { - if (STREQ(x86_kvm_features[i].name, name)) - return x86_kvm_features + i; - } - - return NULL; -} - - static int x86FeatureInData(const char *name, const virCPUx86Data *data, --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129474989808.7000962087288; Wed, 4 Oct 2017 08:04:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0190B7F415; Wed, 4 Oct 2017 15:04:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1F1F5E1AB; Wed, 4 Oct 2017 15:04:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 945C318355C2; Wed, 4 Oct 2017 15:04:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewt6e006839 for ; Wed, 4 Oct 2017 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id B490C5C542; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 898885C8BA for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 497B410400B; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0190B7F415 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:33 +0200 Message-Id: <47456c158f8db4d1f62776ed488ebe3bf02f364a.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/23] cpu_x86: Disable blockers from unusable CPU models X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 04 Oct 2017 15:04:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When decoding CPUID data to virCPUDef we need to be careful about using a CPU model which cannot be directly used on the current host. Normally, libvirt would notice the features which prevent the model from being usable and it would disable them in the computed virCPUDef, but this won't work in case the definition of the CPU model in QEMU contains more features than what we have in cpu_map.xml. We need to count with the usability blockers we got from QEMU and explicitly disable all of them to make the computed virCPUDef usable. https://bugzilla.redhat.com/show_bug.cgi?id=3D1464832 Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/cpu/cpu_x86.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e197e31310..0dbc17f199 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -627,7 +627,8 @@ x86DataAddSignature(virCPUx86Data *data, static virCPUDefPtr x86DataToCPU(const virCPUx86Data *data, virCPUx86ModelPtr model, - virCPUx86MapPtr map) + virCPUx86MapPtr map, + virDomainCapsCPUModelPtr hvModel) { virCPUDefPtr cpu; virCPUx86Data copy =3D VIR_CPU_X86_DATA_INIT; @@ -647,6 +648,21 @@ x86DataToCPU(const virCPUx86Data *data, x86DataSubtract(©, &modelData); x86DataSubtract(&modelData, data); =20 + /* The hypervisor's version of the CPU model (hvModel) may contain + * additional features which may be currently unavailable. Such featur= es + * block usage of the CPU model and we need to explicitly disable them. + */ + if (hvModel && hvModel->blockers) { + char **blocker; + virCPUx86FeaturePtr feature; + + for (blocker =3D hvModel->blockers; *blocker; blocker++) { + if ((feature =3D x86FeatureFind(map, *blocker)) && + !x86DataIsSubset(©, &feature->data)) + x86DataAdd(&modelData, &feature->data); + } + } + /* because feature policy is ignored for host CPU */ cpu->type =3D VIR_CPU_TYPE_GUEST; =20 @@ -1835,6 +1851,7 @@ x86Decode(virCPUDefPtr cpu, virCPUx86Data copy =3D VIR_CPU_X86_DATA_INIT; virCPUx86Data features =3D VIR_CPU_X86_DATA_INIT; virCPUx86VendorPtr vendor; + virDomainCapsCPUModelPtr hvModel; uint32_t signature; ssize_t i; int rc; @@ -1855,7 +1872,7 @@ x86Decode(virCPUDefPtr cpu, */ for (i =3D map->nmodels - 1; i >=3D 0; i--) { candidate =3D map->models[i]; - if (!virCPUModelIsAllowed(candidate->name, models, NULL)) { + if (!virCPUModelIsAllowed(candidate->name, models, &hvModel)) { if (preferred && STREQ(candidate->name, preferred)) { if (cpu->fallback !=3D VIR_CPU_FALLBACK_ALLOW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -1883,7 +1900,7 @@ x86Decode(virCPUDefPtr cpu, continue; } =20 - if (!(cpuCandidate =3D x86DataToCPU(&data, candidate, map))) + if (!(cpuCandidate =3D x86DataToCPU(&data, candidate, map, hvModel= ))) goto cleanup; cpuCandidate->type =3D cpu->type; =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130037954224.4342608027057; Wed, 4 Oct 2017 08:13:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0F1A780C9; Wed, 4 Oct 2017 15:13:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AFDE66FEF2; Wed, 4 Oct 2017 15:13:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4AF0D18355C3; Wed, 4 Oct 2017 15:13:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwwB8006921 for ; Wed, 4 Oct 2017 10:58:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id B3DB25D9CD; Wed, 4 Oct 2017 14:58:58 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C9F65D962 for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 4D3B5104012; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D0F1A780C9 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:34 +0200 Message-Id: <93f9e53aea858b72cc55672f399d43f6b4e6cd3f.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/23] cputest: Replace json bool with enum X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 04 Oct 2017 15:13:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We will soon need to handle more than two values. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 79 ++++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index cc95f1d551..57cff04f38 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -670,6 +670,11 @@ cpuTestUpdateLive(const void *arg) } =20 =20 +typedef enum { + JSON_NONE, + JSON_HOST, +} cpuTestCPUIDJson; + #if WITH_QEMU && WITH_YAJL static int cpuTestJSONCPUID(const void *arg) @@ -863,7 +868,7 @@ mymain(void) #if WITH_QEMU && WITH_YAJL # define DO_TEST_CPUID_JSON(arch, host, json) \ do { \ - if (json) { \ + if (json !=3D JSON_NONE) { \ DO_TEST(arch, cpuTestJSONCPUID, host, host, \ NULL, NULL, 0, 0); \ } \ @@ -879,7 +884,7 @@ mymain(void) DO_TEST(arch, cpuTestGuestCPUID, host, host, \ NULL, NULL, 0, 0); \ DO_TEST_CPUID_JSON(arch, host, json); \ - if (json) { \ + if (json !=3D JSON_NONE) { \ DO_TEST(arch, cpuTestUpdateLive, host, host, \ NULL, NULL, 0, 0); \ } \ @@ -1010,41 +1015,41 @@ mymain(void) DO_TEST_GUESTCPU(VIR_ARCH_PPC64, "host", "guest-legacy-incompatible", = ppc_models, -1); DO_TEST_GUESTCPU(VIR_ARCH_PPC64, "host", "guest-legacy-invalid", ppc_m= odels, -1); =20 - DO_TEST_CPUID(VIR_ARCH_X86_64, "A10-5800K", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-D510", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-N450", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2500", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2540M", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-4670T", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-6600", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-2600", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3520M", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3740QM", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3770", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "EPYC-7601-32-Core", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-1352", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-2350", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-6234", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-6282", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Pentium-P6100", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Phenom-B95", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Ryzen-7-1800X-Eight-Core", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-5110", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1245", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2630", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2650", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4820", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", false); + DO_TEST_CPUID(VIR_ARCH_X86_64, "A10-5800K", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-D510", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-N450", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2500", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2540M", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-4670T", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-6600", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-2600", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3520M", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3740QM", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3770", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "EPYC-7601-32-Core", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-1352", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-2350", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-6234", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Opteron-6282", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Pentium-P6100", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Phenom-B95", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Ryzen-7-1800X-Eight-Core", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-5110", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1245", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2630", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2650", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4820", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890", JSON_NONE); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", JSON_NONE); =20 cleanup: #if WITH_QEMU && WITH_YAJL --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129996020863.9266741117825; Wed, 4 Oct 2017 08:13:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA8185F297B; Wed, 4 Oct 2017 15:13:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8A8A5D97B; Wed, 4 Oct 2017 15:13:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 93AE13FAD1; Wed, 4 Oct 2017 15:13:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvlS006889 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAB5660472; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E1C060487 for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 4FCD41030D2; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EA8185F297B Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:35 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/23] cputest: Avoid calling json_reformat in cpu-parse.sh X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Oct 2017 15:13:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Various version of json_reformat use different number of spaces for indenting. Let's use a simple python reformatter to gain full control over the formatting for consistent results. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputestdata/cpu-parse.sh | 2 +- tests/cputestdata/cpu-reformat.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 tests/cputestdata/cpu-reformat.py diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index cd1ab024b3..96ff1074e0 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -42,7 +42,7 @@ json() while read; do $first || echo first=3Dfalse - json_reformat <<<"$REPLY" | tr -s '\n' + $(dirname $0)/cpu-reformat.py <<<"$REPLY" done } =20 diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-refo= rmat.py new file mode 100755 index 0000000000..999ef1698c --- /dev/null +++ b/tests/cputestdata/cpu-reformat.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python2 + +import sys +import json + +dec =3D json.JSONDecoder() +data, pos =3D dec.raw_decode(sys.stdin.read()) +json.dump(data, sys.stdout, indent =3D 2, separators =3D (',', ': ')) +print --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129912985588.9072286047445; Wed, 4 Oct 2017 08:11:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE8C32576E; Wed, 4 Oct 2017 15:11:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BEEC45D974; Wed, 4 Oct 2017 15:11:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7E97E3FAD3; Wed, 4 Oct 2017 15:11:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwtP3006828 for ; Wed, 4 Oct 2017 10:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95D416FDD8; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A4726FDDE for ; Wed, 4 Oct 2017 14:58:55 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 52FB2105B86; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DE8C32576E Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:36 +0200 Message-Id: <3ebf561d2d82308c93feb36fc8a4537dee8c5e5b.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/23] cputest: Print correct feature in virCPUUpdateLive test X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Oct 2017 15:11:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If the actual result does not match our expectation, the tests would not correctly show the difference if a CPU feature is disabled in the expected result and the actual result does not mention it at all. The test could complain about an unrelated CPU feature or it could even crash in case the actual result contains no more features to go through. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cputest.c b/tests/cputest.c index 57cff04f38..dcfdf57d43 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -605,7 +605,7 @@ cpuTestUpdateLiveCompare(virArch arch, (cmp > 0 && featExp->policy =3D=3D VIR_CPU_FEATURE_DISABLE)) { VIR_TEST_VERBOSE("Actual CPU has extra feature '%s'\n", - featAct->name); + cmp <=3D 0 ? featAct->name : featExp->name); ret =3D -1; } } --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130437630669.0243862960863; Wed, 4 Oct 2017 08:20:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61BD0272B3; Wed, 4 Oct 2017 15:20:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 355006FDDC; Wed, 4 Oct 2017 15:20:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E514E3FAD7; Wed, 4 Oct 2017 15:20:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwxYI006951 for ; Wed, 4 Oct 2017 10:58:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8CAA8619C0; Wed, 4 Oct 2017 14:58:59 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F4A760276 for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 58721107BD7; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 61BD0272B3 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:37 +0200 Message-Id: <23117b3760ca7cde6e070788335e7ae9d66ac1be.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 13/23] cputest: Test CPU usability blockers X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Oct 2017 15:20:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Gather query-cpu-definitions results and use them for testing CPU model usability blockers in CPUID to virCPUDef translation. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_capspriv.h | 5 +++++ tests/cputest.c | 12 +++++++++++- tests/cputestdata/cpu-cpuid.py | 26 +++++++++++++++++++------- tests/cputestdata/cpu-gather.sh | 1 + 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5c8b1d76b0..b5a5ba2b02 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2933,7 +2933,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCa= ps, } =20 =20 -static int +int virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon, bool tcg) diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index d05256bd35..f23995ec6e 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -101,4 +101,9 @@ virQEMUCapsParseHelpStr(const char *qemu, int virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str); + +int +virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps, + qemuMonitorPtr mon, + bool tcg); #endif diff --git a/tests/cputest.c b/tests/cputest.c index dcfdf57d43..0a07a2da14 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -673,6 +673,7 @@ cpuTestUpdateLive(const void *arg) typedef enum { JSON_NONE, JSON_HOST, + JSON_MODELS, } cpuTestCPUIDJson; =20 #if WITH_QEMU && WITH_YAJL @@ -704,10 +705,19 @@ cpuTestJSONCPUID(const void *arg) if (!(qemuCaps =3D virQEMUCapsNew())) goto cleanup; =20 + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); + if (data->flags =3D=3D JSON_MODELS) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS); + virQEMUCapsSetArch(qemuCaps, data->arch); virQEMUCapsSetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM, model); model =3D NULL; =20 + if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, + qemuMonitorTestGetMonitor(testMo= n), + false) < 0) + goto cleanup; + if (VIR_ALLOC(cpu) < 0) goto cleanup; =20 @@ -870,7 +880,7 @@ mymain(void) do { \ if (json !=3D JSON_NONE) { \ DO_TEST(arch, cpuTestJSONCPUID, host, host, \ - NULL, NULL, 0, 0); \ + NULL, NULL, json, 0); \ } \ } while (0) #else diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index a2fd938c24..4fe8e8b952 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -228,17 +228,22 @@ def parseFeatureWords(path): s =3D f.read() =20 props =3D {} - for i in range(5): + rest =3D [] + chunk =3D 0 + while s !=3D "": (data, pos) =3D dec.raw_decode(s) - if i =3D=3D 0: + if chunk =3D=3D 0: features =3D data["return"] - else: + elif chunk < 5: keys =3D ["family", "model", "stepping", "model-id"] - props[keys[i - 1]] =3D data["return"] + props[keys[chunk - 1]] =3D data["return"] + else: + rest.append(data) =20 while pos < len(s) and s[pos] !=3D "{": pos +=3D 1 s =3D s[pos:] + chunk +=3D 1 =20 if props["model-id"].find("Intel") !=3D -1: props["vendor"] =3D "GenuineIntel" @@ -255,13 +260,13 @@ def parseFeatureWords(path): leaf =3D cpuidLeaf(cpuid, in_eax, in_ecx) leaf[feat["cpuid-register"].lower()] =3D feat["features"] =20 - return props, cpuid + return props, cpuid, rest =20 =20 def parseQemu(path, features): cpuid =3D {} with open(path, "r") as f: - data =3D json.load(f) + data, pos =3D json.JSONDecoder().raw_decode(f.read()) =20 for (prop, val) in data["return"]["model"]["props"].iteritems(): if val and prop in features: @@ -288,6 +293,7 @@ def parseCpuid(path): =20 =20 def formatCpuid(cpuid, path, comment): + print path with open(path, "w") as f: f.write("\n") f.write("\n") @@ -304,19 +310,25 @@ def formatCpuid(cpuid, path, comment): =20 =20 def convert(path): - props, cpuid =3D parseFeatureWords(path) + props, cpuid, rest =3D parseFeatureWords(path) =20 for feature in cpuidMap: value =3D cpuidIsSet(cpuid, feature) for name in feature["names"]: props[name] =3D value =20 + print path with open(path, "w") as f: json.dump({"return": {"model": {"name": "base", "props": props}}, "id": "model-expansion"}, f, indent =3D 2, separators =3D (',', ': ')) f.write("\n") =20 + for chunk in rest: + f.write("\n") + json.dump(chunk, f, indent =3D 2, separators =3D (',', ': ')) + f.write("\n") + =20 def diff(features, path): base =3D path.replace(".json", "") diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 83963557ec..9c696f57bd 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -58,5 +58,6 @@ $( qom_get model-id fi ) +{"execute":"query-cpu-definitions","id":"definitions"} {"execute":"quit"} EOF --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130417268647.4385693028516; Wed, 4 Oct 2017 08:20:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E08F13D961; Wed, 4 Oct 2017 15:20:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5C0B61346; Wed, 4 Oct 2017 15:20:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7D0483FAD4; Wed, 4 Oct 2017 15:20:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewxwk006952 for ; Wed, 4 Oct 2017 10:58:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D83760276; Wed, 4 Oct 2017 14:58:59 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DD3760F81 for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 5A519107BB5; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E08F13D961 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:38 +0200 Message-Id: <26ac623a403a6856e5618587ae2d11b5c870ea17.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 14/23] cputest: Separate QEMUCaps creation from cpuTestCPUIDJson X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Oct 2017 15:20:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To make the code reusable by other tests. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 97 +++++++++++++++++++++++++++++++++++------------------= ---- 1 file changed, 60 insertions(+), 37 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index 0a07a2da14..b72c17a168 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -460,6 +460,64 @@ cpuTestHasFeature(const void *arg) } =20 =20 +typedef enum { + JSON_NONE, + JSON_HOST, + JSON_MODELS, +} cpuTestCPUIDJson; + +#if WITH_QEMU && WITH_YAJL +static virQEMUCapsPtr +cpuTestMakeQEMUCaps(const struct data *data) +{ + virQEMUCapsPtr qemuCaps =3D NULL; + qemuMonitorTestPtr testMon =3D NULL; + qemuMonitorCPUModelInfoPtr model =3D NULL; + char *json =3D NULL; + + if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json", + abs_srcdir, virArchToString(data->arch), data->host) <= 0) + goto error; + + if (!(testMon =3D qemuMonitorTestNewFromFile(json, driver.xmlopt, true= ))) + goto error; + + if (qemuMonitorGetCPUModelExpansion(qemuMonitorTestGetMonitor(testMon), + QEMU_MONITOR_CPU_MODEL_EXPANSION_S= TATIC, + "host", true, &model) < 0) + goto error; + + if (!(qemuCaps =3D virQEMUCapsNew())) + goto error; + + virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); + if (data->flags =3D=3D JSON_MODELS) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS); + + virQEMUCapsSetArch(qemuCaps, data->arch); + virQEMUCapsSetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM, model); + model =3D NULL; + + if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, + qemuMonitorTestGetMonitor(testMo= n), + false) < 0) + goto error; + + cleanup: + qemuMonitorCPUModelInfoFree(model); + qemuMonitorTestFree(testMon); + VIR_FREE(json); + + return qemuCaps; + + error: + virObjectUnref(qemuCaps); + qemuCaps =3D NULL; + goto cleanup; +} +#endif + + static int cpuTestCPUID(bool guest, const void *arg) { @@ -670,52 +728,20 @@ cpuTestUpdateLive(const void *arg) } =20 =20 -typedef enum { - JSON_NONE, - JSON_HOST, - JSON_MODELS, -} cpuTestCPUIDJson; - #if WITH_QEMU && WITH_YAJL static int cpuTestJSONCPUID(const void *arg) { const struct data *data =3D arg; - qemuMonitorCPUModelInfoPtr model =3D NULL; virQEMUCapsPtr qemuCaps =3D NULL; virCPUDefPtr cpu =3D NULL; - qemuMonitorTestPtr testMon =3D NULL; - char *json =3D NULL; char *result =3D NULL; int ret =3D -1; =20 - if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json", - abs_srcdir, virArchToString(data->arch), data->host) <= 0 || - virAsprintf(&result, "cpuid-%s-json", data->host) < 0) + if (virAsprintf(&result, "cpuid-%s-json", data->host) < 0) goto cleanup; =20 - if (!(testMon =3D qemuMonitorTestNewFromFile(json, driver.xmlopt, true= ))) - goto cleanup; - - if (qemuMonitorGetCPUModelExpansion(qemuMonitorTestGetMonitor(testMon), - QEMU_MONITOR_CPU_MODEL_EXPANSION_S= TATIC, - "host", true, &model) < 0) - goto cleanup; - - if (!(qemuCaps =3D virQEMUCapsNew())) - goto cleanup; - - virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM); - if (data->flags =3D=3D JSON_MODELS) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS); - - virQEMUCapsSetArch(qemuCaps, data->arch); - virQEMUCapsSetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM, model); - model =3D NULL; - - if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, - qemuMonitorTestGetMonitor(testMo= n), - false) < 0) + if (!(qemuCaps =3D cpuTestMakeQEMUCaps(data))) goto cleanup; =20 if (VIR_ALLOC(cpu) < 0) @@ -732,12 +758,9 @@ cpuTestJSONCPUID(const void *arg) ret =3D cpuTestCompareXML(data->arch, cpu, result); =20 cleanup: - qemuMonitorCPUModelInfoFree(model); virObjectUnref(qemuCaps); - qemuMonitorTestFree(testMon); virCPUDefFree(cpu); VIR_FREE(result); - VIR_FREE(json); return ret; } #endif --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130360216895.5597423634244; Wed, 4 Oct 2017 08:19:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC0717F41B; Wed, 4 Oct 2017 15:19:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7F3263632; Wed, 4 Oct 2017 15:19:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 948A83FAD5; Wed, 4 Oct 2017 15:19:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvNX006861 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 20A925E1A2; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA43C5E1A1 for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 5EC4010AEF4; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC0717F41B Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:39 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 15/23] build: Export virCPUModelIsAllowed private API X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 04 Oct 2017 15:19:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/libvirt_private.syms | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5b1bc5e4fe..7494955845 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1113,6 +1113,7 @@ virCPUExpandFeatures; virCPUGetHost; virCPUGetHostIsSupported; virCPUGetModels; +virCPUModelIsAllowed; virCPUProbeHost; virCPUTranslate; virCPUUpdate; --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129495736362.4901558664045; Wed, 4 Oct 2017 08:04:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CE1480E6A; Wed, 4 Oct 2017 15:04:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 793635D96E; Wed, 4 Oct 2017 15:04:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4331E18355C6; Wed, 4 Oct 2017 15:04:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvSW006866 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49E7B5E1A1; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECD905E1A0 for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 608181084D9; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9CE1480E6A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:40 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/23] cputest: Use CPU models from QEMU when available X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 04 Oct 2017 15:04:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When testing cpuDecode for computing guest CPU definition from CPUID data (the CPU definition reported by domain capabilities), we need to use CPU models (and their usability blockers) from QEMU if they are available to cpuDecode in the same way it is actually used in the qemu driver. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++-= ---- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index b72c17a168..18618ad309 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -515,6 +515,37 @@ cpuTestMakeQEMUCaps(const struct data *data) qemuCaps =3D NULL; goto cleanup; } + + +static virDomainCapsCPUModelsPtr +cpuTestGetCPUModels(const struct data *data) +{ + virDomainCapsCPUModelsPtr models =3D NULL; + virQEMUCapsPtr qemuCaps; + + if (data->flags !=3D JSON_MODELS) + return NULL; + + if (!(qemuCaps =3D cpuTestMakeQEMUCaps(data))) + return NULL; + + models =3D virQEMUCapsGetCPUDefinitions(qemuCaps, VIR_DOMAIN_VIRT_KVM); + if (models) + virObjectRef(models); + + virObjectUnref(qemuCaps); + + return models; +} + +#else /* if WITH_QEMU && WITH_YAJL */ + +static virDomainCapsCPUModelsPtr +cpuTestGetCPUModels(const struct data *data ATTRIBUTE_UNUSED) +{ + return NULL; +} + #endif =20 =20 @@ -528,6 +559,7 @@ cpuTestCPUID(bool guest, const void *arg) char *host =3D NULL; virCPUDefPtr cpu =3D NULL; char *result =3D NULL; + virDomainCapsCPUModelsPtr models =3D NULL; =20 if (virAsprintf(&hostFile, "%s/cputestdata/%s-cpuid-%s.xml", abs_srcdir, virArchToString(data->arch), data->host) <= 0) @@ -549,7 +581,10 @@ cpuTestCPUID(bool guest, const void *arg) cpu->type =3D VIR_CPU_TYPE_HOST; } =20 - if (cpuDecode(cpu, hostData, NULL) < 0) + if (guest) + models =3D cpuTestGetCPUModels(data); + + if (cpuDecode(cpu, hostData, models) < 0) goto cleanup; =20 if (virAsprintf(&result, "cpuid-%s-%s", @@ -565,6 +600,7 @@ cpuTestCPUID(bool guest, const void *arg) virCPUDataFree(hostData); virCPUDefFree(cpu); VIR_FREE(result); + virObjectUnref(models); return ret; } =20 @@ -686,6 +722,8 @@ cpuTestUpdateLive(const void *arg) virCPUDataPtr disabledData =3D NULL; char *expectedFile =3D NULL; virCPUDefPtr expected =3D NULL; + virDomainCapsCPUModelsPtr hvModels =3D NULL; + virDomainCapsCPUModelsPtr models =3D NULL; int ret =3D -1; =20 if (virAsprintf(&cpuFile, "cpuid-%s-guest", data->host) < 0 || @@ -704,13 +742,42 @@ cpuTestUpdateLive(const void *arg) !(disabledData =3D virCPUDataParse(disabled))) goto cleanup; =20 - if (virCPUUpdateLive(data->arch, cpu, enabledData, disabledData) < 0) - goto cleanup; - if (virAsprintf(&expectedFile, "cpuid-%s-json", data->host) < 0 || !(expected =3D cpuTestLoadXML(data->arch, expectedFile))) goto cleanup; =20 + /* In case the host CPU signature does not exactly match any CPU model= from + * cpu_map.xml, the CPU model we detect from CPUID may differ from the= one + * we compute by asking QEMU. Since this test expands both CPU models = and + * compares their features, we can try to translate the 'actual' CPU to + * use the CPU model from 'expected'. + */ + if (STRNEQ(cpu->model, expected->model)) { + virDomainCapsCPUModelPtr hvModel; + char **blockers =3D NULL; + virDomainCapsCPUUsable usable =3D VIR_DOMCAPS_CPU_USABLE_UNKNOWN; + + if (!(models =3D virDomainCapsCPUModelsNew(0))) + goto cleanup; + + if ((hvModels =3D cpuTestGetCPUModels(data)) && + virCPUModelIsAllowed(expected->model, hvModels, &hvModel)) { + blockers =3D hvModel->blockers; + usable =3D hvModel->usable; + } + + if (virDomainCapsCPUModelsAdd(models, expected->model, -1, + usable, blockers) < 0) + goto cleanup; + + cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; + ignore_value(virCPUTranslate(data->arch, cpu, models)); + cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; + } + + if (virCPUUpdateLive(data->arch, cpu, enabledData, disabledData) < 0) + goto cleanup; + ret =3D cpuTestUpdateLiveCompare(data->arch, cpu, expected); =20 cleanup: @@ -724,6 +791,8 @@ cpuTestUpdateLive(const void *arg) virCPUDataFree(disabledData); VIR_FREE(expectedFile); virCPUDefFree(expected); + virObjectUnref(hvModels); + virObjectUnref(models); return ret; } =20 @@ -915,11 +984,11 @@ mymain(void) DO_TEST(arch, cpuTestHostCPUID, host, host, \ NULL, NULL, 0, 0); \ DO_TEST(arch, cpuTestGuestCPUID, host, host, \ - NULL, NULL, 0, 0); \ + NULL, NULL, json, 0); \ DO_TEST_CPUID_JSON(arch, host, json); \ if (json !=3D JSON_NONE) { \ DO_TEST(arch, cpuTestUpdateLive, host, host, \ - NULL, NULL, 0, 0); \ + NULL, NULL, json, 0); \ } \ } while (0) =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130397054197.8246584147381; Wed, 4 Oct 2017 08:19:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB025C2D0D2A; Wed, 4 Oct 2017 15:19:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC5F060276; Wed, 4 Oct 2017 15:19:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 63F1418355C6; Wed, 4 Oct 2017 15:19:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvN2006898 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id DFC9160472; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B4E56017C for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 644DD10AEF7; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DB025C2D0D2A Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:41 +0200 Message-Id: <691370287c05cb52011d47dac4b874f0ec2b3d14.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/23] cputest: Add query-cpu-definitions reply for Core-i5-2540M X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Oct 2017 15:19:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The unavailable features do not make any difference in this case, because this is a SandyBridge CPU which has an empty list of unavailable features. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 2 +- tests/cputestdata/x86_64-cpuid-Core-i5-2540M.json | 362 ++++++++++++++++++= ++++ 2 files changed, 363 insertions(+), 1 deletion(-) diff --git a/tests/cputest.c b/tests/cputest.c index 18618ad309..1af467e5ee 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1121,7 +1121,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-D510", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Atom-N450", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2500", JSON_HOST); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2540M", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-2540M", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-4670T", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-6600", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-2600", JSON_HOST); diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M.json b/tests/cput= estdata/x86_64-cpuid-Core-i5-2540M.json index d813326f6f..a8ed64ed63 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M.json +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M.json @@ -201,3 +201,365 @@ }, "id": "model-expansion" } + +{ + "return": [ + { + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "max" + }, + { + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "host" + }, + { + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": true, + "name": "base" + }, + { + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu64" + }, + { + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu32" + }, + { + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "pdpe1gb", + "3dnowext", + "3dnow", + "abm", + "sse4a", + "npt" + ], + "migration-safe": true, + "static": false, + "name": "phenom" + }, + { + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium3" + }, + { + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium2" + }, + { + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium" + }, + { + "typename": "n270-x86_64-cpu", + "unavailable-features": [ + "movbe" + ], + "migration-safe": true, + "static": false, + "name": "n270" + }, + { + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm64" + }, + { + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm32" + }, + { + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "coreduo" + }, + { + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "core2duo" + }, + { + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "migration-safe": true, + "static": false, + "name": "athlon" + }, + { + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Westmere" + }, + { + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "mpx", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsavec", + "xgetbv1", + "mpx", + "mpx" + ], + "migration-safe": true, + "static": false, + "name": "Skylake-Client" + }, + { + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "SandyBridge" + }, + { + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Penryn" + }, + { + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "fma", + "f16c", + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4", + "tbm" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G5" + }, + { + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G4" + }, + { + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a", + "misalignsse" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G3" + }, + { + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G2" + }, + { + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G1" + }, + { + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Nehalem" + }, + { + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [ + "f16c", + "rdrand", + "fsgsbase", + "smep", + "erms" + ], + "migration-safe": true, + "static": false, + "name": "IvyBridge" + }, + { + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "abm" + ], + "migration-safe": true, + "static": false, + "name": "Haswell" + }, + { + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "abm" + ], + "migration-safe": true, + "static": false, + "name": "Haswell-noTSX" + }, + { + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Conroe" + }, + { + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell" + }, + { + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell-noTSX" + }, + { + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "486" + } + ], + "id": "definitions" +} --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129554912392.4574257410288; Wed, 4 Oct 2017 08:05:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F92E793F7; Wed, 4 Oct 2017 15:05:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4A0E60472; Wed, 4 Oct 2017 15:05:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E14818355C5; Wed, 4 Oct 2017 15:05:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwxAP006963 for ; Wed, 4 Oct 2017 10:58:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id B414060F81; Wed, 4 Oct 2017 14:58:59 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F3E560F8E for ; Wed, 4 Oct 2017 14:58:56 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 6681D10AEF6; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F92E793F7 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:42 +0200 Message-Id: <0b81a06f5aae2dde8677e6811465e55b4243b82e.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 18/23] cputest: Add CPUID data for Intel(R) Xeon(R) CPU E7-4830 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 04 Oct 2017 15:05:53 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 1 + .../x86_64-cpuid-Xeon-E7-4830-disabled.xml | 5 + .../x86_64-cpuid-Xeon-E7-4830-enabled.xml | 8 + .../x86_64-cpuid-Xeon-E7-4830-guest.xml | 28 +++ .../cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml | 29 +++ .../cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml | 13 ++ tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json | 235 +++++++++++++++++= ++++ tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.xml | 30 +++ 8 files changed, 349 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.xml diff --git a/tests/cputest.c b/tests/cputest.c index 1af467e5ee..f71b4982dd 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1148,6 +1148,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2630", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2650", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4820", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4830", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", JSON_HOST); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E7-4830-disabled.xml new file mode 100644 index 0000000000..a9cbd949e4 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml new file mode 100644 index 0000000000..1b80f414e5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml b/tests/= cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml new file mode 100644 index 0000000000..dbf8580a0e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml @@ -0,0 +1,28 @@ + + SandyBridge + Intel + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml b/tests/c= putestdata/x86_64-cpuid-Xeon-E7-4830-host.xml new file mode 100644 index 0000000000..52902479b9 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-host.xml @@ -0,0 +1,29 @@ + + x86_64 + Westmere + Intel + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml b/tests/c= putestdata/x86_64-cpuid-Xeon-E7-4830-json.xml new file mode 100644 index 0000000000..c3f04d00d1 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml @@ -0,0 +1,13 @@ + + SandyBridge + Intel + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json b/tests/cpute= stdata/x86_64-cpuid-Xeon-E7-4830.json new file mode 100644 index 0000000000..012e1d0c5c --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json @@ -0,0 +1,235 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "pfthreshold": false, + "pku": false, + "rtm": false, + "tsc_adjust": true, + "tsc-deadline": true, + "xstore-en": false, + "cpuid-0xb": true, + "abm": false, + "ia64": false, + "kvm-mmu": false, + "xsaveopt": false, + "hv-spinlocks": -1, + "tce": false, + "realized": false, + "kvm_steal_time": true, + "smep": false, + "fpu": true, + "xcrypt": false, + "sse4_2": true, + "clflush": true, + "sse4_1": true, + "flushbyasid": false, + "kvm-steal-time": true, + "lm": true, + "tsc": true, + "adx": false, + "fxsr": true, + "sha-ni": false, + "decodeassists": false, + "hv-relaxed": false, + "pclmuldq": true, + "xgetbv1": false, + "xstore": false, + "vmcb_clean": false, + "tsc-adjust": true, + "vme": true, + "vendor": "GenuineIntel", + "arat": true, + "ffxsr": false, + "de": true, + "aes": true, + "pse": true, + "ds-cpl": false, + "fxsr_opt": false, + "tbm": false, + "sse": true, + "phe-en": false, + "f16c": false, + "ds": false, + "mpx": false, + "vmware-cpuid-freq": true, + "avx512f": false, + "avx2": false, + "level": 11, + "pbe": false, + "cx16": true, + "ds_cpl": false, + "movbe": false, + "perfctr-nb": false, + "nrip_save": false, + "kvm_mmu": false, + "ospke": false, + "pmu": false, + "avx512ifma": false, + "stepping": 2, + "sep": true, + "sse4a": false, + "avx512dq": false, + "core-id": -1, + "i64": true, + "avx512-4vnniw": false, + "xsave": false, + "pmm": false, + "hle": false, + "nodeid_msr": false, + "hv-crash": false, + "est": false, + "osxsave": false, + "xop": false, + "smx": false, + "tsc-scale": false, + "monitor": false, + "avx512er": false, + "apic": true, + "sse4.1": true, + "sse4.2": true, + "hv-vapic": false, + "pause-filter": false, + "lahf-lm": true, + "kvm-nopiodelay": true, + "cmp_legacy": false, + "acpi": false, + "fma4": false, + "mmx": true, + "svm_lock": false, + "pcommit": false, + "mtrr": true, + "clwb": false, + "dca": false, + "pdcm": false, + "xcrypt-en": false, + "3dnow": false, + "invtsc": false, + "tm2": false, + "hv-time": false, + "hypervisor": true, + "kvmclock-stable-bit": true, + "xlevel": 2147483656, + "lahf_lm": true, + "enforce": false, + "pcid": true, + "sse4-1": true, + "lbrv": false, + "avx512-vpopcntdq": false, + "avx512-4fmaps": false, + "fill-mtrr-mask": true, + "pause_filter": false, + "svm-lock": false, + "popcnt": true, + "nrip-save": false, + "avx512vl": false, + "x2apic": true, + "kvmclock": true, + "smap": false, + "pdpe1gb": true, + "family": 6, + "min-level": 11, + "xlevel2": 0, + "dtes64": false, + "xd": true, + "kvm_pv_eoi": true, + "ace2": false, + "kvm_pv_unhalt": true, + "xtpr": false, + "perfctr_nb": false, + "avx512bw": false, + "l3-cache": true, + "nx": true, + "lwp": false, + "msr": true, + "syscall": true, + "tm": false, + "perfctr-core": false, + "memory": "/machine/unattached/system[0]", + "pge": true, + "pn": false, + "fma": false, + "nodeid-msr": false, + "xsavec": false, + "socket-id": -1, + "thread-id": -1, + "cx8": true, + "mce": true, + "avx512cd": false, + "cr8legacy": false, + "mca": true, + "avx512pf": false, + "pni": true, + "hv-vendor-id": "", + "rdseed": false, + "osvw": false, + "fsgsbase": false, + "model-id": " Intel(R) Xeon(R) CPU E7- 4830 @ 2.13GHz", + "cmp-legacy": false, + "kvm-pv-unhalt": true, + "rdtscp": true, + "mmxext": false, + "host-phys-bits": true, + "cid": false, + "vmx": false, + "ssse3": true, + "extapic": false, + "pse36": true, + "min-xlevel": 2147483656, + "ibs": false, + "la57": false, + "avx": false, + "kvm-no-smi-migration": false, + "ace2-en": false, + "umip": false, + "invpcid": false, + "bmi1": false, + "bmi2": false, + "vmcb-clean": false, + "erms": false, + "cmov": true, + "check": true, + "perfctr_core": false, + "misalignsse": false, + "clflushopt": false, + "pat": true, + "sse4-2": true, + "3dnowprefetch": false, + "rdpid": false, + "full-cpuid-auto-level": true, + "pae": true, + "wdt": false, + "tsc_scale": false, + "skinit": false, + "fxsr-opt": false, + "kvm_nopiodelay": true, + "phys-bits": 0, + "kvm": true, + "pmm-en": false, + "phe": false, + "3dnowext": false, + "lmce": true, + "ht": false, + "tsc-frequency": 0, + "kvm-pv-eoi": true, + "npt": false, + "apic-id": 4294967295, + "kvm_asyncpf": true, + "min-xlevel2": 0, + "pclmulqdq": true, + "svm": false, + "sse3": true, + "sse2": true, + "ss": true, + "topoext": false, + "rdrand": false, + "avx512vbmi": false, + "kvm-asyncpf": true, + "xsaves": false, + "model": 47 + } + } + }, + "id": "model-expansion" +} diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.xml b/tests/cputes= tdata/x86_64-cpuid-Xeon-E7-4830.xml new file mode 100644 index 0000000000..d565238167 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129952252401.77504283407904; Wed, 4 Oct 2017 08:12:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 382533E2A5; Wed, 4 Oct 2017 15:12:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B83960276; Wed, 4 Oct 2017 15:12:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CA5103FAD2; Wed, 4 Oct 2017 15:12:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvtW006871 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92AD66293E; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1790362690 for ; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 6C14310AEFE; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 382533E2A5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:43 +0200 Message-Id: <571a5776923af5fc13a734fbde8a57e349e289b9.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 19/23] cputest: Add query-cpu-definitions reply for Xeon-E7-4830 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Oct 2017 15:12:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This CPU was incorrectly detected as SandyBridge before because the number of additional elements was the same for both SandyBridge and Westmere CPU models, but SandyBridge is newer (the CPU signature does not help here because it doesn't match any signature defined in cpu_map.xml). But since QEMU's version of SandyBridge CPU model contains xsaveopt which needs to be disabled, Westmere becomes the best CPU model when translating CPUID data to virCPUDef. Unfortunately, this doesn't help with translating the data we got from QEMU and the CPU model is still computed as SandyBridge in this case. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 2 +- .../x86_64-cpuid-Xeon-E7-4830-guest.xml | 8 +- .../cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml | 1 + tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json | 422 +++++++++++++++++= ++++ 4 files changed, 428 insertions(+), 5 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index f71b4982dd..f1aa227aac 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1148,7 +1148,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2630", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2650", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4820", JSON_HOST); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4830", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4830", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-8890", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-Gold-6148", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", JSON_HOST); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml b/tests/= cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml index dbf8580a0e..659779687a 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-guest.xml @@ -1,5 +1,5 @@ - SandyBridge + Westmere Intel @@ -8,6 +8,7 @@ + @@ -19,10 +20,9 @@ + + - - - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml b/tests/c= putestdata/x86_64-cpuid-Xeon-E7-4830-json.xml index c3f04d00d1..aae32bd7e2 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-json.xml @@ -10,4 +10,5 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json b/tests/cpute= stdata/x86_64-cpuid-Xeon-E7-4830.json index 012e1d0c5c..732f65d1d9 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830.json @@ -233,3 +233,425 @@ }, "id": "model-expansion" } + +{ + "return": [ + { + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "max" + }, + { + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "host" + }, + { + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": true, + "name": "base" + }, + { + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu64" + }, + { + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu32" + }, + { + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "abm", + "sse4a", + "npt" + ], + "migration-safe": true, + "static": false, + "name": "phenom" + }, + { + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium3" + }, + { + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium2" + }, + { + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium" + }, + { + "typename": "n270-x86_64-cpu", + "unavailable-features": [ + "movbe" + ], + "migration-safe": true, + "static": false, + "name": "n270" + }, + { + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm64" + }, + { + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm32" + }, + { + "typename": "cpu64-rhel6-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a" + ], + "migration-safe": true, + "static": false, + "name": "cpu64-rhel6" + }, + { + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "coreduo" + }, + { + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "core2duo" + }, + { + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "migration-safe": true, + "static": false, + "name": "athlon" + }, + { + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Westmere" + }, + { + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "mpx", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsaveopt", + "xsavec", + "xgetbv1", + "xsave", + "xsave", + "avx", + "mpx", + "mpx" + ], + "migration-safe": true, + "static": false, + "name": "Skylake-Client" + }, + { + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [ + "xsave", + "avx", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "SandyBridge" + }, + { + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Penryn" + }, + { + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "fma", + "xsave", + "avx", + "f16c", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4", + "tbm", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G5" + }, + { + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "xsave", + "avx", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G4" + }, + { + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a", + "misalignsse" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G3" + }, + { + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G2" + }, + { + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G1" + }, + { + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Nehalem" + }, + { + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [ + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "smep", + "erms", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "IvyBridge" + }, + { + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "abm", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Haswell" + }, + { + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "abm", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Haswell-noTSX" + }, + { + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Conroe" + }, + { + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell" + }, + { + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "xsave", + "avx", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsaveopt", + "xsave", + "xsave", + "avx" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell-noTSX" + }, + { + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "486" + } + ], + "id": "definitions" +} --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130379751818.8137144363715; Wed, 4 Oct 2017 08:19:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E1C42577F; Wed, 4 Oct 2017 15:19:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68ECC70521; Wed, 4 Oct 2017 15:19:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 30B9A1806100; Wed, 4 Oct 2017 15:19:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94Ewv2G006873 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96F5D62690; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DADD63628 for ; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 6F5C710AF02; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8E1C42577F Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:44 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 20/23] cputest: Update Xeon-E3-1245 data X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Oct 2017 15:19:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" xsaves is supported by current QEMU/KVM on this CPU. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- .../x86_64-cpuid-Xeon-E3-1245-disabled.xml | 1 - .../x86_64-cpuid-Xeon-E3-1245-enabled.xml | 2 +- .../cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml | 1 + tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json | 413 +++++++++++------= ---- tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.xml | 7 +- 5 files changed, 232 insertions(+), 192 deletions(-) diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml index 1a177705a8..4a0477f788 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml @@ -1,6 +1,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml index 2584042339..f31f7317b6 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml @@ -3,7 +3,7 @@ - + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml b/tests/c= putestdata/x86_64-cpuid-Xeon-E3-1245-json.xml index 7af75509e6..ad98679027 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-json.xml @@ -6,5 +6,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json b/tests/cpute= stdata/x86_64-cpuid-Xeon-E3-1245.json index 4828da5884..bb5d7d8830 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json @@ -3,199 +3,238 @@ "model": { "name": "base", "props": { - "pfthreshold": false, - "pku": false, - "rtm": true, - "tsc_adjust": true, - "tsc-deadline": true, - "xstore-en": false, - "tsc-scale": false, - "sse": true, - "smap": true, - "stepping": 3, - "tce": false, - "kvm_steal_time": true, - "smep": true, - "rdpid": false, - "xcrypt": false, - "sse4_2": true, - "monitor": false, - "sse4_1": true, - "kvm-mmu": false, - "flushbyasid": false, - "kvm-steal-time": true, - "lm": true, - "tsc": true, - "adx": true, - "fxsr": true, - "sha-ni": false, - "tm": false, - "pclmuldq": true, - "xgetbv1": true, - "xstore": false, - "vmcb_clean": false, - "vme": true, - "vendor": "GenuineIntel", - "arat": true, - "ffxsr": false, - "de": true, - "avx512f": false, - "pse": true, - "ds-cpl": false, - "tbm": false, - "ia64": false, - "phe-en": false, - "f16c": true, - "ds": false, - "mpx": true, - "tsc-adjust": true, - "aes": true, - "avx2": true, - "pbe": false, - "cx16": true, - "ds_cpl": false, - "movbe": true, - "perfctr-nb": false, - "nrip_save": false, - "kvm_mmu": false, - "ospke": false, - "avx512ifma": false, - "vmx": true, - "sep": true, - "xsaveopt": true, - "sse4a": false, - "avx512dq": false, - "i64": true, - "avx512-4vnniw": false, - "xsave": true, - "erms": true, - "hle": true, - "nodeid_msr": false, - "est": false, - "svm_lock": false, - "xop": false, - "model-id": "Intel(R) Xeon(R) CPU E3-1245 v5 @ 3.50GHz", - "abm": true, - "avx512er": false, - "sse4.1": true, - "sse4.2": true, - "pause-filter": false, - "lahf-lm": true, - "kvm-nopiodelay": true, - "cmp_legacy": false, - "acpi": false, - "fma4": false, - "popcnt": true, - "mmx": true, - "osxsave": false, - "pcommit": false, - "avx512pf": false, - "clwb": false, - "dca": false, - "pdcm": false, - "xcrypt-en": false, - "3dnow": false, - "invtsc": false, - "tm2": false, - "hypervisor": true, - "kvmclock-stable-bit": true, - "fxsr-opt": false, - "pcid": true, - "sse4-1": true, - "sse4-2": true, - "avx512-vpopcntdq": false, - "avx512-4fmaps": false, - "pause_filter": false, - "svm-lock": false, - "rdrand": true, - "nrip-save": false, - "avx512vl": false, - "x2apic": true, - "kvmclock": true, - "pge": true, - "family": 6, - "dtes64": false, - "xd": true, - "kvm_pv_eoi": true, - "ace2": false, - "kvm_pv_unhalt": true, - "xtpr": false, - "perfctr_nb": false, - "avx512bw": false, - "nx": true, - "lwp": false, - "msr": true, - "ace2-en": false, - "decodeassists": false, - "perfctr-core": false, - "pn": false, - "fma": true, - "nodeid-msr": false, - "kvm_asyncpf": true, - "clflush": true, - "cx8": true, - "mce": true, - "avx512cd": false, - "cr8legacy": false, - "mca": true, - "pni": true, - "rdseed": true, - "apic": true, - "fsgsbase": true, - "cmp-legacy": false, - "kvm-pv-unhalt": true, - "rdtscp": true, - "mmxext": false, - "cid": false, - "ssse3": true, - "extapic": false, - "pse36": true, - "mtrr": true, - "ibs": false, - "la57": false, - "avx": true, - "syscall": true, - "umip": false, - "invpcid": true, - "avx512vbmi": false, - "kvm-asyncpf": true, - "vmcb-clean": false, - "pmm": false, + "phys-bits": 0, + "core-id": -1, + "xlevel": 2147483656, "cmov": true, - "perfctr_core": false, - "misalignsse": false, - "clflushopt": true, - "pat": true, - "lbrv": false, - "3dnowprefetch": true, - "fpu": true, - "pae": true, - "wdt": false, - "tsc_scale": false, - "skinit": false, - "fxsr_opt": false, - "kvm_nopiodelay": true, - "pmm-en": false, - "phe": false, - "3dnowext": false, - "osvw": false, - "ht": false, - "pdpe1gb": true, - "kvm-pv-eoi": true, - "npt": false, + "ia64": false, + "aes": true, + "mmx": true, + "arat": true, + "rdpid": false, + "pause-filter": false, "xsavec": true, - "lahf_lm": true, - "pclmulqdq": true, + "osxsave": false, + "tsc-frequency": 0, + "xd": true, + "hv-vendor-id": "", + "kvm-asyncpf": true, + "kvm_asyncpf": true, + "perfctr_core": false, + "perfctr-core": false, + "mpx": true, + "avx512cd": false, + "decodeassists": false, + "pbe": false, + "sse4_1": true, + "sse4.1": true, + "sse4-1": true, + "family": 6, + "vmware-cpuid-freq": true, + "avx512f": false, + "xcrypt": false, + "hv-runtime": false, + "msr": true, + "mce": true, + "mca": true, + "thread-id": -1, + "min-level": 13, + "xgetbv1": true, + "cid": false, + "hv-relaxed": false, + "fxsr": true, + "ds": false, + "hv-crash": false, + "xsaveopt": true, + "xtpr": false, + "avx512-vpopcntdq": false, + "phe": false, + "avx512vl": false, + "extapic": false, + "3dnowprefetch": true, + "cr8legacy": false, + "cpuid-0xb": true, + "xcrypt-en": false, + "kvm_pv_eoi": true, + "apic-id": 4294967295, + "pn": false, + "dca": false, + "vendor": "GenuineIntel", + "pku": false, + "smx": false, + "cmp-legacy": false, + "cmp_legacy": false, + "node-id": -1, + "avx512-4fmaps": false, + "vmcb-clean": false, + "vmcb_clean": false, + "3dnowext": false, + "hle": true, + "npt": false, + "memory": "/machine/unattached/system[0]", + "clwb": false, + "lbrv": false, + "adx": true, + "ss": true, + "pni": true, + "svm_lock": false, + "svm-lock": false, + "smep": true, + "pfthreshold": false, + "smap": true, + "x2apic": true, + "avx512vbmi": false, + "hv-stimer": false, + "i64": true, + "flushbyasid": false, + "f16c": true, + "ace2-en": false, + "pat": true, + "pae": true, + "sse": true, + "phe-en": false, + "kvm-nopiodelay": true, + "kvm_nopiodelay": true, + "tm": false, + "kvmclock-stable-bit": true, + "hypervisor": true, + "socket-id": -1, + "pcommit": false, + "syscall": true, + "level": 13, + "avx512dq": false, "svm": false, + "full-cpuid-auto-level": true, + "hv-reset": false, + "invtsc": false, "sse3": true, "sse2": true, - "ss": true, - "topoext": false, - "smx": false, - "bmi1": true, + "est": false, + "avx512ifma": false, + "tm2": false, + "kvm-pv-eoi": true, + "cx8": true, + "kvm-mmu": false, + "kvm_mmu": false, + "sse4_2": true, + "sse4.2": true, + "sse4-2": true, + "pge": true, + "fill-mtrr-mask": true, + "pdcm": false, + "nodeid_msr": false, + "model": 94, + "movbe": true, + "nrip-save": false, + "nrip_save": false, + "sse4a": false, + "ssse3": true, + "kvm_pv_unhalt": true, + "invpcid": true, + "pdpe1gb": true, + "tsc-deadline": true, + "fma": true, + "cx16": true, + "de": true, + "enforce": false, + "stepping": 3, + "xsave": true, + "clflush": true, + "skinit": false, + "tce": false, + "tsc": true, + "fpu": true, + "ds-cpl": false, + "ds_cpl": false, + "ibs": false, + "host-phys-bits": false, + "fma4": false, + "la57": false, + "osvw": false, + "check": true, + "hv-spinlocks": -1, + "pmm": false, + "apic": true, + "pmu": false, + "min-xlevel2": 0, + "tsc-adjust": true, + "tsc_adjust": true, + "kvm-steal-time": true, + "kvm_steal_time": true, + "kvmclock": true, + "l3-cache": true, + "lwp": false, + "xop": false, + "avx": true, + "ospke": false, + "ace2": false, + "acpi": false, + "avx512bw": false, + "hv-vapic": false, + "fsgsbase": true, + "ht": false, + "nx": true, + "pclmulqdq": true, + "mmxext": false, + "popcnt": true, + "xsaves": true, + "tcg-cpuid": true, + "lm": true, + "umip": false, + "avx2": true, + "pse": true, + "sep": true, + "pclmuldq": true, + "nodeid-msr": false, + "kvm": true, + "misalignsse": false, + "min-xlevel": 2147483656, "bmi2": true, - "xsaves": false, - "model": 94 + "bmi1": true, + "kvm-pv-unhalt": true, + "realized": false, + "tsc_scale": false, + "tsc-scale": false, + "topoext": false, + "hv-vpindex": false, + "xlevel2": 0, + "clflushopt": true, + "kvm-no-smi-migration": false, + "monitor": false, + "avx512er": false, + "pmm-en": false, + "pcid": true, + "3dnow": false, + "erms": true, + "lahf-lm": true, + "lahf_lm": true, + "xstore": false, + "hv-synic": false, + "fxsr-opt": false, + "fxsr_opt": false, + "rtm": true, + "lmce": true, + "hv-time": false, + "perfctr-nb": false, + "perfctr_nb": false, + "ffxsr": false, + "rdrand": true, + "rdseed": true, + "avx512-4vnniw": false, + "vme": true, + "vmx": true, + "dtes64": false, + "mtrr": true, + "rdtscp": true, + "pse36": true, + "tbm": false, + "wdt": false, + "pause_filter": false, + "model-id": "Intel(R) Xeon(R) CPU E3-1245 v5 @ 3.50GHz", + "sha-ni": false, + "abm": true, + "avx512pf": false, + "xstore-en": false } } }, diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.xml b/tests/cputes= tdata/x86_64-cpuid-Xeon-E3-1245.xml index 42992db7d9..f130a70f37 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.xml @@ -1,7 +1,7 @@ - + @@ -14,14 +14,15 @@ - - + + + --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507129516658636.9823806040578; Wed, 4 Oct 2017 08:05:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AB2A8210B; Wed, 4 Oct 2017 15:05:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 277126363C; Wed, 4 Oct 2017 15:05:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D916918355C8; Wed, 4 Oct 2017 15:05:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwvVp006883 for ; Wed, 4 Oct 2017 10:58:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF2E562690; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D2575EE04 for ; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 72D3A10B83D; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4AB2A8210B Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:45 +0200 Message-Id: <5ff8372db7a297910bcd3a636ed74f6dde1c1c33.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 21/23] cputest: Add query-cpu-definitions reply for Xeon-E3-1245 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Oct 2017 15:05:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 2 +- tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json | 299 +++++++++++++++++++= ++++ 2 files changed, 300 insertions(+), 1 deletion(-) diff --git a/tests/cputest.c b/tests/cputest.c index f1aa227aac..cfd63bfcf7 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1144,7 +1144,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Phenom-B95", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Ryzen-7-1800X-Eight-Core", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-5110", JSON_NONE); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1245", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1245", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2630", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2650", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E7-4820", JSON_HOST); diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json b/tests/cpute= stdata/x86_64-cpuid-Xeon-E3-1245.json index bb5d7d8830..33d8221853 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245.json @@ -240,3 +240,302 @@ }, "id": "model-expansion" } + +{ + "return": [ + { + "name": "max", + "typename": "max-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": false + }, + { + "name": "host", + "typename": "host-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": false + }, + { + "name": "base", + "typename": "base-x86_64-cpu", + "unavailable-features": [ + ], + "static": true, + "migration-safe": true + }, + { + "name": "qemu64", + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "qemu32", + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "phenom", + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "3dnowext", + "3dnow", + "sse4a", + "npt" + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium3", + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium2", + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "pentium", + "typename": "pentium-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "n270", + "typename": "n270-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "kvm64", + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "kvm32", + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "coreduo", + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "core2duo", + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "athlon", + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Westmere", + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Server", + "typename": "Skylake-Server-x86_64-cpu", + "unavailable-features": [ + "avx512f", + "avx512dq", + "clwb", + "avx512cd", + "avx512bw", + "avx512vl", + "avx512f", + "avx512f", + "avx512f" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Skylake-Client", + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "SandyBridge", + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Penryn", + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G5", + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4", + "tbm" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G4", + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse", + "xop", + "fma4" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G3", + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "sse4a", + "misalignsse" + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G2", + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Opteron_G1", + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Nehalem", + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "IvyBridge", + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell", + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Haswell-noTSX", + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Conroe", + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell", + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "Broadwell-noTSX", + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + }, + { + "name": "486", + "typename": "486-x86_64-cpu", + "unavailable-features": [ + ], + "static": false, + "migration-safe": true + } + ], + "id": "definitions" +} --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130017850129.6943043846892; Wed, 4 Oct 2017 08:13:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5CFD780CF; Wed, 4 Oct 2017 15:13:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A51F66FF03; Wed, 4 Oct 2017 15:13:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6F5B93FACF; Wed, 4 Oct 2017 15:13:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwwJF006903 for ; Wed, 4 Oct 2017 10:58:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 128386017C; Wed, 4 Oct 2017 14:58:58 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8BFB460467 for ; Wed, 4 Oct 2017 14:58:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 747FB10AEF9; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C5CFD780CF Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:46 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 22/23] cputest: Update Core-i7-2600 data X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 04 Oct 2017 15:13:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" arat is now enabled even if the hardware does not support it. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- .../x86_64-cpuid-Core-i7-2600-disabled.xml | 1 - .../x86_64-cpuid-Core-i7-2600-enabled.xml | 1 + .../cputestdata/x86_64-cpuid-Core-i7-2600-json.xml | 1 + tests/cputestdata/x86_64-cpuid-Core-i7-2600.json | 496 +++++++++++++++++= ++-- tests/cputestdata/x86_64-cpuid-Core-i7-2600.xml | 6 +- 5 files changed, 455 insertions(+), 50 deletions(-) diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml index f25d2888eb..510cd97a5b 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml @@ -1,6 +1,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml index df99a21807..1581f800f1 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml @@ -1,6 +1,7 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml b/tests/c= putestdata/x86_64-cpuid-Core-i7-2600-json.xml index 25c87e164e..c9ae651922 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-json.xml @@ -5,6 +5,7 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600.json b/tests/cpute= stdata/x86_64-cpuid-Core-i7-2600.json index 19c448c10b..c80c89b0d7 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600.json +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600.json @@ -9,19 +9,21 @@ "tsc_adjust": true, "tsc-deadline": true, "xstore-en": false, - "tsc-scale": false, - "sse": true, - "smap": false, - "stepping": 7, + "cpuid-0xb": true, + "abm": false, + "ia64": false, + "kvm-mmu": false, + "xsaveopt": true, + "hv-spinlocks": -1, "tce": false, + "realized": false, "kvm_steal_time": true, "smep": false, - "rdpid": false, + "fpu": true, "xcrypt": false, "sse4_2": true, - "monitor": false, + "clflush": true, "sse4_1": true, - "kvm-mmu": false, "flushbyasid": false, "kvm-steal-time": true, "lm": true, @@ -29,28 +31,32 @@ "adx": false, "fxsr": true, "sha-ni": false, - "tm": false, + "decodeassists": false, + "hv-relaxed": false, "pclmuldq": true, "xgetbv1": false, "xstore": false, "vmcb_clean": false, + "tsc-adjust": true, "vme": true, "vendor": "GenuineIntel", - "arat": false, + "arat": true, "ffxsr": false, "de": true, - "avx512f": false, + "aes": true, "pse": true, "ds-cpl": false, + "fxsr_opt": false, "tbm": false, - "ia64": false, + "sse": true, "phe-en": false, "f16c": false, "ds": false, "mpx": false, - "tsc-adjust": true, - "aes": true, + "vmware-cpuid-freq": true, + "avx512f": false, "avx2": false, + "level": 13, "pbe": false, "cx16": true, "ds_cpl": false, @@ -59,37 +65,41 @@ "nrip_save": false, "kvm_mmu": false, "ospke": false, + "pmu": false, "avx512ifma": false, - "vmx": false, + "stepping": 7, "sep": true, - "xsaveopt": true, "sse4a": false, "avx512dq": false, + "core-id": -1, "i64": true, "avx512-4vnniw": false, "xsave": true, - "erms": false, + "pmm": false, "hle": false, "nodeid_msr": false, + "hv-crash": false, "est": false, - "svm_lock": false, + "osxsave": false, "xop": false, - "model-id": " Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz", - "abm": false, + "smx": false, + "tsc-scale": false, + "monitor": false, "avx512er": false, + "apic": true, "sse4.1": true, "sse4.2": true, + "hv-vapic": false, "pause-filter": false, "lahf-lm": true, "kvm-nopiodelay": true, "cmp_legacy": false, "acpi": false, "fma4": false, - "popcnt": true, "mmx": true, - "osxsave": false, + "svm_lock": false, "pcommit": false, - "avx512pf": false, + "mtrr": true, "clwb": false, "dca": false, "pdcm": false, @@ -97,23 +107,30 @@ "3dnow": false, "invtsc": false, "tm2": false, + "hv-time": false, "hypervisor": true, "kvmclock-stable-bit": true, - "fxsr-opt": false, + "xlevel": 2147483656, + "lahf_lm": true, + "enforce": false, "pcid": true, "sse4-1": true, - "sse4-2": true, + "lbrv": false, "avx512-vpopcntdq": false, "avx512-4fmaps": false, + "fill-mtrr-mask": true, "pause_filter": false, "svm-lock": false, - "rdrand": false, + "popcnt": true, "nrip-save": false, "avx512vl": false, "x2apic": true, "kvmclock": true, - "pge": true, + "smap": false, + "pdpe1gb": false, "family": 6, + "min-level": 13, + "xlevel2": 0, "dtes64": false, "xd": true, "kvm_pv_eoi": true, @@ -122,78 +139,93 @@ "xtpr": false, "perfctr_nb": false, "avx512bw": false, + "l3-cache": true, "nx": true, "lwp": false, "msr": true, - "ace2-en": false, - "decodeassists": false, + "syscall": true, + "tm": false, "perfctr-core": false, + "memory": "/machine/unattached/system[0]", + "pge": true, "pn": false, "fma": false, "nodeid-msr": false, - "kvm_asyncpf": true, - "clflush": true, + "xsavec": false, + "socket-id": -1, + "thread-id": -1, "cx8": true, "mce": true, "avx512cd": false, "cr8legacy": false, "mca": true, + "avx512pf": false, "pni": true, + "hv-vendor-id": "", "rdseed": false, - "apic": true, + "osvw": false, "fsgsbase": false, + "model-id": " Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz", "cmp-legacy": false, "kvm-pv-unhalt": true, "rdtscp": true, "mmxext": false, + "host-phys-bits": true, "cid": false, + "vmx": false, "ssse3": true, "extapic": false, "pse36": true, - "mtrr": true, + "min-xlevel": 2147483656, "ibs": false, "la57": false, "avx": true, - "syscall": true, + "kvm-no-smi-migration": false, + "ace2-en": false, "umip": false, "invpcid": false, - "avx512vbmi": false, - "kvm-asyncpf": true, + "bmi1": false, + "bmi2": false, "vmcb-clean": false, - "pmm": false, + "erms": false, "cmov": true, + "check": true, "perfctr_core": false, "misalignsse": false, "clflushopt": false, "pat": true, - "lbrv": false, + "sse4-2": true, "3dnowprefetch": false, - "fpu": true, + "rdpid": false, + "full-cpuid-auto-level": true, "pae": true, "wdt": false, "tsc_scale": false, "skinit": false, - "fxsr_opt": false, + "fxsr-opt": false, "kvm_nopiodelay": true, + "phys-bits": 0, + "kvm": true, "pmm-en": false, "phe": false, "3dnowext": false, - "osvw": false, + "lmce": true, "ht": false, - "pdpe1gb": false, + "tsc-frequency": 0, "kvm-pv-eoi": true, "npt": false, - "xsavec": false, - "lahf_lm": true, + "apic-id": 4294967295, + "kvm_asyncpf": true, + "min-xlevel2": 0, "pclmulqdq": true, "svm": false, "sse3": true, "sse2": true, "ss": true, "topoext": false, - "smx": false, - "bmi1": false, - "bmi2": false, + "rdrand": false, + "avx512vbmi": false, + "kvm-asyncpf": true, "xsaves": false, "model": 42 } @@ -201,3 +233,375 @@ }, "id": "model-expansion" } + +{ + "return": [ + { + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "max" + }, + { + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "host" + }, + { + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": true, + "name": "base" + }, + { + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu64" + }, + { + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu32" + }, + { + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "pdpe1gb", + "3dnowext", + "3dnow", + "abm", + "sse4a", + "npt" + ], + "migration-safe": true, + "static": false, + "name": "phenom" + }, + { + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium3" + }, + { + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium2" + }, + { + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium" + }, + { + "typename": "n270-x86_64-cpu", + "unavailable-features": [ + "movbe" + ], + "migration-safe": true, + "static": false, + "name": "n270" + }, + { + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm64" + }, + { + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm32" + }, + { + "typename": "cpu64-rhel6-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a" + ], + "migration-safe": true, + "static": false, + "name": "cpu64-rhel6" + }, + { + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "coreduo" + }, + { + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "core2duo" + }, + { + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "migration-safe": true, + "static": false, + "name": "athlon" + }, + { + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Westmere" + }, + { + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "mpx", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsavec", + "xgetbv1", + "mpx", + "mpx" + ], + "migration-safe": true, + "static": false, + "name": "Skylake-Client" + }, + { + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "SandyBridge" + }, + { + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Penryn" + }, + { + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "fma", + "f16c", + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4", + "tbm" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G5" + }, + { + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G4" + }, + { + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a", + "misalignsse" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G3" + }, + { + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G2" + }, + { + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G1" + }, + { + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Nehalem" + }, + { + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [ + "f16c", + "rdrand", + "fsgsbase", + "smep", + "erms" + ], + "migration-safe": true, + "static": false, + "name": "IvyBridge" + }, + { + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "abm" + ], + "migration-safe": true, + "static": false, + "name": "Haswell" + }, + { + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "abm" + ], + "migration-safe": true, + "static": false, + "name": "Haswell-noTSX" + }, + { + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Conroe" + }, + { + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell" + }, + { + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell-noTSX" + }, + { + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "486" + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600.xml b/tests/cputes= tdata/x86_64-cpuid-Core-i7-2600.xml index ad15597d6b..8c0f847fef 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600.xml @@ -1,7 +1,7 @@ - + @@ -14,8 +14,8 @@ - - + + --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 05:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130058448843.5757907318025; Wed, 4 Oct 2017 08:14:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EF60C04AC50; Wed, 4 Oct 2017 15:14:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1857A5E1A6; Wed, 4 Oct 2017 15:14:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D21FB3FAD0; Wed, 4 Oct 2017 15:14:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v94EwxqT006941 for ; Wed, 4 Oct 2017 10:58:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8F56FDD8; Wed, 4 Oct 2017 14:58:59 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B299F6FDD9 for ; Wed, 4 Oct 2017 14:58:58 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 78EEF10B83E; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4EF60C04AC50 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:47 +0200 Message-Id: <298432099a76c25c49a55daefcbec1058c15ec5c.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 23/23] cputest: Make a crippled version of Core-i7-2600 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 04 Oct 2017 15:14:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" xsaveopt is artificially removed from the host to test disabled feature which is only included in QEMU's version of the CPU model. Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- tests/cputest.c | 1 + ...x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml | 6 + .../x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml | 8 + .../x86_64-cpuid-Core-i7-2600-xsaveopt-guest.xml | 25 + .../x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml | 25 + .../x86_64-cpuid-Core-i7-2600-xsaveopt-json.xml | 11 + .../x86_64-cpuid-Core-i7-2600-xsaveopt.json | 615 +++++++++++++++++= ++++ .../x86_64-cpuid-Core-i7-2600-xsaveopt.xml | 33 ++ 8 files changed, 724 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-di= sabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-en= abled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-gu= est.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-ho= st.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-js= on.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.js= on create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.xml diff --git a/tests/cputest.c b/tests/cputest.c index cfd63bfcf7..6b48956c4d 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -1125,6 +1125,7 @@ mymain(void) DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-4670T", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i5-6600", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-2600", JSON_HOST); + DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-2600-xsaveopt", JSON_MODELS); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3520M", JSON_NONE); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3740QM", JSON_HOST); DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-3770", JSON_HOST); diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.= xml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml new file mode 100644 index 0000000000..281cc1512a --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.x= ml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml new file mode 100644 index 0000000000..3c2d7e33d6 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-guest.xml= b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-guest.xml new file mode 100644 index 0000000000..9bb60009e8 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-guest.xml @@ -0,0 +1,25 @@ + + SandyBridge + Intel + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml = b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml new file mode 100644 index 0000000000..e139004923 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-host.xml @@ -0,0 +1,25 @@ + + x86_64 + SandyBridge + Intel + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-json.xml = b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-json.xml new file mode 100644 index 0000000000..3a799052e7 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-json.xml @@ -0,0 +1,11 @@ + + SandyBridge + Intel + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.json b/te= sts/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.json new file mode 100644 index 0000000000..ae079f3c54 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.json @@ -0,0 +1,615 @@ +{ + "return": { + "model": { + "name": "base", + "props": { + "pfthreshold": false, + "pku": false, + "rtm": false, + "tsc_adjust": true, + "tsc-deadline": true, + "xstore-en": false, + "cpuid-0xb": true, + "abm": false, + "ia64": false, + "kvm-mmu": false, + "xsaveopt": false, + "hv-spinlocks": -1, + "tce": false, + "realized": false, + "kvm_steal_time": true, + "smep": false, + "fpu": true, + "xcrypt": false, + "sse4_2": true, + "clflush": true, + "sse4_1": true, + "flushbyasid": false, + "kvm-steal-time": true, + "lm": true, + "tsc": true, + "adx": false, + "fxsr": true, + "sha-ni": false, + "decodeassists": false, + "hv-relaxed": false, + "pclmuldq": true, + "xgetbv1": false, + "xstore": false, + "vmcb_clean": false, + "tsc-adjust": true, + "vme": true, + "vendor": "GenuineIntel", + "arat": true, + "ffxsr": false, + "de": true, + "aes": true, + "pse": true, + "ds-cpl": false, + "fxsr_opt": false, + "tbm": false, + "sse": true, + "phe-en": false, + "f16c": false, + "ds": false, + "mpx": false, + "vmware-cpuid-freq": true, + "avx512f": false, + "avx2": false, + "level": 13, + "pbe": false, + "cx16": true, + "ds_cpl": false, + "movbe": false, + "perfctr-nb": false, + "nrip_save": false, + "kvm_mmu": false, + "ospke": false, + "pmu": false, + "avx512ifma": false, + "stepping": 7, + "sep": true, + "sse4a": false, + "avx512dq": false, + "core-id": -1, + "i64": true, + "avx512-4vnniw": false, + "xsave": true, + "pmm": false, + "hle": false, + "nodeid_msr": false, + "hv-crash": false, + "est": false, + "osxsave": false, + "xop": false, + "smx": false, + "tsc-scale": false, + "monitor": false, + "avx512er": false, + "apic": true, + "sse4.1": true, + "sse4.2": true, + "hv-vapic": false, + "pause-filter": false, + "lahf-lm": true, + "kvm-nopiodelay": true, + "cmp_legacy": false, + "acpi": false, + "fma4": false, + "mmx": true, + "svm_lock": false, + "pcommit": false, + "mtrr": true, + "clwb": false, + "dca": false, + "pdcm": false, + "xcrypt-en": false, + "3dnow": false, + "invtsc": false, + "tm2": false, + "hv-time": false, + "hypervisor": true, + "kvmclock-stable-bit": true, + "xlevel": 2147483656, + "lahf_lm": true, + "enforce": false, + "pcid": true, + "sse4-1": true, + "lbrv": false, + "avx512-vpopcntdq": false, + "avx512-4fmaps": false, + "fill-mtrr-mask": true, + "pause_filter": false, + "svm-lock": false, + "popcnt": true, + "nrip-save": false, + "avx512vl": false, + "x2apic": true, + "kvmclock": true, + "smap": false, + "pdpe1gb": false, + "family": 6, + "min-level": 13, + "xlevel2": 0, + "dtes64": false, + "xd": true, + "kvm_pv_eoi": true, + "ace2": false, + "kvm_pv_unhalt": true, + "xtpr": false, + "perfctr_nb": false, + "avx512bw": false, + "l3-cache": true, + "nx": true, + "lwp": false, + "msr": true, + "syscall": true, + "tm": false, + "perfctr-core": false, + "memory": "/machine/unattached/system[0]", + "pge": true, + "pn": false, + "fma": false, + "nodeid-msr": false, + "xsavec": false, + "socket-id": -1, + "thread-id": -1, + "cx8": true, + "mce": true, + "avx512cd": false, + "cr8legacy": false, + "mca": true, + "avx512pf": false, + "pni": true, + "hv-vendor-id": "", + "rdseed": false, + "osvw": false, + "fsgsbase": false, + "model-id": " Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz", + "cmp-legacy": false, + "kvm-pv-unhalt": true, + "rdtscp": true, + "mmxext": false, + "host-phys-bits": true, + "cid": false, + "vmx": false, + "ssse3": true, + "extapic": false, + "pse36": true, + "min-xlevel": 2147483656, + "ibs": false, + "la57": false, + "avx": true, + "kvm-no-smi-migration": false, + "ace2-en": false, + "umip": false, + "invpcid": false, + "bmi1": false, + "bmi2": false, + "vmcb-clean": false, + "erms": false, + "cmov": true, + "check": true, + "perfctr_core": false, + "misalignsse": false, + "clflushopt": false, + "pat": true, + "sse4-2": true, + "3dnowprefetch": false, + "rdpid": false, + "full-cpuid-auto-level": true, + "pae": true, + "wdt": false, + "tsc_scale": false, + "skinit": false, + "fxsr-opt": false, + "kvm_nopiodelay": true, + "phys-bits": 0, + "kvm": true, + "pmm-en": false, + "phe": false, + "3dnowext": false, + "lmce": true, + "ht": false, + "tsc-frequency": 0, + "kvm-pv-eoi": true, + "npt": false, + "apic-id": 4294967295, + "kvm_asyncpf": true, + "min-xlevel2": 0, + "pclmulqdq": true, + "svm": false, + "sse3": true, + "sse2": true, + "ss": true, + "topoext": false, + "rdrand": false, + "avx512vbmi": false, + "kvm-asyncpf": true, + "xsaves": false, + "model": 42 + } + } + }, + "id": "model-expansion" +} + +{ + "return": [ + { + "typename": "max-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "max" + }, + { + "typename": "host-x86_64-cpu", + "unavailable-features": [], + "migration-safe": false, + "static": false, + "name": "host" + }, + { + "typename": "base-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": true, + "name": "base" + }, + { + "typename": "qemu64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu64" + }, + { + "typename": "qemu32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "qemu32" + }, + { + "typename": "phenom-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "fxsr-opt", + "pdpe1gb", + "3dnowext", + "3dnow", + "abm", + "sse4a", + "npt" + ], + "migration-safe": true, + "static": false, + "name": "phenom" + }, + { + "typename": "pentium3-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium3" + }, + { + "typename": "pentium2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium2" + }, + { + "typename": "pentium-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "pentium" + }, + { + "typename": "n270-x86_64-cpu", + "unavailable-features": [ + "movbe" + ], + "migration-safe": true, + "static": false, + "name": "n270" + }, + { + "typename": "kvm64-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm64" + }, + { + "typename": "kvm32-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "kvm32" + }, + { + "typename": "cpu64-rhel6-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a" + ], + "migration-safe": true, + "static": false, + "name": "cpu64-rhel6" + }, + { + "typename": "coreduo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "coreduo" + }, + { + "typename": "core2duo-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "core2duo" + }, + { + "typename": "athlon-x86_64-cpu", + "unavailable-features": [ + "mmxext", + "3dnowext", + "3dnow" + ], + "migration-safe": true, + "static": false, + "name": "athlon" + }, + { + "typename": "Westmere-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Westmere" + }, + { + "typename": "Skylake-Client-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "mpx", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsavec", + "xgetbv1", + "mpx", + "mpx", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "Skylake-Client" + }, + { + "typename": "SandyBridge-x86_64-cpu", + "unavailable-features": [ + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "SandyBridge" + }, + { + "typename": "Penryn-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Penryn" + }, + { + "typename": "Opteron_G5-x86_64-cpu", + "unavailable-features": [ + "fma", + "f16c", + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4", + "tbm" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G5" + }, + { + "typename": "Opteron_G4-x86_64-cpu", + "unavailable-features": [ + "pdpe1gb", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "xop", + "fma4" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G4" + }, + { + "typename": "Opteron_G3-x86_64-cpu", + "unavailable-features": [ + "abm", + "sse4a", + "misalignsse" + ], + "migration-safe": true, + "static": false, + "name": "Opteron_G3" + }, + { + "typename": "Opteron_G2-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G2" + }, + { + "typename": "Opteron_G1-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Opteron_G1" + }, + { + "typename": "Nehalem-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Nehalem" + }, + { + "typename": "IvyBridge-x86_64-cpu", + "unavailable-features": [ + "f16c", + "rdrand", + "fsgsbase", + "smep", + "erms", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "IvyBridge" + }, + { + "typename": "Haswell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "abm", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "Haswell" + }, + { + "typename": "Haswell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "abm", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "Haswell-noTSX" + }, + { + "typename": "Conroe-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "Conroe" + }, + { + "typename": "Broadwell-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "hle", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rtm", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell" + }, + { + "typename": "Broadwell-noTSX-x86_64-cpu", + "unavailable-features": [ + "fma", + "movbe", + "f16c", + "rdrand", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "rdseed", + "adx", + "smap", + "abm", + "3dnowprefetch", + "xsaveopt" + ], + "migration-safe": true, + "static": false, + "name": "Broadwell-noTSX" + }, + { + "typename": "486-x86_64-cpu", + "unavailable-features": [], + "migration-safe": true, + "static": false, + "name": "486" + } + ], + "id": "definitions" +} diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.xml new file mode 100644 index 0000000000..c2c9730a41 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list