From nobody Sat May 4 09:59:19 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.zoho.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 1489768626353340.6559597911332; Fri, 17 Mar 2017 09:37:06 -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 123C17AEBB; Fri, 17 Mar 2017 16:37:05 +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 C537217DDC; Fri, 17 Mar 2017 16:37:03 +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 4C7971853D10; Fri, 17 Mar 2017 16:37:03 +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 v2HGb0hN007115 for ; Fri, 17 Mar 2017 12:37:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id A7D2019F0E; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77DF018997 for ; Fri, 17 Mar 2017 16:36:58 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 1DC131004AB; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 123C17AEBB 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 123C17AEBB From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:39 +0100 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 01/14] cpu_conf: Introduce virCPUDefFreeFeatures 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]); Fri, 17 Mar 2017 16:37:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/conf/cpu_conf.c | 21 +++++++++++++++------ src/conf/cpu_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index d7c8b8ff2..b78531e60 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -62,18 +62,27 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST, "disable", "forbid") =20 -void ATTRIBUTE_NONNULL(1) -virCPUDefFreeModel(virCPUDefPtr def) +void +virCPUDefFreeFeatures(virCPUDefPtr def) { size_t i; =20 - VIR_FREE(def->model); - VIR_FREE(def->vendor); - VIR_FREE(def->vendor_id); - for (i =3D 0; i < def->nfeatures; i++) VIR_FREE(def->features[i].name); VIR_FREE(def->features); + + def->nfeatures =3D def->nfeatures_max =3D 0; +} + + +void ATTRIBUTE_NONNULL(1) +virCPUDefFreeModel(virCPUDefPtr def) +{ + + VIR_FREE(def->model); + VIR_FREE(def->vendor); + VIR_FREE(def->vendor_id); + virCPUDefFreeFeatures(def); } =20 void diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 9118f037e..3e02deed4 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -125,6 +125,9 @@ struct _virCPUDef { =20 =20 void ATTRIBUTE_NONNULL(1) +virCPUDefFreeFeatures(virCPUDefPtr def); + +void ATTRIBUTE_NONNULL(1) virCPUDefFreeModel(virCPUDefPtr def); =20 void diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 165d8cb25..7ac5e533f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -71,6 +71,7 @@ virCPUDefCopyWithoutModel; virCPUDefFormat; virCPUDefFormatBuf; virCPUDefFree; +virCPUDefFreeFeatures; virCPUDefFreeModel; virCPUDefParseXML; virCPUDefStealModel; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768625689747.1090222704988; Fri, 17 Mar 2017 09:37:05 -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 314248050B; Fri, 17 Mar 2017 16:37:04 +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 9193A17134; Fri, 17 Mar 2017 16:37:03 +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 392871853D0F; Fri, 17 Mar 2017 16:37:03 +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 v2HGb01V007110 for ; Fri, 17 Mar 2017 12:37:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9124253; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37D775DD67 for ; Fri, 17 Mar 2017 16:36:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 2138510618B; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 314248050B 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 314248050B From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:40 +0100 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.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/14] cpu: Introduce virCPUExpandFeatures 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.27]); Fri, 17 Mar 2017 16:37:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Having to use cpuBaseline with VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag to expand CPU features is strange. Not to mention that cpuBaseline can only expand host CPU definitions (i.e., it completely ignores feature policies). The new virCPUExpandFeatures API is designed to work with both host and guest CPU definitions. Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu.h | 8 ++++++++ src/cpu/cpu_x86.c | 53 ++++++++++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_private.syms | 1 + 4 files changed, 112 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 1461190ba..5604db1d1 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1063,3 +1063,53 @@ virCPUConvertLegacy(virArch arch, VIR_DEBUG("model=3D%s", NULLSTR(cpu->model)); return 0; } + + +static int +virCPUFeatureCompare(const void *p1, + const void *p2) +{ + const virCPUFeatureDef *f1 =3D p1; + const virCPUFeatureDef *f2 =3D p2; + + return strcmp(f1->name, f2->name); +} + + +/** + * virCPUExpandFeatures: + * + * @arch: CPU architecture + * @cpu: CPU definition to be expanded + * + * Add all features implicitly enabled by the CPU model to the list of + * features. The @cpu is expected to be either a host or a guest represent= ation + * of a host CPU, i.e., only VIR_CPU_FEATURE_REQUIRE and + * VIR_CPU_FEATURE_DISABLE policies are supported. + * + * The updated list of features in the CPU definition is sorted. + * + * Return -1 on error, 0 on success. + */ +int +virCPUExpandFeatures(virArch arch, + virCPUDefPtr cpu) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("arch=3D%s, cpu=3D%p, model=3D%s, nfeatures=3D%zu", + virArchToString(arch), cpu, NULLSTR(cpu->model), cpu->nfeatu= res); + + if (!(driver =3D cpuGetSubDriver(arch))) + return -1; + + if (driver->expandFeatures && + driver->expandFeatures(cpu) < 0) + return -1; + + qsort(cpu->features, cpu->nfeatures, sizeof(*cpu->features), + virCPUFeatureCompare); + + VIR_DEBUG("nfeatures=3D%zu", cpu->nfeatures); + return 0; +} diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 7d6d3e921..5a8728bce 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -116,6 +116,9 @@ typedef int typedef int (*virCPUArchConvertLegacy)(virCPUDefPtr cpu); =20 +typedef int +(*virCPUArchExpandFeatures)(virCPUDefPtr cpu); + struct cpuArchDriver { const char *name; const virArch *arch; @@ -135,6 +138,7 @@ struct cpuArchDriver { virCPUArchGetModels getModels; virCPUArchTranslate translate; virCPUArchConvertLegacy convertLegacy; + virCPUArchExpandFeatures expandFeatures; }; =20 =20 @@ -245,6 +249,10 @@ virCPUConvertLegacy(virArch arch, virCPUDefPtr cpu) ATTRIBUTE_NONNULL(2); =20 +int +virCPUExpandFeatures(virArch arch, + virCPUDefPtr cpu); + /* virCPUDataFormat and virCPUDataParse are implemented for unit tests onl= y and * have no real-life usage */ diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9e208b094..442f0ce44 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2891,6 +2891,58 @@ virCPUx86Translate(virCPUDefPtr cpu, } =20 =20 +static int +virCPUx86ExpandFeatures(virCPUDefPtr cpu) +{ + virCPUx86MapPtr map; + virCPUDefPtr expanded =3D NULL; + virCPUx86ModelPtr model =3D NULL; + bool host =3D cpu->type =3D=3D VIR_CPU_TYPE_HOST; + size_t i; + int ret =3D -1; + + if (!(map =3D virCPUx86GetMap())) + goto cleanup; + + if (!(expanded =3D virCPUDefCopy(cpu))) + goto cleanup; + + virCPUDefFreeFeatures(expanded); + + if (!(model =3D x86ModelFind(map, cpu->model))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown CPU model %s"), cpu->model); + goto cleanup; + } + + if (!(model =3D x86ModelCopy(model)) || + x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE, + &model->data, map) < 0) + goto cleanup; + + for (i =3D 0; i < cpu->nfeatures; i++) { + virCPUFeatureDefPtr f =3D cpu->features + i; + + if (!host && + f->policy !=3D VIR_CPU_FEATURE_REQUIRE && + f->policy !=3D VIR_CPU_FEATURE_DISABLE) + continue; + + if (virCPUDefUpdateFeature(expanded, f->name, f->policy) < 0) + goto cleanup; + } + + virCPUDefFreeModel(cpu); + + ret =3D virCPUDefCopyModel(cpu, expanded, false); + + cleanup: + virCPUDefFree(expanded); + x86ModelFree(model); + return ret; +} + + int virCPUx86DataAddCPUID(virCPUDataPtr cpuData, const virCPUx86CPUID *cpuid) @@ -2965,4 +3017,5 @@ struct cpuArchDriver cpuDriverX86 =3D { .dataParse =3D virCPUx86DataParse, .getModels =3D virCPUx86GetModels, .translate =3D virCPUx86Translate, + .expandFeatures =3D virCPUx86ExpandFeatures, }; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7ac5e533f..21912434d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1013,6 +1013,7 @@ virCPUDataFormat; virCPUDataFree; virCPUDataNew; virCPUDataParse; +virCPUExpandFeatures; virCPUGetHost; virCPUGetModels; virCPUTranslate; --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768621200273.5588692849451; Fri, 17 Mar 2017 09:37:01 -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 A7FD2437F50; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B98560A99; Fri, 17 Mar 2017 16:37:00 +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 08F3A4BB75; Fri, 17 Mar 2017 16:37:00 +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 v2HGaxYb007094 for ; Fri, 17 Mar 2017 12:36:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 62DC11887F; Fri, 17 Mar 2017 16:36:59 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3331960A99 for ; Fri, 17 Mar 2017 16:36:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 24E321061C5; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A7FD2437F50 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A7FD2437F50 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:41 +0100 Message-Id: <6322ab1536f71e4252f5ee482033491e7f8ae0ea.1489768416.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 03/14] cpu: Drop unused flags from cpuArchDecode 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.29]); Fri, 17 Mar 2017 16:37:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 2 +- src/cpu/cpu.h | 3 +-- src/cpu/cpu_ppc64.c | 7 ++----- src/cpu/cpu_x86.c | 7 +++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 5604db1d1..33581e5fe 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -250,7 +250,7 @@ cpuDecode(virCPUDefPtr cpu, return -1; } =20 - return driver->decode(cpu, data, models, nmodels, preferred, 0); + return driver->decode(cpu, data, models, nmodels, preferred); } =20 =20 diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 5a8728bce..92b0f788e 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -54,8 +54,7 @@ typedef int const virCPUData *data, const char **models, unsigned int nmodels, - const char *preferred, - unsigned int flags); + const char *preferred); =20 typedef int (*cpuArchEncode) (virArch arch, diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 6e16ffd13..0ad8d17d4 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -665,15 +665,12 @@ ppc64DriverDecode(virCPUDefPtr cpu, const virCPUData *data, const char **models, unsigned int nmodels, - const char *preferred ATTRIBUTE_UNUSED, - unsigned int flags) + const char *preferred ATTRIBUTE_UNUSED) { int ret =3D -1; struct ppc64_map *map; const struct ppc64_model *model; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1); - if (!data || !(map =3D ppc64LoadMap())) return -1; =20 @@ -740,7 +737,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu, #endif data->pvr[0].mask =3D 0xfffffffful; =20 - ret =3D ppc64DriverDecode(cpu, cpuData, models, nmodels, NULL, 0); + ret =3D ppc64DriverDecode(cpu, cpuData, models, nmodels, NULL); =20 cleanup: virCPUppc64DataFree(cpuData); diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 442f0ce44..9c480398f 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1984,10 +1984,9 @@ x86DecodeCPUData(virCPUDefPtr cpu, const virCPUData *data, const char **models, unsigned int nmodels, - const char *preferred, - unsigned int flags) + const char *preferred) { - return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, fla= gs); + return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, 0); } =20 =20 @@ -2452,7 +2451,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, cpuidSet(CPUX86_EXTENDED, cpuData) < 0) goto cleanup; =20 - ret =3D x86DecodeCPUData(cpu, cpuData, models, nmodels, NULL, 0); + ret =3D x86DecodeCPUData(cpu, cpuData, models, nmodels, NULL); =20 cleanup: virCPUx86DataFree(cpuData); --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768632795673.7863036630052; Fri, 17 Mar 2017 09:37:12 -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 E32AAC03BD5F; Fri, 17 Mar 2017 16:37:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5DA495DC1D; Fri, 17 Mar 2017 16:37:09 +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 DDCA95EC62; Fri, 17 Mar 2017 16:37:08 +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 v2HGb01q007120 for ; Fri, 17 Mar 2017 12:37:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA3D65DD67; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 375A75DC1D for ; Fri, 17 Mar 2017 16:36:57 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 296441061C6; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E32AAC03BD5F 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E32AAC03BD5F From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:42 +0100 Message-Id: <1958ededb1725541bef67b2278abc1c0645e4d23.1489768416.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 04/14] cpu: Move feature expansion out of cpuBaseline 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.31]); Fri, 17 Mar 2017 16:37:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" cpuBaseline is responsible for computing a baseline CPU while feature expansion is done by virCPUExpandFeatures. The cpuBaselineXML wrapper (used by hypervisor drivers to implement virConnectBaselineCPU API) calls cpuBaseline followed by virCPUExpandFeatures if requested by VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag. The features in the three changed test files had to be sorted using "sort -k 3" because virCPUExpandFeatures returns a sorted list of features. Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 8 +++ src/cpu/cpu_x86.c | 33 ----------- tests/cputest.c | 8 +++ tests/cputestdata/x86_64-baseline-3-expanded.xml | 48 ++++++++-------- tests/cputestdata/x86_64-baseline-4-expanded.xml | 68 +++++++++++---------= --- tests/cputestdata/x86_64-baseline-5-expanded.xml | 70 ++++++++++++--------= ---- 6 files changed, 109 insertions(+), 126 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 33581e5fe..d53a7ef2c 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -498,6 +498,10 @@ cpuBaselineXML(const char **xmlCPUs, size_t i; =20 VIR_DEBUG("ncpus=3D%u, nmodels=3D%u", ncpus, nmodels); + + virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | + VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); + if (xmlCPUs) { for (i =3D 0; i < ncpus; i++) VIR_DEBUG("xmlCPUs[%zu]=3D%s", i, NULLSTR(xmlCPUs[i])); @@ -538,6 +542,10 @@ cpuBaselineXML(const char **xmlCPUs, if (!(cpu =3D cpuBaseline(cpus, ncpus, models, nmodels, flags))) goto error; =20 + if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && + virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) + goto error; + cpustr =3D virCPUDefFormat(cpu, NULL, false); =20 cleanup: diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9c480398f..388102f35 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -967,28 +967,6 @@ x86FeaturesLoad(virCPUx86MapPtr map, return 0; } =20 -static int -x86DataFromCPUFeatures(virCPUx86Data *data, - virCPUDefPtr cpu, - virCPUx86MapPtr map) -{ - size_t i; - - for (i =3D 0; i < cpu->nfeatures; i++) { - virCPUx86FeaturePtr feature; - if (!(feature =3D x86FeatureFind(map, cpu->features[i].name))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU feature %s"), cpu->features[i].n= ame); - return -1; - } - - if (x86DataAdd(data, &feature->data) < 0) - return -1; - } - - return 0; -} - =20 static virCPUx86ModelPtr x86ModelNew(void) @@ -1948,17 +1926,6 @@ x86Decode(virCPUDefPtr cpu, } } =20 - if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) { - if (x86DataCopy(©, &model->data) < 0 || - x86DataFromCPUFeatures(&features, cpuModel, map) < 0) - goto cleanup; - - x86DataSubtract(©, &features); - if (x86DataToCPUFeatures(cpuModel, VIR_CPU_FEATURE_REQUIRE, - ©, map) < 0) - goto cleanup; - } - if (vendor && VIR_STRDUP(cpu->vendor, vendor->name) < 0) goto cleanup; =20 diff --git a/tests/cputest.c b/tests/cputest.c index 5e205c501..6396e8670 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -325,6 +325,14 @@ cpuTestBaseline(const void *arg) goto cleanup; =20 baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, data->flags); + + if (baseline && + (data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && + virCPUExpandFeatures(data->arch, baseline) < 0) { + virCPUDefFree(baseline); + baseline =3D NULL; + } + if (data->result < 0) { virResetLastError(); if (!baseline) { diff --git a/tests/cputestdata/x86_64-baseline-3-expanded.xml b/tests/cpute= stdata/x86_64-baseline-3-expanded.xml index f0c2273d8..82857e3d4 100644 --- a/tests/cputestdata/x86_64-baseline-3-expanded.xml +++ b/tests/cputestdata/x86_64-baseline-3-expanded.xml @@ -1,35 +1,35 @@ Westmere - - - - - - - - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - + - - - + diff --git a/tests/cputestdata/x86_64-baseline-4-expanded.xml b/tests/cpute= stdata/x86_64-baseline-4-expanded.xml index 7e4578e1a..e54eca026 100644 --- a/tests/cputestdata/x86_64-baseline-4-expanded.xml +++ b/tests/cputestdata/x86_64-baseline-4-expanded.xml @@ -1,46 +1,46 @@ Westmere Intel - - - - - - - - - - - - - - - - - - + - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + - - - + + + + + diff --git a/tests/cputestdata/x86_64-baseline-5-expanded.xml b/tests/cpute= stdata/x86_64-baseline-5-expanded.xml index daef2a78f..2c1b40015 100644 --- a/tests/cputestdata/x86_64-baseline-5-expanded.xml +++ b/tests/cputestdata/x86_64-baseline-5-expanded.xml @@ -1,47 +1,47 @@ SandyBridge Intel - - - - - - - - - - - - - - + - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + - - - + + + + + --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768647224951.4049352858024; Fri, 17 Mar 2017 09:37:27 -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 53B187971D; Fri, 17 Mar 2017 16:37:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7D4317DF1; Fri, 17 Mar 2017 16:37:24 +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 4C8765EC6A; Fri, 17 Mar 2017 16:37:21 +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 v2HGb2WQ007166 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id D74AB1711E; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B64B1713F for ; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 2E4771061C7; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53B187971D 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 53B187971D From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:43 +0100 Message-Id: <8525e6d837f091b28b58985d58d42bd3fa1e0024.1489768416.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 05/14] cpu: Do not pass virConnectBaselineCPUFlags to cpuBaseline 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]); Fri, 17 Mar 2017 16:37:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The public API flags are handled by the cpuBaselineXML wrapper. The internal cpuBaseline API only needs to know whether it is supposed to drop non-migratable features. Signed-off-by: Jiri Denemark --- src/cpu/cpu.c | 14 +++++--------- src/cpu/cpu.h | 4 ++-- src/cpu/cpu_arm.c | 5 +---- src/cpu/cpu_ppc64.c | 5 +---- src/cpu/cpu_x86.c | 18 ++++++------------ tests/cputest.c | 3 ++- 6 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index d53a7ef2c..8e07e0ce4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -539,7 +539,8 @@ cpuBaselineXML(const char **xmlCPUs, doc =3D NULL; } =20 - if (!(cpu =3D cpuBaseline(cpus, ncpus, models, nmodels, flags))) + if (!(cpu =3D cpuBaseline(cpus, ncpus, models, nmodels, + !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE= )))) goto error; =20 if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && @@ -573,18 +574,13 @@ cpuBaselineXML(const char **xmlCPUs, * @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 - * @flags: bitwise-OR of virConnectBaselineCPUFlags + * @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 * be considered when computing the baseline CPU model, otherwise the base= line * CPU model will be one of the provided CPU @models. * - * If @flags includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt - * will explicitly list all CPU features that are part of the host CPU, - * without this flag features that are part of the CPU model will not be - * listed. - * * Returns baseline CPU definition or NULL on error. */ virCPUDefPtr @@ -592,7 +588,7 @@ cpuBaseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) { struct cpuArchDriver *driver; size_t i; @@ -647,7 +643,7 @@ cpuBaseline(virCPUDefPtr *cpus, return NULL; } =20 - return driver->baseline(cpus, ncpus, models, nmodels, flags); + return driver->baseline(cpus, ncpus, models, nmodels, migratable); } =20 =20 diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 92b0f788e..096eabe4c 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -79,7 +79,7 @@ typedef virCPUDefPtr unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags); + bool migratable); =20 typedef int (*virCPUArchUpdate)(virCPUDefPtr guest, @@ -198,7 +198,7 @@ cpuBaseline (virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) ATTRIBUTE_NONNULL(1); =20 int diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index a1aba2554..474777656 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -77,13 +77,10 @@ armBaseline(virCPUDefPtr *cpus, unsigned int ncpus ATTRIBUTE_UNUSED, const char **models ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED, - unsigned int flags) + bool migratable ATTRIBUTE_UNUSED) { virCPUDefPtr cpu =3D NULL; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (VIR_ALLOC(cpu) < 0 || VIR_STRDUP(cpu->model, cpus[0]->model) < 0) { virCPUDefFree(cpu); diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 0ad8d17d4..f64592b55 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -768,7 +768,7 @@ ppc64DriverBaseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED, - unsigned int flags) + bool migratable ATTRIBUTE_UNUSED) { struct ppc64_map *map; const struct ppc64_model *model; @@ -776,9 +776,6 @@ ppc64DriverBaseline(virCPUDefPtr *cpus, virCPUDefPtr cpu =3D NULL; size_t i; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (!(map =3D ppc64LoadMap())) goto error; =20 diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 388102f35..48648a7f4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1823,7 +1823,7 @@ x86Decode(virCPUDefPtr cpu, const char **models, unsigned int nmodels, const char *preferred, - unsigned int flags) + bool migratable) { int ret =3D -1; virCPUx86MapPtr map; @@ -1839,9 +1839,6 @@ x86Decode(virCPUDefPtr cpu, ssize_t i; int rc; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, -1); - if (!cpuData || x86DataCopy(&data, cpuData) < 0) return -1; =20 @@ -1913,7 +1910,7 @@ x86Decode(virCPUDefPtr cpu, /* Remove non-migratable features if requested * Note: this only works as long as no CPU model contains non-migratab= le * features directly */ - if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) { + if (migratable) { i =3D 0; while (i < cpuModel->nfeatures) { if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) { @@ -1953,7 +1950,7 @@ x86DecodeCPUData(virCPUDefPtr cpu, unsigned int nmodels, const char *preferred) { - return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, 0); + return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, fal= se); } =20 =20 @@ -2432,7 +2429,7 @@ x86Baseline(virCPUDefPtr *cpus, unsigned int ncpus, const char **models, unsigned int nmodels, - unsigned int flags) + bool migratable) { virCPUx86MapPtr map =3D NULL; virCPUx86ModelPtr base_model =3D NULL; @@ -2444,9 +2441,6 @@ x86Baseline(virCPUDefPtr *cpus, const char *modelName; bool matchingNames =3D true; =20 - virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | - VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); - if (!(map =3D virCPUx86GetMap())) goto error; =20 @@ -2529,7 +2523,7 @@ x86Baseline(virCPUDefPtr *cpus, virCPUx86DataAddCPUIDInt(&base_model->data, &vendor->cpuid) < 0) goto error; =20 - if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, flag= s) < 0) + if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, migr= atable) < 0) goto error; =20 if (STREQ_NULLABLE(cpu->model, modelName)) @@ -2838,7 +2832,7 @@ virCPUx86Translate(virCPUDefPtr cpu, if (!(translated =3D virCPUDefCopyWithoutModel(cpu))) goto cleanup; =20 - if (x86Decode(translated, &model->data, models, nmodels, NULL, 0) < 0) + if (x86Decode(translated, &model->data, models, nmodels, NULL, false) = < 0) goto cleanup; =20 for (i =3D 0; i < cpu->nfeatures; i++) { diff --git a/tests/cputest.c b/tests/cputest.c index 6396e8670..4a4d427e1 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -324,7 +324,8 @@ cpuTestBaseline(const void *arg) if (!(cpus =3D cpuTestLoadMultiXML(data->arch, data->name, &ncpus))) goto cleanup; =20 - baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, data->flags); + baseline =3D cpuBaseline(cpus, ncpus, NULL, 0, + !!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRA= TABLE)); =20 if (baseline && (data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768635972844.5568853110403; Fri, 17 Mar 2017 09:37: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 B95C0C05B1D2; Fri, 17 Mar 2017 16:37: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 1E3074DA25; Fri, 17 Mar 2017 16:37: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 C36AC1853D13; Fri, 17 Mar 2017 16:37:13 +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 v2HGb17m007125 for ; Fri, 17 Mar 2017 12:37:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 17CF9187A8; Fri, 17 Mar 2017 16:37:01 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC3D553CEA for ; Fri, 17 Mar 2017 16:37:00 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 332AE1061C8; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B95C0C05B1D2 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B95C0C05B1D2 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:44 +0100 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.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/14] cputest: Move instantiation of JSONDecoder in cpu-convert.py 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]); Fri, 17 Mar 2017 16:37:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's make the object local to the parseFeatureWords function which uses it. Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-convert.py b/tests/cputestdata/cpu-conve= rt.py index 898d42f10..e069408c8 100755 --- a/tests/cputestdata/cpu-convert.py +++ b/tests/cputestdata/cpu-convert.py @@ -174,6 +174,8 @@ cpuidMap =3D [ def parseFeatureWords(path): features =3D None =20 + dec =3D json.JSONDecoder() + with open(path, "r") as f: s =3D f.read() =20 @@ -220,8 +222,6 @@ def propAdd(props, feature, value): props[name] =3D value =20 =20 -dec =3D json.JSONDecoder() - for path in sys.argv[1:]: props, cpuid =3D parseFeatureWords(path) =20 --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768640247993.6936930448543; Fri, 17 Mar 2017 09:37:20 -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 76F25C05B1F2; Fri, 17 Mar 2017 16:37:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43C515C887; Fri, 17 Mar 2017 16:37: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 804045EC68; Fri, 17 Mar 2017 16:37:17 +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 v2HGb1Ge007130 for ; Fri, 17 Mar 2017 12:37:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E9A4187A8; Fri, 17 Mar 2017 16:37:01 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DD74187AC for ; Fri, 17 Mar 2017 16:37:01 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 369FD1061C9; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 76F25C05B1F2 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 76F25C05B1F2 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:45 +0100 Message-Id: <0badc1407d6a49c9dcd9e42f558761cd536111d8.1489768416.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 07/14] cputest: Rename cpu-convert.py script as cpu-cpuid.py 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]); Fri, 17 Mar 2017 16:37:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The new script is going to be more general and the original functionality can be requested by "cpu-cpuid.py convert". Signed-off-by: Jiri Denemark --- tests/cputestdata/{cpu-convert.py =3D> cpu-cpuid.py} | 17 ++++++++++++++++- tests/cputestdata/cpu-parse.sh | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) rename tests/cputestdata/{cpu-convert.py =3D> cpu-cpuid.py} (98%) diff --git a/tests/cputestdata/cpu-convert.py b/tests/cputestdata/cpu-cpuid= .py similarity index 98% rename from tests/cputestdata/cpu-convert.py rename to tests/cputestdata/cpu-cpuid.py index e069408c8..a4dc23378 100755 --- a/tests/cputestdata/cpu-convert.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -222,7 +222,7 @@ def propAdd(props, feature, value): props[name] =3D value =20 =20 -for path in sys.argv[1:]: +def convert(path): props, cpuid =3D parseFeatureWords(path) =20 for feature in cpuidMap: @@ -247,3 +247,18 @@ for path in sys.argv[1:]: "id": "model-expansion"}, f, indent =3D 2, separators =3D (',', ': ')) f.write("\n") + + +if len(sys.argv) < 3: + print "Usage: %s convert json_file..." % sys.argv[0] + sys.exit(1) + +action =3D sys.argv[1] +args =3D sys.argv[2:] + +if action =3D=3D "convert": + for path in args: + convert(path) +else: + print "Unknown action: " + action + sys.exit(1) diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 86bcb030d..d823c399b 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -53,7 +53,7 @@ json <<<"$data" >$fname.json if [[ -s $fname.json ]]; then echo $fname.json if ! grep -q model-expansion $fname.json; then - $(dirname $0)/cpu-convert.py $fname.json + $(dirname $0)/cpu-cpuid.py convert $fname.json fi else rm $fname.json --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768632927612.1122242379365; Fri, 17 Mar 2017 09:37:12 -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 C1C682EF16A; Fri, 17 Mar 2017 16:37:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 420B8BFA6E; Fri, 17 Mar 2017 16:37: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 CF1475EC64; Fri, 17 Mar 2017 16:37:09 +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 v2HGb1e0007131 for ; Fri, 17 Mar 2017 12:37:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F7CF53; Fri, 17 Mar 2017 16:37:01 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F8115DC1D for ; Fri, 17 Mar 2017 16:37:01 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 3C5AF1061CB; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C1C682EF16A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C1C682EF16A From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:46 +0100 Message-Id: <671c98be36383b6e556bd068cb8544cc1bbc117e.1489768416.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 08/14] cputest: Add cpuidIsSet helper to cpu-cpuid.py 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.29]); Fri, 17 Mar 2017 16:37:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-cpuid.py | 41 +++++++++++++++++++++-----------------= --- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index a4dc23378..9ea858d98 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -171,6 +171,24 @@ cpuidMap =3D [ ] =20 =20 +def cpuidIsSet(cpuid, feature): + in_eax =3D feature["in_eax"] + in_ecx =3D feature["in_ecx"] + eax =3D feature["eax"] + ebx =3D feature["ebx"] + ecx =3D feature["ecx"] + edx =3D feature["edx"] + + if in_eax not in cpuid or in_ecx not in cpuid[in_eax]: + return False + else: + leaf =3D cpuid[in_eax][in_ecx] + return ((eax > 0 and leaf["eax"] & eax > 0) or + (ebx > 0 and leaf["ebx"] & ebx > 0) or + (ecx > 0 and leaf["ecx"] & ecx > 0) or + (edx > 0 and leaf["edx"] & edx > 0)) + + def parseFeatureWords(path): features =3D None =20 @@ -217,30 +235,13 @@ def parseFeatureWords(path): return props, cpuid =20 =20 -def propAdd(props, feature, value): - for name in feature["names"]: - props[name] =3D value - - def convert(path): props, cpuid =3D parseFeatureWords(path) =20 for feature in cpuidMap: - in_eax =3D feature["in_eax"] - in_ecx =3D feature["in_ecx"] - eax =3D feature["eax"] - ebx =3D feature["ebx"] - ecx =3D feature["ecx"] - edx =3D feature["edx"] - - if in_eax not in cpuid or in_ecx not in cpuid[in_eax]: - propAdd(props, feature, False) - else: - leaf =3D cpuid[in_eax][in_ecx] - propAdd(props, feature, ((eax > 0 and leaf["eax"] & eax > 0) or - (ebx > 0 and leaf["ebx"] & ebx > 0) or - (ecx > 0 and leaf["ecx"] & ecx > 0) or - (edx > 0 and leaf["edx"] & edx > 0))) + value =3D cpuidIsSet(cpuid, feature) + for name in feature["names"]: + props[name] =3D value =20 with open(path, "w") as f: json.dump({"return": {"model": {"name": "base", "props": props}}, --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 14897686456021009.4726509290692; Fri, 17 Mar 2017 09:37:25 -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 45C888FCE1; Fri, 17 Mar 2017 16:37:25 +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 1C44E183DC; Fri, 17 Mar 2017 16:37:25 +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 B78B818521C8; Fri, 17 Mar 2017 16:37:24 +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 v2HGb43k007175 for ; Fri, 17 Mar 2017 12:37:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9B020BFA6F; Fri, 17 Mar 2017 16:37:04 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6918CBFA63 for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 3E4AF1061CA; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 45C888FCE1 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 45C888FCE1 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:47 +0100 Message-Id: <9a53dfc3778d745fcd9ec853fa010f8e6bfb1e5b.1489768416.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 09/14] cputest: Add cpuidLeaf helper to cpu-cpuid.py 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.26]); Fri, 17 Mar 2017 16:37:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-cpuid.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 9ea858d98..f4cf6d440 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -189,6 +189,18 @@ def cpuidIsSet(cpuid, feature): (edx > 0 and leaf["edx"] & edx > 0)) =20 =20 +def cpuidLeaf(cpuid, in_eax, in_ecx): + if in_eax not in cpuid: + cpuid[in_eax] =3D {} + leaf =3D cpuid[in_eax] + + if in_ecx not in leaf: + leaf[in_ecx] =3D {"eax": 0, "ebx": 0, "ecx": 0, "edx": 0} + leaf =3D leaf[in_ecx] + + return leaf + + def parseFeatureWords(path): features =3D None =20 @@ -222,14 +234,7 @@ def parseFeatureWords(path): if "cpuid-input-ecx" in feat: in_ecx =3D feat["cpuid-input-ecx"] =20 - if in_eax not in cpuid: - cpuid[in_eax] =3D {} - leaf =3D cpuid[in_eax] - - if in_ecx not in leaf: - leaf[in_ecx] =3D {"eax": 0, "ebx": 0, "ecx": 0, "edx": 0} - leaf =3D leaf[in_ecx] - + leaf =3D cpuidLeaf(cpuid, in_eax, in_ecx) leaf[feat["cpuid-register"].lower()] =3D feat["features"] =20 return props, cpuid --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768633687154.3535400742544; Fri, 17 Mar 2017 09:37:13 -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 27816624DF; Fri, 17 Mar 2017 16:37:11 +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 41577BFA66; Fri, 17 Mar 2017 16:37: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 CE3A21853D11; Fri, 17 Mar 2017 16:37:09 +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 v2HGb20J007155 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7FE6C5DD67; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2663A5DC1D for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 41EC21061CC; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 27816624DF 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 27816624DF From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:48 +0100 Message-Id: <786afd4c4073c2100298f827509a0dd9251233b0.1489768416.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/14] cputest: Add "diff" command to cpu-cpuid.py 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.39]); Fri, 17 Mar 2017 16:37:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The new command can be used to generate test data for virCPUUpdateLive. When "cpu-cpuid.py diff x86-cpuid-Something.json" is run, it reads raw CPUID data stored in x86-cpuid-Something.xml and CPUID data from QEMU stored in x86-cpuid-Something.json to produce two more CPUID files: x86-cpuid-Something-enabled.xml and x86-cpuid-Something-disabled.xml. - x86-cpuid-Something-enabled.xml will contain CPUID bits present in x86-cpuid-Something.json (i.e., enabled by QEMU for the "host" CPU) - x86-cpuid-Something-disabled.xml will contain all CPUID bits from x86-cpuid-Something.xml which are not present in x86-cpuid-Something.json (i.e., CPUID bits which the host CPU supports, but QEMU does not enable them for the "host" CPU) Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-cpuid.py | 89 ++++++++++++++++++++++++++++++++++++++= +++- tests/cputestdata/cpu-parse.sh | 1 + 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index f4cf6d440..4b9b04ace 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -2,6 +2,7 @@ =20 import sys import json +import xmltodict =20 # This is a list of x86 CPU features as of QEMU 2.8.50 and it won't need a= ny # updates since in the future because query-cpu-model-expansion will be us= ed @@ -171,6 +172,16 @@ cpuidMap =3D [ ] =20 =20 +def reverseCpuidMap(): + features =3D {} + + for feature in cpuidMap: + for name in feature["names"]: + features[name] =3D feature + + return features + + def cpuidIsSet(cpuid, feature): in_eax =3D feature["in_eax"] in_ecx =3D feature["in_ecx"] @@ -201,6 +212,12 @@ def cpuidLeaf(cpuid, in_eax, in_ecx): return leaf =20 =20 +def cpuidAdd(cpuid, feature): + leaf =3D cpuidLeaf(cpuid, feature["in_eax"], feature["in_ecx"]) + for reg in ["eax", "ebx", "ecx", "edx"]: + leaf[reg] |=3D feature[reg] + + def parseFeatureWords(path): features =3D None =20 @@ -240,6 +257,50 @@ def parseFeatureWords(path): return props, cpuid =20 =20 +def parseQemu(path, features): + cpuid =3D {} + with open(path, "r") as f: + data =3D json.load(f) + + for (prop, val) in data["return"]["model"]["props"].iteritems(): + if val and prop in features: + cpuidAdd(cpuid, features[prop]) + + return cpuid + + +def parseCpuid(path): + cpuid =3D {} + with open(path, "r") as f: + data =3D xmltodict.parse(f) + + for leaf in data["cpudata"]["cpuid"]: + leaf["in_eax"] =3D int(leaf["@eax_in"], 0) + leaf["in_ecx"] =3D int(leaf["@ecx_in"], 0) + for reg in ["eax", "ebx", "ecx", "edx"]: + leaf[reg] =3D int(leaf["@" + reg], 0) + + cpuidAdd(cpuid, leaf) + + return cpuid + + +def formatCpuid(cpuid, path, comment): + with open(path, "w") as f: + f.write("\n") + f.write("\n") + for in_eax in sorted(cpuid.keys()): + for in_ecx in sorted(cpuid[in_eax].keys()): + leaf =3D cpuid[in_eax][in_ecx] + line =3D " \n" + f.write(line %( + in_eax, in_ecx, + leaf["eax"], leaf["ebx"], leaf["ecx"], leaf["edx"]= )) + f.write("\n") + + def convert(path): props, cpuid =3D parseFeatureWords(path) =20 @@ -255,8 +316,30 @@ def convert(path): f.write("\n") =20 =20 +def diff(features, path): + base =3D path.replace(".json", "") + jsonFile =3D path + cpuidFile =3D base + ".xml" + enabledFile =3D base + "-enabled.xml" + disabledFile =3D base + "-disabled.xml" + + cpuid =3D parseCpuid(cpuidFile) + qemu =3D parseQemu(jsonFile, features) + + enabled =3D {} + disabled =3D {} + for feature in cpuidMap: + if cpuidIsSet(qemu, feature): + cpuidAdd(enabled, feature) + elif cpuidIsSet(cpuid, feature): + cpuidAdd(disabled, feature) + + formatCpuid(enabled, enabledFile, "Features enabled by QEMU") + formatCpuid(disabled, disabledFile, "Features disabled by QEMU") + + if len(sys.argv) < 3: - print "Usage: %s convert json_file..." % sys.argv[0] + print "Usage: %s convert|diff json_file..." % sys.argv[0] sys.exit(1) =20 action =3D sys.argv[1] @@ -265,6 +348,10 @@ args =3D sys.argv[2:] if action =3D=3D "convert": for path in args: convert(path) +elif action =3D=3D "diff": + features =3D reverseCpuidMap() + for path in args: + diff(features, path) else: print "Unknown action: " + action sys.exit(1) diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index d823c399b..cd1ab024b 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -55,6 +55,7 @@ if [[ -s $fname.json ]]; then if ! grep -q model-expansion $fname.json; then $(dirname $0)/cpu-cpuid.py convert $fname.json fi + $(dirname $0)/cpu-cpuid.py diff $fname.json else rm $fname.json fi --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768639165326.8479833208121; Fri, 17 Mar 2017 09:37:19 -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 B5E167FD68; Fri, 17 Mar 2017 16:37:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 854BE53CF5; Fri, 17 Mar 2017 16:37: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 C0A625EC6A; Fri, 17 Mar 2017 16:37:17 +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 v2HGb2SS007165 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id D66ED1887F; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A05360A99 for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 464321061CD; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B5E167FD68 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B5E167FD68 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:49 +0100 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.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/14] cputest: Generate data for virCPUUpdateLive 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]); Fri, 17 Mar 2017 16:37:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Generated with (cd tests/cputestdata; ./cpu-cpuid.py diff x86_64-cpuid-*.json) Signed-off-by: Jiri Denemark --- tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Core-i5-2500-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core-i5-2540M-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Core-i5-6600-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-3770-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-4510U-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-4600U-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core-i7-5600U-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Core2-E6850-disabled.xml | 4 ++++ tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml | 9 +++++++++ tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-enabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml | 8 ++++++++ tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-enabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-disabled.xml | 6 ++++++ tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml | 7 +++++++ tests/cputestdata/x86_64-cpuid-Xeon-W3520-disabled.xml | 5 +++++ tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml | 7 +++++++ 40 files changed, 279 insertions(+) create mode 100644 tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-2500-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-2540M-disabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-6600-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-disabled.= xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-3770-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-4510U-disabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-4600U-disabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-disabled.x= ml create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core2-E6850-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-W3520-disabled.xml create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml b/tests/= cputestdata/x86_64-cpuid-A10-5800K-disabled.xml new file mode 100644 index 000000000..3bacf2cf9 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml b/tests/c= putestdata/x86_64-cpuid-A10-5800K-enabled.xml new file mode 100644 index 000000000..a97702df9 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i5-2500-disabled.xml new file mode 100644 index 000000000..510cd97a5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml new file mode 100644 index 000000000..1581f800f --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i5-2540M-disabled.xml new file mode 100644 index 000000000..510cd97a5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml new file mode 100644 index 000000000..1581f800f --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml new file mode 100644 index 000000000..601554a81 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml new file mode 100644 index 000000000..8a714379c --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i5-6600-disabled.xml new file mode 100644 index 000000000..510cd97a5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml new file mode 100644 index 000000000..13032d0d2 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + 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 new file mode 100644 index 000000000..f25d2888e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-disabled.xml @@ -0,0 +1,6 @@ + + + + + + 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 new file mode 100644 index 000000000..df99a2180 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-disabled.xml b/t= ests/cputestdata/x86_64-cpuid-Core-i7-3740QM-disabled.xml new file mode 100644 index 000000000..601554a81 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml new file mode 100644 index 000000000..e596bf119 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-3770-disabled.xml new file mode 100644 index 000000000..f25d2888e --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml new file mode 100644 index 000000000..666c37536 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i7-4510U-disabled.xml new file mode 100644 index 000000000..dbc978e73 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml new file mode 100644 index 000000000..86896de80 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i7-4600U-disabled.xml new file mode 100644 index 000000000..4a0477f78 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml new file mode 100644 index 000000000..86896de80 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i7-5600U-disabled.xml new file mode 100644 index 000000000..4a0477f78 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml new file mode 100644 index 000000000..edc433c9a --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-disabled.xml b/test= s/cputestdata/x86_64-cpuid-Core2-E6850-disabled.xml new file mode 100644 index 000000000..18e4baf3a --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-disabled.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml b/tests= /cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml new file mode 100644 index 000000000..af4f6f7ab --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml new file mode 100644 index 000000000..3f6fe5405 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml new file mode 100644 index 000000000..7541dff65 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml new file mode 100644 index 000000000..4dcd74103 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml new file mode 100644 index 000000000..c4cfbcef2 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml b/tests= /cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml new file mode 100644 index 000000000..3910eb6e5 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml b/tests/= cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml new file mode 100644 index 000000000..a8cd01ff4 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + 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 new file mode 100644 index 000000000..1a177705a --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-disabled.xml @@ -0,0 +1,6 @@ + + + + + + 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 new file mode 100644 index 000000000..258404233 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-enabled.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml new file mode 100644 index 000000000..ea2906506 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E5-2630-enabled.xml new file mode 100644 index 000000000..1c2367a3d --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-enabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml new file mode 100644 index 000000000..a66b5bdd6 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E5-2650-enabled.xml new file mode 100644 index 000000000..4c194af10 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E7-4820-disabled.xml new file mode 100644 index 000000000..e7e0ee6f2 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-disabled.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml new file mode 100644 index 000000000..cddc4a675 --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-disabled.xml b/tests= /cputestdata/x86_64-cpuid-Xeon-W3520-disabled.xml new file mode 100644 index 000000000..49737fbdb --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-disabled.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml b/tests/= cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml new file mode 100644 index 000000000..febef1edd --- /dev/null +++ b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml @@ -0,0 +1,7 @@ + + + + + + + --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768635498326.2400603216223; Fri, 17 Mar 2017 09:37:15 -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 1BB9D7FD50; Fri, 17 Mar 2017 16:37:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F338183DE; Fri, 17 Mar 2017 16:37: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 E07565EC6A; Fri, 17 Mar 2017 16:37:13 +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 v2HGb2Zf007145 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E0A119F15; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DF355C6C9 for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 4AD9F1061CE; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1BB9D7FD50 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1BB9D7FD50 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:50 +0100 Message-Id: <768e528c4d71f04cdfc70bbc9c166de186e5b970.1489768416.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 12/14] cputest: Disable TSX on broken 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 17 Mar 2017 16:37:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit v3.1.0-26-gd60012b4e started filtering hle and rtm features from broken Intel Haswell CPUs. QEMU implemented similar functionality and thus it doesn't report rtm and hle features as enabled for Core i5-4670T CPU anymore. Signed-off-by: Jiri Denemark --- tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml | 1 + tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml | 2 +- tests/cputestdata/x86_64-cpuid-Core-i5-4670T.json | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml b/te= sts/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml index 601554a81..0c6b68a57 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-disabled.xml @@ -2,5 +2,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml index 8a714379c..31893c0b8 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml @@ -1,7 +1,7 @@ - + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T.json b/tests/cput= estdata/x86_64-cpuid-Core-i5-4670T.json index bfcfcfd46..58b1d0369 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T.json +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T.json @@ -5,7 +5,7 @@ "props": { "pfthreshold": false, "pku": false, - "rtm": true, + "rtm": false, "tsc_adjust": true, "tsc-deadline": true, "xstore-en": false, @@ -69,7 +69,7 @@ "avx512-4vnniw": false, "xsave": true, "erms": true, - "hle": true, + "hle": false, "nodeid_msr": false, "est": false, "svm_lock": false, --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768642059553.8931410258831; Fri, 17 Mar 2017 09:37:22 -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 92C7C8F226; Fri, 17 Mar 2017 16:37:21 +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 59D02BFA76; Fri, 17 Mar 2017 16:37:21 +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 0913918521C6; Fri, 17 Mar 2017 16:37:21 +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 v2HGb2ch007150 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C28217DDC; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C1EE5DD67 for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 4EFC91061CF; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92C7C8F226 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 92C7C8F226 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:51 +0100 Message-Id: <1a1ccf0741aeacbcfd61f4cbf75d06818ba5777a.1489768416.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 13/14] cputest: Disable "cmt" feature unknown to QEMU 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]); Fri, 17 Mar 2017 16:37:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All CPU features which QEMU does not know about but libvirt knows them (currently "cmt" is the only one) are implicitly disabled by QEMU and should be present in x86_64-cpuid-*-disabled.xml. Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-cpuid.py | 1 + tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml | 1 + tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 4b9b04ace..85c7c94b1 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -79,6 +79,7 @@ cpuidMap =3D [ {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00000200, "ecx"= : 0, "edx": 0, "names": ["erms"]}, {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00000400, "ecx"= : 0, "edx": 0, "names": ["invpcid"]}, {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00000800, "ecx"= : 0, "edx": 0, "names": ["rtm"]}, + {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00001000, "ecx"= : 0, "edx": 0, "names": []}, # cmt is unknown to QEMU {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00004000, "ecx"= : 0, "edx": 0, "names": ["mpx"]}, {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00010000, "ecx"= : 0, "edx": 0, "names": ["avx512f"]}, {"in_eax": 0x00000007, "in_ecx": 0, "eax": 0, "ebx": 0x00020000, "ecx"= : 0, "edx": 0, "names": ["avx512dq"]}, diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml index ea2906506..e6f4ce761 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-disabled.xml @@ -2,5 +2,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml index a66b5bdd6..9e25e6a94 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-disabled.xml @@ -2,7 +2,7 @@ - + --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:59:19 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.zoho.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 1489768635622172.26744574717702; Fri, 17 Mar 2017 09:37:15 -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 1A1ED624C6; Fri, 17 Mar 2017 16:37: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 548B951DF2; Fri, 17 Mar 2017 16:37: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 02EB41853D14; Fri, 17 Mar 2017 16:37:14 +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 v2HGb2OS007160 for ; Fri, 17 Mar 2017 12:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9AF71187A8; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: from mamuti.net (ovpn-204-109.brq.redhat.com [10.40.204.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FABD5C6C3 for ; Fri, 17 Mar 2017 16:37:02 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 5344F1061D0; Fri, 17 Mar 2017 17:36:55 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1A1ED624C6 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1A1ED624C6 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 17 Mar 2017 17:36:52 +0100 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.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 14/14] cputest: Add tests for virCPUUpdateLive 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 17 Mar 2017 16:37:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test takes x86-cpuid-Something-guest.xml CPU (the CPU libvirt would use for host-model on a CPU described by x86_64-cpuid-Something.xml without talking to QEMU about what it supports on the host) and updates it according to CPUID data from QEMU: x86_64-cpuid-Something-enabled.xml (reported as "feature-words" property of the CPU device) and x86_64-cpuid-Something-disabled.xml (reported as "filtered-features" property of the CPU device). The result is compared to x86_64-cpuid-Something-json.xml (the CPU libvirt would use as host-model based on the reply from query-cpu-model-expansion). The comparison is a bit tricky because the *-json.xml CPU contains fewer disabled features. Only the features which are included in the base CPU model, but listed as disabled in *.json will be disabled in *-json.xml. The CPU computed by virCPUUpdateLive from the test data will list all features present in the host's CPUID data and not enabled in *.json as disabled. The cpuTestUpdateLiveCompare function checks that the computed and expected sets of enabled features match. Signed-off-by: Jiri Denemark --- tests/cputest.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 149 insertions(+) diff --git a/tests/cputest.c b/tests/cputest.c index 4a4d427e1..2c64c2cd0 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -523,6 +523,151 @@ cpuTestGuestCPUID(const void *arg) } =20 =20 +static int +cpuTestUpdateLiveCompare(virArch arch, + virCPUDefPtr actual, + virCPUDefPtr expected) +{ + size_t i, j; + int ret =3D 0; + + if (virCPUExpandFeatures(arch, actual) < 0 || + virCPUExpandFeatures(arch, expected) < 0) + return -1; + + if (STRNEQ(actual->model, expected->model)) { + VIR_TEST_VERBOSE("Actual CPU model '%s', expected '%s'\n", + actual->model, expected->model); + return -1; + } + + i =3D j =3D 0; + while (i < actual->nfeatures || j < expected->nfeatures) { + virCPUFeatureDefPtr featAct =3D NULL; + virCPUFeatureDefPtr featExp =3D NULL; + int cmp; + + if (i < actual->nfeatures) + featAct =3D actual->features + i; + + if (j < expected->nfeatures) + featExp =3D expected->features + j; + + /* + * Act < Exp =3D> cmp < 0 (missing entry in Exp) + * Act =3D Exp =3D> cmp =3D 0 + * Act > Exp =3D> cmp > 0 (missing entry in Act) + * + * NULL > name for any name !=3D NULL + */ + if (featAct && featExp) + cmp =3D strcmp(featAct->name, featExp->name); + else + cmp =3D featExp ? 1 : -1; + + if (cmp <=3D 0) + i++; + if (cmp >=3D 0) + j++; + + /* Possible combinations of cmp, featAct->policy, and featExp->pol= icy: + * cmp Act Exp result + * --------------------------------- + * 0 dis dis ok + * 0 dis req missing + * 0 req dis extra + * 0 req req ok + * --------------------------------- + * - dis X ok # ignoring extra disabled feat= ures + * - req X extra + * --------------------------------- + * + X dis extra + * + X req missing + */ + if ((cmp =3D=3D 0 && + featAct->policy =3D=3D VIR_CPU_FEATURE_DISABLE && + featExp->policy =3D=3D VIR_CPU_FEATURE_REQUIRE) || + (cmp > 0 && + featExp->policy =3D=3D VIR_CPU_FEATURE_REQUIRE)) { + VIR_TEST_VERBOSE("Actual CPU lacks feature '%s'\n", + featExp->name); + ret =3D -1; + continue; + } + + if ((cmp =3D=3D 0 && + featAct->policy =3D=3D VIR_CPU_FEATURE_REQUIRE && + featExp->policy =3D=3D VIR_CPU_FEATURE_DISABLE) || + (cmp < 0 && + featAct->policy =3D=3D VIR_CPU_FEATURE_REQUIRE) || + (cmp > 0 && + featExp->policy =3D=3D VIR_CPU_FEATURE_DISABLE)) { + VIR_TEST_VERBOSE("Actual CPU has extra feature '%s'\n", + featAct->name); + ret =3D -1; + } + } + + return ret; +} + + +static int +cpuTestUpdateLive(const void *arg) +{ + const struct data *data =3D arg; + char *cpuFile =3D NULL; + virCPUDefPtr cpu =3D NULL; + char *enabledFile =3D NULL; + char *enabled =3D NULL; + virCPUDataPtr enabledData =3D NULL; + char *disabledFile =3D NULL; + char *disabled =3D NULL; + virCPUDataPtr disabledData =3D NULL; + char *expectedFile =3D NULL; + virCPUDefPtr expected =3D NULL; + int ret =3D -1; + + if (virAsprintf(&cpuFile, "cpuid-%s-guest", data->host) < 0 || + !(cpu =3D cpuTestLoadXML(data->arch, cpuFile))) + goto cleanup; + + if (virAsprintf(&enabledFile, "%s/cputestdata/%s-cpuid-%s-enabled.xml", + abs_srcdir, virArchToString(data->arch), data->host) <= 0 || + virTestLoadFile(enabledFile, &enabled) < 0 || + !(enabledData =3D virCPUDataParse(enabled))) + goto cleanup; + + if (virAsprintf(&disabledFile, "%s/cputestdata/%s-cpuid-%s-disabled.xm= l", + abs_srcdir, virArchToString(data->arch), data->host) <= 0 || + virTestLoadFile(disabledFile, &disabled) < 0 || + !(disabledData =3D virCPUDataParse(disabled))) + goto cleanup; + + 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; + + ret =3D cpuTestUpdateLiveCompare(data->arch, cpu, expected); + + cleanup: + VIR_FREE(cpuFile); + virCPUDefFree(cpu); + VIR_FREE(enabledFile); + VIR_FREE(enabled); + virCPUDataFree(enabledData); + VIR_FREE(disabledFile); + VIR_FREE(disabled); + virCPUDataFree(disabledData); + VIR_FREE(expectedFile); + virCPUDefFree(expected); + return ret; +} + + #if WITH_QEMU && WITH_YAJL static int cpuTestJSONCPUID(const void *arg) @@ -697,6 +842,10 @@ mymain(void) DO_TEST(arch, cpuTestGuestCPUID, host, host, \ NULL, NULL, 0, 0, 0); \ DO_TEST_CPUID_JSON(arch, host, json); \ + if (json) { \ + DO_TEST(arch, cpuTestUpdateLive, host, host, \ + NULL, NULL, 0, 0, 0); \ + } \ } while (0) =20 /* host to host comparison */ --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list