From nobody Thu Jul 10 04:52:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1486709079551563.0292457153364; Thu, 9 Feb 2017 22:44:39 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1A6fINe061657; Fri, 10 Feb 2017 01:41:18 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1A6ejEZ009953 for ; Fri, 10 Feb 2017 01:40:45 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1A6ejpR018675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 10 Feb 2017 01:40:45 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 2A9FDC057FA4; Fri, 10 Feb 2017 06:40:44 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 09 Feb 2017 22:40:42 -0800 Received: from s2600wt.sh.intel.com ([10.239.48.158]) by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2017 22:40:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,139,1484035200"; d="scan'208";a="1105518462" From: Eli Qiao To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 14:42:11 +0800 Message-Id: <1486708933-5731-8-git-send-email-liyong.qiao@intel.com> In-Reply-To: <1486708933-5731-1-git-send-email-liyong.qiao@intel.com> References: <1486708933-5731-1-git-send-email-liyong.qiao@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 10 Feb 2017 06:40:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 10 Feb 2017 06:40:44 +0000 (UTC) for IP:'134.134.136.24' DOMAIN:'mga09.intel.com' HELO:'mga09.intel.com' FROM:'liyong.qiao@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.222 (BAYES_50, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD, SPF_PASS) 134.134.136.24 mga09.intel.com 134.134.136.24 mga09.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-loop: libvir-list@redhat.com Cc: mkletzan@redhat.com, qiaowei.ren@intel.com, mtosatti@redhat.com, qiaoliyong@gmail.com Subject: [libvirt] [v4 7/9] Resctrl: Make sure l3data/l3code are pairs 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" l3data and l3code type of cache banks should be configured pairs. Signed-off-by: Eli Qiao --- src/conf/domain_conf.c | 19 +++++++++++++++++++ src/util/virresctrl.c | 1 - src/util/virresctrl.h | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6ce819d..d790eb8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15619,9 +15619,13 @@ virDomainCacheTuneDefParseXML(virDomainDefPtr def, int type =3D -1; virDomainCacheBankPtr bank =3D NULL; virResCtrlPtr resctrl; + /* A Array to make sure l3code and l3data are pairs*/ + int* sem =3D NULL; =20 if (VIR_ALLOC_N(bank, n) < 0) goto cleanup; + if (VIR_ALLOC_N(sem, MAX_CPU_SOCKET_NUM) < 0) + goto cleanup; =20 for (i =3D 0; i < n; i++) { if (!(tmp =3D virXMLPropString(nodes[i], "id"))) { @@ -15669,6 +15673,12 @@ virDomainCacheTuneDefParseXML(virDomainDefPtr def, goto cleanup; } =20 + /* VIR_RDT_RESOURCE_L3DATA and VIR_RDT_RESOURCE_L3CODE should be p= air */ + if (type =3D=3D VIR_RDT_RESOURCE_L3DATA) + sem[bank[i].host_id] ++; + else if (type =3D=3D VIR_RDT_RESOURCE_L3CODE) + sem[bank[i].host_id] --; + resctrl =3D virResCtrlGet(type); =20 if (resctrl =3D=3D NULL || !resctrl->enabled) { @@ -15717,6 +15727,14 @@ virDomainCacheTuneDefParseXML(virDomainDefPtr def, } } =20 + for (i =3D 0; i < MAX_CPU_SOCKET_NUM; i ++) { + if (sem[i] !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("'l3code and l3data shoud be show up pairs on bank %= zu'"), + i); + goto cleanup; + } + } def->cachetune.cache_banks =3D bank; def->cachetune.n_banks =3D n; return 0; @@ -15724,6 +15742,7 @@ virDomainCacheTuneDefParseXML(virDomainDefPtr def, cleanup: VIR_FREE(bank); VIR_FREE(tmp); + VIR_FREE(sem); return -1; } =20 diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index bdf922d..e6f9f30 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -40,7 +40,6 @@ VIR_LOG_INIT("util.resctrl"); =20 #define VIR_FROM_THIS VIR_FROM_RESCTRL -#define MAX_CPU_SOCKET_NUM 8 #define MAX_CBM_BIT_LEN 32 #define MAX_SCHEMATA_LEN 1024 #define MAX_FILE_LEN ( 10 * 1024 * 1024) diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index ba5697e..ee7e115 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -28,6 +28,8 @@ # include "virbitmap.h" # include "domain_conf.h" =20 +#define MAX_CPU_SOCKET_NUM 8 + enum { VIR_RDT_RESOURCE_L3, VIR_RDT_RESOURCE_L3DATA, --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list