From nobody Sat Jul 12 04:32:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1488794896788126.55155072513037; Mon, 6 Mar 2017 02:08:16 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v26A4oOS028352; Mon, 6 Mar 2017 05:04:50 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v26A4lW9030963 for ; Mon, 6 Mar 2017 05:04:47 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v26A4kWV000309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 6 Mar 2017 05:04:46 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 009237E9C2; Mon, 6 Mar 2017 10:04:46 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2017 02:04:44 -0800 Received: from s2600wt.sh.intel.com ([10.239.48.158]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2017 02:04:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,253,1484035200"; d="scan'208";a="1118957030" From: Eli Qiao To: libvir-list@redhat.com Date: Mon, 6 Mar 2017 18:06:36 +0800 Message-Id: <1488794801-13844-8-git-send-email-liyong.qiao@intel.com> In-Reply-To: <1488794801-13844-1-git-send-email-liyong.qiao@intel.com> References: <1488794801-13844-1-git-send-email-liyong.qiao@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 06 Mar 2017 10:04:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 06 Mar 2017 10:04:46 +0000 (UTC) for IP:'192.55.52.93' DOMAIN:'mga11.intel.com' HELO:'mga11.intel.com' FROM:'liyong.qiao@intel.com' RCPT:'' X-RedHat-Spam-Score: -4.303 (BAYES_50, DCC_REPUT_13_19, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS) 192.55.52.93 mga11.intel.com 192.55.52.93 mga11.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-loop: libvir-list@redhat.com Cc: mkletzan@redhat.com, mtosatti@redhat.com, qiaoliyong@gmail.com Subject: [libvirt] [PATCH resend V10 07/12] 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 652f4ca..86c292d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15760,9 +15760,13 @@ virDomainCacheTuneDefParseXML(virDomainDefPtr def, int type =3D -1; virDomainCacheBankPtr bank =3D NULL; virResCtrlPtr resctrl; + /* An 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"))) { @@ -15810,6 +15814,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) { @@ -15858,6 +15868,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; @@ -15865,6 +15883,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 e7376a0..ee5f043 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -34,7 +34,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 3a6fb95..d639de1 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -28,6 +28,8 @@ # include "virutil.h" # include "conf/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