From nobody Mon Apr 29 12:56:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515440937934654.6917839802153; Mon, 8 Jan 2018 11:48:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 017B17F7B0; Mon, 8 Jan 2018 19:48:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4D43620B0; Mon, 8 Jan 2018 19:48:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8514418033E0; Mon, 8 Jan 2018 19:48:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w08JlJf4011125 for ; Mon, 8 Jan 2018 14:47:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id E60E2620A6; Mon, 8 Jan 2018 19:47:19 +0000 (UTC) Received: from mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C87D6064E for ; Mon, 8 Jan 2018 19:47:16 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 77F9C1003C3; Mon, 8 Jan 2018 20:47:15 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 8 Jan 2018 20:47:11 +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 1/3] cputest: Fix cpu-cpuid.py diff command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 08 Jan 2018 19:48:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The cpuidMap in cpu-cpuid.py was created for converting old data files (with QEMU's feature-words bits) to the new model-expansion based data. When I added tests for CPU live update based on disabled/enabled feature lists I shamelessly used the existing cpuidMap for generating the *-{enabled,disabled}.xml data files. Thus any new CPUID bits which are not present in the original cpuidMap would be ignored. The correct thing to do is to use cpu_map.xml. All data files were fixed by running the following command: ./cpu-cpuid.py diff *.json Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- tests/cputestdata/cpu-cpuid.py | 52 +++++++++++++++---= ---- .../x86_64-cpuid-A10-5800K-disabled.xml | 1 - .../cputestdata/x86_64-cpuid-A10-5800K-enabled.xml | 2 - .../x86_64-cpuid-Core-i5-2500-enabled.xml | 1 - .../x86_64-cpuid-Core-i5-2540M-enabled.xml | 1 - .../x86_64-cpuid-Core-i5-4670T-enabled.xml | 1 - .../x86_64-cpuid-Core-i5-6600-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-2600-enabled.xml | 1 - ...x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml | 1 - .../x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-3740QM-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-3770-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-4510U-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-4600U-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 1 + .../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-5600U-enabled.xml | 1 - .../x86_64-cpuid-Core-i7-7700-enabled.xml | 1 - .../x86_64-cpuid-Core2-E6850-enabled.xml | 1 - .../x86_64-cpuid-EPYC-7601-32-Core-disabled.xml | 1 - .../x86_64-cpuid-EPYC-7601-32-Core-enabled.xml | 2 - .../x86_64-cpuid-Opteron-2350-disabled.xml | 1 - .../x86_64-cpuid-Opteron-2350-enabled.xml | 2 - .../x86_64-cpuid-Opteron-6234-disabled.xml | 1 - .../x86_64-cpuid-Opteron-6234-enabled.xml | 2 - .../x86_64-cpuid-Phenom-B95-disabled.xml | 1 - .../x86_64-cpuid-Phenom-B95-enabled.xml | 2 - ..._64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml | 1 - ...6_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml | 2 - .../x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml | 1 + .../x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E7-4820-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E7-4830-enabled.xml | 1 - .../x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml | 1 - .../x86_64-cpuid-Xeon-Gold-6148-disabled.xml | 1 + .../x86_64-cpuid-Xeon-Gold-6148-enabled.xml | 1 - .../x86_64-cpuid-Xeon-W3520-enabled.xml | 1 - 40 files changed, 40 insertions(+), 57 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 4fe8e8b952..b74c3ce932 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -1,5 +1,6 @@ #!/usr/bin/env python2 =20 +import os import sys import json import xmltodict @@ -173,16 +174,6 @@ 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"] @@ -292,6 +283,37 @@ def parseCpuid(path): return cpuid =20 =20 +def parseFeature(data): + cpuid =3D {} + for reg in ["in_eax", "in_ecx", "eax", "ebx", "ecx", "edx"]: + if reg.startswith("in_"): + attr =3D "@%s_in" % reg[3:] + else: + attr =3D "@%s" % reg + + if attr in data: + cpuid[reg] =3D int(data[attr], 0) + else: + cpuid[reg] =3D 0 + + return cpuid + + +def parseMap(): + path =3D os.path.dirname(sys.argv[0]) + path =3D os.path.join(path, "..", "..", "src", "cpu", "cpu_map.xml") + with open(path, "r") as f: + data =3D xmltodict.parse(f) + + cpuMap =3D {} + for arch in data["cpus"]["arch"]: + if arch["@name"] =3D=3D "x86": + for feature in arch["feature"]: + cpuMap[feature["@name"]] =3D parseFeature(feature["cpuid"]) + + return cpuMap + + def formatCpuid(cpuid, path, comment): print path with open(path, "w") as f: @@ -330,7 +352,7 @@ def convert(path): f.write("\n") =20 =20 -def diff(features, path): +def diff(cpuMap, path): base =3D path.replace(".json", "") jsonFile =3D path cpuidFile =3D base + ".xml" @@ -338,11 +360,11 @@ def diff(features, path): disabledFile =3D base + "-disabled.xml" =20 cpuid =3D parseCpuid(cpuidFile) - qemu =3D parseQemu(jsonFile, features) + qemu =3D parseQemu(jsonFile, cpuMap) =20 enabled =3D {} disabled =3D {} - for feature in cpuidMap: + for feature in cpuMap.values(): if cpuidIsSet(qemu, feature): cpuidAdd(enabled, feature) elif cpuidIsSet(cpuid, feature): @@ -363,9 +385,9 @@ if action =3D=3D "convert": for path in args: convert(path) elif action =3D=3D "diff": - features =3D reverseCpuidMap() + cpuMap =3D parseMap() for path in args: - diff(features, path) + diff(cpuMap, path) else: print "Unknown action: " + action sys.exit(1) diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml b/tests/= cputestdata/x86_64-cpuid-A10-5800K-disabled.xml index 3bacf2cf95..6ed5b3573b 100644 --- a/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-disabled.xml @@ -3,5 +3,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml b/tests/c= putestdata/x86_64-cpuid-A10-5800K-enabled.xml index a97702df90..5cae0b7130 100644 --- a/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-A10-5800K-enabled.xml @@ -2,7 +2,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 index 1581f800f1..b1d0fd59f5 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2500-enabled.xml @@ -4,6 +4,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 index 1581f800f1..b1d0fd59f5 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-2540M-enabled.xml @@ -4,6 +4,5 @@ - 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 31893c0b87..84e061e878 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-4670T-enabled.xml @@ -3,6 +3,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 index 13032d0d2a..6c87cdfb5d 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i5-6600-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml index 1581f800f1..b1d0fd59f5 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.= xml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml index 281cc1512a..510cd97a5b 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-disabled.xml @@ -1,6 +1,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.x= ml b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml index 3c2d7e33d6..3c3eb65c40 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-2600-xsaveopt-enabled.xml @@ -3,6 +3,5 @@ - 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 index e596bf119f..84104c16af 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3740QM-enabled.xml @@ -3,6 +3,5 @@ - 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 index 666c375368..6889f19b31 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-3770-enabled.xml @@ -3,6 +3,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 index 86896de809..ae85ae9f9e 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4510U-enabled.xml @@ -4,6 +4,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 index 86896de809..ae85ae9f9e 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-4600U-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml= b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml index 4a0477f788..601554a815 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml @@ -1,5 +1,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml = b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml index 5cffacef59..feba4cdc87 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml @@ -3,6 +3,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 index edc433c9ae..b5d116672f 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Core-i7-7700-enabled.xml index 9096a633a7..48e17883cf 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-7700-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-7700-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml b/tests= /cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml index af4f6f7ab1..662fe303f3 100644 --- a/tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-enabled.xml @@ -2,6 +2,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml = b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml index d3070d4147..747d725acf 100644 --- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-disabled.xml @@ -4,5 +4,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml b= /tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml index 6e47d40066..70b75f7115 100644 --- a/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-EPYC-7601-32-Core-enabled.xml @@ -4,7 +4,5 @@ - - diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml index 3f6fe54055..8ec1b12582 100644 --- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-disabled.xml @@ -3,5 +3,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml index 7541dff65a..913980f15f 100644 --- a/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Opteron-2350-enabled.xml @@ -1,7 +1,5 @@ - - diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml b/tes= ts/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml index 4dcd74103b..88124d1745 100644 --- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-disabled.xml @@ -3,5 +3,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml index c4cfbcef2d..38d716449d 100644 --- a/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Opteron-6234-enabled.xml @@ -3,7 +3,5 @@ - - diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml b/tests= /cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml index 3910eb6e57..d8d4e8a5f9 100644 --- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-disabled.xml @@ -3,5 +3,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml b/tests/= cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml index a8cd01ff46..d15e625087 100644 --- a/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Phenom-B95-enabled.xml @@ -1,7 +1,5 @@ - - diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabl= ed.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.x= ml index 9ee1e78244..b085050618 100644 --- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-disabled.xml @@ -5,5 +5,4 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enable= d.xml b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml index 9c85bb63a2..a212679fba 100644 --- a/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Ryzen-7-1800X-Eight-Core-enabled.xml @@ -4,7 +4,5 @@ - - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml index f31f7317b6..3bd870970c 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1245-v5-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml index 1c2367a3d0..b54551b3b9 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2630-v3-enabled.xml @@ -3,6 +3,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml index 4c194af10f..0c236e1e09 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v3-enabled.xml @@ -2,6 +2,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml b/= tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml index aacc7a2b14..d904808cec 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-disabled.xml @@ -2,5 +2,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml index b11dd9b759..f2d4f2826d 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2650-v4-enabled.xml @@ -4,6 +4,5 @@ - 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 index cddc4a675e..3d04493f4d 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4820-enabled.xml @@ -2,6 +2,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml b/test= s/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml index 1b80f414e5..7941de5065 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-4830-enabled.xml @@ -3,6 +3,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml index 026a049f77..ca1560af6e 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-E7-8890-v3-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-disabled.xml b/t= ests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-disabled.xml index f11079772b..b5c70a9dc4 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-disabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-disabled.xml @@ -3,5 +3,6 @@ + diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-enabled.xml b/te= sts/cputestdata/x86_64-cpuid-Xeon-Gold-6148-enabled.xml index 431e4ed563..1db200aee9 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-6148-enabled.xml @@ -4,6 +4,5 @@ - diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml b/tests/= cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml index febef1eddc..8378945c45 100644 --- a/tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml +++ b/tests/cputestdata/x86_64-cpuid-Xeon-W3520-enabled.xml @@ -2,6 +2,5 @@ - --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 12:56:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515440929388344.68237025362794; Mon, 8 Jan 2018 11:48:49 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9F244903F; Mon, 8 Jan 2018 19:48:47 +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 751A9620AC; Mon, 8 Jan 2018 19:48:47 +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 2397418033DF; Mon, 8 Jan 2018 19:48:47 +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 w08JlJuf011107 for ; Mon, 8 Jan 2018 14:47:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7B0796A03F; Mon, 8 Jan 2018 19:47:19 +0000 (UTC) Received: from mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B54B6A02E for ; Mon, 8 Jan 2018 19:47:16 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 7919B1093DA; Mon, 8 Jan 2018 20:47:15 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 8 Jan 2018 20:47:12 +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 2/3] cpu_x86: Add debug messages to x86DecodeUseCandidate X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 08 Jan 2018 19:48:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When translating CPUID data into CPU model + features, the code sometimes uses an unexpected CPU model. There may be several reasons for this, starting with wrong expectations and ending with an actual bug in our code. These debug messages will help determining the reason. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/cpu/cpu_x86.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 26314a5b3a..2a2f7cbf39 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1774,12 +1774,15 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, } } =20 - if (preferred && - STREQ(cpuCandidate->model, preferred)) + if (preferred && STREQ(cpuCandidate->model, preferred)) { + VIR_DEBUG("%s is the preferred model", cpuCandidate->model); return 2; + } =20 - if (!cpuCurrent) + if (!cpuCurrent) { + VIR_DEBUG("%s is better than nothing", cpuCandidate->model); return 1; + } =20 /* Ideally we want to select a model with family/model equal to * family/model of the real CPU. Once we found such model, we only @@ -1787,20 +1790,30 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, */ if (signature && current->signature =3D=3D signature && - candidate->signature !=3D signature) + candidate->signature !=3D signature) { + VIR_DEBUG("%s differs in signature from matching %s", + cpuCandidate->model, cpuCurrent->model); return 0; + } =20 - if (cpuCurrent->nfeatures > cpuCandidate->nfeatures) + if (cpuCurrent->nfeatures > cpuCandidate->nfeatures) { + VIR_DEBUG("%s results in shorter feature list than %s", + cpuCandidate->model, cpuCurrent->model); return 1; + } =20 /* Prefer a candidate with matching signature even though it would * result in longer list of features. */ if (signature && candidate->signature =3D=3D signature && - current->signature !=3D signature) + current->signature !=3D signature) { + VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; + } =20 + VIR_DEBUG("%s does not result in shorter feature list than %s", + cpuCandidate->model, cpuCurrent->model); return 0; } =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 12:56:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1515440940689755.7930392900785; Mon, 8 Jan 2018 11:49:00 -0800 (PST) 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 4BCBD4D2CE; Mon, 8 Jan 2018 19:48:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 214CE66A16; Mon, 8 Jan 2018 19:48:59 +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 DCF9D3FAE2; Mon, 8 Jan 2018 19:48:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w08JlKIo011130 for ; Mon, 8 Jan 2018 14:47:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0021A60C93; Mon, 8 Jan 2018 19:47:20 +0000 (UTC) Received: from mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6A9060C91 for ; Mon, 8 Jan 2018 19:47:16 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 7B0B01093DC; Mon, 8 Jan 2018 20:47:15 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 8 Jan 2018 20:47:13 +0100 Message-Id: <498fc0194bc82f15a0a13757f0f9c17162c9b41f.1515440554.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] cpu_x86: Copy CPU signature from ancestor 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.30]); Mon, 08 Jan 2018 19:48:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When specifying a new CPU model in cpu_map.xml as an extension to an existing model, we forgot to copy the signature (family + model) from the original CPU model. We don't use this way of specifying CPU models, but it's still supported and it becomes useful when someone wants to quickly hack up a CPU model for testing or when creating additional variants of existing models to help with fixing some spectral issues. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/cpu/cpu_x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 2a2f7cbf39..b2398c5ad2 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1227,6 +1227,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, VIR_FREE(name); =20 model->vendor =3D ancestor->vendor; + model->signature =3D ancestor->signature; if (x86DataCopy(&model->data, &ancestor->data) < 0) goto error; } --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list