From nobody Sat Jul 12 04:28:50 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 1488794898884185.18308242953185; Mon, 6 Mar 2017 02:08:18 -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 v26A4nav036144; Mon, 6 Mar 2017 05:04:49 -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 v26A4kGv030952 for ; Mon, 6 Mar 2017 05:04:46 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v26A4jOv012056 (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 B5CDC7E9E1; Mon, 6 Mar 2017 10:04:44 +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:43 -0800 Received: from s2600wt.sh.intel.com ([10.239.48.158]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2017 02:04:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,253,1484035200"; d="scan'208";a="1118957025" From: Eli Qiao To: libvir-list@redhat.com Date: Mon, 6 Mar 2017 18:06:35 +0800 Message-Id: <1488794801-13844-7-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:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 06 Mar 2017 10:04:45 +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.27 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 06/12] 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 | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index efc84c5..ed8bdb9 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5528,7 +5528,7 @@ - (l3) + (l3|l3code|l3data) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 43af0f5..e7376a0 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -417,6 +417,7 @@ int virResCtrlRefreshSchemata(void) unsigned int tmp_schemata; unsigned int default_schemata; unsigned int min_schemata; + int pair_type =3D 0; =20 virResDomainPtr header, p; =20 @@ -429,6 +430,11 @@ int virResCtrlRefreshSchemata(void) if (VIR_RESCTRL_ENABLED(i)) { min_schemata =3D VIR_RESCTRL_GET_SCHEMATA(resctrlall[i].min_cb= m_bits); =20 + 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; // Reset to default schemata 0xfffff @@ -436,8 +442,11 @@ int virResCtrlRefreshSchemata(void) tmp_schemata =3D 0; /* NOTEs: if only header domain, the schemata will be set = to default one*/ for (k =3D 1; k < domainall.num_domains; k++) { - if (p->schematas[i]->schemata_items[j].schemata > min_= schemata) + if (p->schematas[i]->schemata_items[j].schemata > min_= schemata) { tmp_schemata |=3D p->schematas[i]->schemata_items[= j].schemata; + if (pair_type > 0) + tmp_schemata |=3D p->schematas[pair_type]->sch= emata_items[j].schemata; + } p =3D p->next; } =20 @@ -503,6 +512,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); @@ -707,6 +717,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); @@ -721,8 +732,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 @@ -763,6 +784,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) { @@ -797,7 +821,6 @@ int virResCtrlSetCacheBanks(virDomainCachetunePtr cache= tune, 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