From nobody Thu Jul 10 04:48:54 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 1486709107659540.7082362260319; Thu, 9 Feb 2017 22:45:07 -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 v1A6fIvr047761; Fri, 10 Feb 2017 01:41:18 -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 v1A6eiqa009945 for ; Fri, 10 Feb 2017 01:40:44 -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 v1A6eiDj024168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 10 Feb 2017 01:40:44 -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 B47A07F342; Fri, 10 Feb 2017 06:40:42 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 09 Feb 2017 22:40:41 -0800 Received: from s2600wt.sh.intel.com ([10.239.48.158]) by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2017 22:40:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,139,1484035200"; d="scan'208";a="1105518452" From: Eli Qiao To: libvir-list@redhat.com Date: Fri, 10 Feb 2017 14:42:10 +0800 Message-Id: <1486708933-5731-7-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.26]); Fri, 10 Feb 2017 06:40:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 10 Feb 2017 06:40:43 +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.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-loop: libvir-list@redhat.com Cc: mkletzan@redhat.com, qiaowei.ren@intel.com, mtosatti@redhat.com, qiaoliyong@gmail.com Subject: [libvirt] [v4 6/9] Resctrl: enable l3code/l3data 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" Enable l3code/l3data while doing cache tune. l3code/l3data should use a continus cbm in their seperated schemata and the cache size are shared between them, so we need to deal them differently with l3 cache. This should enable cdp feature while mounting /sys/fs/resctrl, eg: mount -t resctrl resctrl -o cdp /sys/fs/resctrl Signed-off-by: Eli Qiao --- docs/schemas/domaincommon.rng | 2 +- src/util/virresctrl.c | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index edb2888..f61c57a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5489,7 +5489,7 @@ - (l3) + (l3|l3code|l3data) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 0d400a9..bdf922d 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -557,6 +557,7 @@ int virResCtrlRefreshSchemata(void) size_t i, j, k; unsigned int tmp_schemata; unsigned int default_schemata; + int pair_type =3D 0; =20 virResDomainPtr header, p; =20 @@ -567,6 +568,12 @@ int virResCtrlRefreshSchemata(void) =20 for (i =3D 0; i < VIR_RDT_RESOURCE_LAST; i++) { if (VIR_RESCTRL_ENABLED(i)) { + + if (i =3D=3D VIR_RDT_RESOURCE_L3DATA) + pair_type =3D VIR_RDT_RESOURCE_L3CODE; + if (i =3D=3D VIR_RDT_RESOURCE_L3CODE) + pair_type =3D VIR_RDT_RESOURCE_L3DATA; + for (j =3D 0; j < header->schematas[i]->n_schemata_items; j ++= ) { p =3D header->next; default_schemata =3D VIR_RESCTRL_GET_SCHEMATA(resctrlall[i= ].cbm_len); @@ -574,6 +581,8 @@ int virResCtrlRefreshSchemata(void) /* NOTEs: if only header domain, the schemata will be set = to default one*/ for (k =3D 1; k < domainall.num_domains; k++) { tmp_schemata |=3D p->schematas[i]->schemata_items[j].s= chemata; + if (pair_type > 0) + tmp_schemata |=3D p->schematas[pair_type]->schemat= a_items[j].schemata; p =3D p->next; } /* sys fs doens't let us use 0 */ @@ -685,6 +694,7 @@ virResCtrlWrite(const char *name, const char *item, con= st char *content) goto cleanup; =20 rc =3D 0; + cleanup: VIR_FREE(path); VIR_FORCE_CLOSE(writefd); @@ -888,6 +898,7 @@ virResCtrlCalculateSchemata(int type, virResDomainPtr p; unsigned int tmp_schemata; unsigned int schemata_sum =3D 0; + int pair_type =3D 0; =20 if (resctrlall[type].cache_banks[sid].cache_left < size) { VIR_ERROR(_("Not enough cache left on bank %u"), hostid); @@ -902,8 +913,18 @@ virResCtrlCalculateSchemata(int type, =20 p =3D domainall.domains; p =3D p->next; + + /* for type is l3code and l3data, we need to deal them specially*/ + if (type =3D=3D VIR_RDT_RESOURCE_L3DATA) + pair_type =3D VIR_RDT_RESOURCE_L3CODE; + + if (type =3D=3D VIR_RDT_RESOURCE_L3CODE) + pair_type =3D VIR_RDT_RESOURCE_L3DATA; + for (i =3D 1; i < domainall.num_domains; i ++) { schemata_sum |=3D p->schematas[type]->schemata_items[sid].schemata; + if (pair_type > 0) + schemata_sum |=3D p->schematas[pair_type]->schemata_items[sid]= .schemata; p =3D p->next; } =20 @@ -944,6 +965,9 @@ int virResCtrlSetCacheBanks(virDomainCachetunePtr cache= tune, } =20 if (p !=3D NULL) { + + virResCtrlAppendDomain(p); + for (i =3D 0; i < cachetune->n_banks; i++) { if ((type =3D virResCtrlTypeFromString( cachetune->cache_banks[i].type)) < 0) { @@ -978,7 +1002,6 @@ int virResCtrlSetCacheBanks(virDomainCachetunePtr cach= etune, virResCtrlDestroyDomain(p); return -1; } - virResCtrlAppendDomain(p); } else { VIR_ERROR(_("Failed to create a domain in sysfs")); return -1; --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list