From nobody Fri Apr 26 21:39:16 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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15433027787111022.0197275882529; Mon, 26 Nov 2018 23:12:58 -0800 (PST) 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 6CDEC13AAD; Tue, 27 Nov 2018 07:12:56 +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 BB55C608C3; Tue, 27 Nov 2018 07:12: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 21E953F7CB; Tue, 27 Nov 2018 07:12:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAR7Cpsh026591 for ; Tue, 27 Nov 2018 02:12:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8EA0916E3B; Tue, 27 Nov 2018 07:12:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8565619495 for ; Tue, 27 Nov 2018 07:12:48 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00C313084298 for ; Tue, 27 Nov 2018 07:12:48 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 23:12:47 -0800 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga004.fm.intel.com with ESMTP; 26 Nov 2018 23:12:46 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,285,1539673200"; d="scan'208";a="111053664" From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 27 Nov 2018 15:10:51 +0800 Message-Id: <1543302652-9268-2-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1543302652-9268-1-git-send-email-huaqiang.wang@intel.com> References: <1543302652-9268-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 27 Nov 2018 07:12:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 27 Nov 2018 07:12:48 +0000 (UTC) for IP:'192.55.52.115' DOMAIN:'mga14.intel.com' HELO:'mga14.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.115 mga14.intel.com 192.55.52.115 mga14.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCHv10 1/2] cpu: Add x86 stepping number as another factor to find candidate CPU 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]); Tue, 27 Nov 2018 07:12:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Cascadelake-SP is looked as the second generation Intel XEON processor scalable family while Skylake-SP is the first generation. Both Skylake-SP and Cascadelake-SP has the same family (6h) and model (55h), but with difference stepping number. In the process of identifying candidate CPU, the stepping number is not irrelevant any more. The CPU refresh from Skylake-SP to Cascadelake-SP is this kind of example. This patch add the stepping number as another factor to identify future Intel CPU. Signed-off-by: Wang Huaqiang --- src/cpu/cpu_x86.c | 60 ++++++++++++++++++++++++++++++++++++++++++++-------= ---- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ebfa74f..20b471b 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -615,8 +615,14 @@ x86DataToSignatureFull(const virCPUx86Data *data, } =20 =20 -/* Mask out irrelevant bits (R and Step) from processor signature. */ -#define SIGNATURE_MASK 0x0fff3ff0 +#define SIGNATURE_MASK 0x0fff3fff +#define SIGNATURE_MASK_STEPPING 0x0000000f +#define SIGNATURE_MASK_FAMILYMODEL 0x0fff3ff0 + +#define SIGNATURE(sig) (sig & SIGNATURE_MASK) +#define STEPPING(sig) (sig & SIGNATURE_MASK_STEPPING) +#define FAMILYMODEL(sig) (sig & SIGNATURE_MASK_FAMILYMODEL) + =20 static uint32_t x86DataToSignature(const virCPUx86Data *data) @@ -627,7 +633,7 @@ x86DataToSignature(const virCPUx86Data *data) if (!(cpuid =3D x86DataCpuid(data, &leaf1))) return 0; =20 - return cpuid->eax & SIGNATURE_MASK; + return SIGNATURE(cpuid->eax); } =20 =20 @@ -1203,6 +1209,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, if (virXPathBoolean("boolean(./signature)", ctxt)) { unsigned int sigFamily =3D 0; unsigned int sigModel =3D 0; + unsigned int sigStepping =3D 0; int rc; =20 rc =3D virXPathUInt("string(./signature/@family)", ctxt, &sigFamil= y); @@ -1221,7 +1228,12 @@ x86ModelParse(xmlXPathContextPtr ctxt, goto cleanup; } =20 - model->signature =3D x86MakeSignature(sigFamily, sigModel, 0); + /* CPU stepping number will be used if './signature/@stepping' is = present */ + rc =3D virXPathUInt("string(./signature/@stepping)", ctxt, &sigSte= pping); + if (rc < 0) + sigStepping =3D 0; + + model->signature =3D x86MakeSignature(sigFamily, sigModel, sigStep= ping); } =20 if (virXPathBoolean("boolean(./vendor)", ctxt)) { @@ -1675,6 +1687,13 @@ virCPUx86Compare(virCPUDefPtr host, * Checks whether a candidate model is a better fit for the CPU data than = the * current model. * + * Using family/model along with an optional stepping number to select can= didate + * CPU. If stepping is 0, consider which might be optional. + * + * If not considering the stepping number, we want to select a model with + * family/model equal to family/model of the real CPU. Once we found such + * model, we only consider candidates with matching family/model. + * * Returns 0 if current is better, * 1 if candidate is better, * 2 if candidate is the best one (search should stop now). @@ -1707,12 +1726,22 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, 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 - * consider candidates with matching family/model. - */ + if (STEPPING(current->signature) && current->signature !=3D signature)= { + VIR_DEBUG("%s is dropped due to signature stepping mismatch, try %= s", + cpuCurrent->model, cpuCandidate->model); + return 1; + } + if (signature && - current->signature =3D=3D signature && + FAMILYMODEL(current->signature) =3D=3D FAMILYMODEL(signature) && + FAMILYMODEL(candidate->signature) !=3D FAMILYMODEL(signature)) { + VIR_DEBUG("%s differs in signature from matching %s", + cpuCandidate->model, cpuCurrent->model); + return 0; + } + + if (signature && STEPPING(candidate->signature) && + FAMILYMODEL(current->signature) =3D=3D FAMILYMODEL(signature) && candidate->signature !=3D signature) { VIR_DEBUG("%s differs in signature from matching %s", cpuCandidate->model, cpuCurrent->model); @@ -1725,12 +1754,19 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, return 1; } =20 + if (signature && STEPPING(candidate->signature) && + FAMILYMODEL(current->signature) =3D=3D FAMILYMODEL(signature) && + candidate->signature =3D=3D signature) { + VIR_DEBUG("%s provides matching signature", cpuCandidate->model); + return 1; + } + /* 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) { + if (signature&& + FAMILYMODEL(candidate->signature) =3D=3D FAMILYMODEL(signature) && + FAMILYMODEL(current->signature) !=3D FAMILYMODEL(signature)) { VIR_DEBUG("%s provides matching signature", cpuCandidate->model); return 1; } --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 21:39:16 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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543302798465795.8314589388197; Mon, 26 Nov 2018 23:13:18 -0800 (PST) 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 750893082B61; Tue, 27 Nov 2018 07:13:16 +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 2278560BEC; Tue, 27 Nov 2018 07:13:16 +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 BC8893F602; Tue, 27 Nov 2018 07:13:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAR7CpTI026590 for ; Tue, 27 Nov 2018 02:12:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8ECC5194A8; Tue, 27 Nov 2018 07:12:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8542619493 for ; Tue, 27 Nov 2018 07:12:50 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F24E93084036 for ; Tue, 27 Nov 2018 07:12:48 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 23:12:48 -0800 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga004.fm.intel.com with ESMTP; 26 Nov 2018 23:12:47 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,285,1539673200"; d="scan'208";a="111053671" From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 27 Nov 2018 15:10:52 +0800 Message-Id: <1543302652-9268-3-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1543302652-9268-1-git-send-email-huaqiang.wang@intel.com> References: <1543302652-9268-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 27 Nov 2018 07:12:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 27 Nov 2018 07:12:49 +0000 (UTC) for IP:'192.55.52.115' DOMAIN:'mga14.intel.com' HELO:'mga14.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.115 mga14.intel.com 192.55.52.115 mga14.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCHv10 2/2] cpu_map: Add Cascadelake Server CPU model 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.45]); Tue, 27 Nov 2018 07:13:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Cascadelake Server CPU is introduced in QEMU by commit c7a88b52f62b30c04158eeb07f73e3f72221b6a8, add the CPU model in libvirt accordingly. Signed-off-by: Wang Huaqiang --- src/cpu_map/Makefile.inc.am | 1 + src/cpu_map/index.xml | 1 + src/cpu_map/x86_Cascadelake-Server.xml | 83 ++++++++++++++++++++++++++++++= ++++ 3 files changed, 85 insertions(+) create mode 100644 src/cpu_map/x86_Cascadelake-Server.xml diff --git a/src/cpu_map/Makefile.inc.am b/src/cpu_map/Makefile.inc.am index 9eeb33e..c74164c 100644 --- a/src/cpu_map/Makefile.inc.am +++ b/src/cpu_map/Makefile.inc.am @@ -21,6 +21,7 @@ cpumap_DATA =3D \ cpu_map/x86_coreduo.xml \ cpu_map/x86_cpu64-rhel5.xml \ cpu_map/x86_cpu64-rhel6.xml \ + cpu_map/x86_Cascadelake-Server.xml \ cpu_map/x86_EPYC.xml \ cpu_map/x86_EPYC-IBRS.xml \ cpu_map/x86_Haswell.xml \ diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml index dccda39..8d31a48 100644 --- a/src/cpu_map/index.xml +++ b/src/cpu_map/index.xml @@ -48,6 +48,7 @@ + =20 diff --git a/src/cpu_map/x86_Cascadelake-Server.xml b/src/cpu_map/x86_Casca= delake-Server.xml new file mode 100644 index 0000000..cbf6ea9 --- /dev/null +++ b/src/cpu_map/x86_Cascadelake-Server.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list