From nobody Sat Apr 27 16:53:56 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496656766051485.0157237192824; Mon, 5 Jun 2017 02:59:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 683D3811A7; Mon, 5 Jun 2017 09:59:21 +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 4E65218538; Mon, 5 Jun 2017 09:59:20 +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 5A84E4BB74; Mon, 5 Jun 2017 09:59:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v559xFnK005704 for ; Mon, 5 Jun 2017 05:59:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 569EE88B05; Mon, 5 Jun 2017 09:59:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A44CD863D2; Mon, 5 Jun 2017 09:59:13 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 2556481236; Mon, 5 Jun 2017 09:59:12 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2017 02:59:11 -0700 Received: from s2600wt.sh.intel.com ([10.239.48.36]) by fmsmga005.fm.intel.com with ESMTP; 05 Jun 2017 02:59:10 -0700 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 683D3811A7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 683D3811A7 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2556481236 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=qiaoliyong@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2556481236 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,300,1493708400"; d="scan'208";a="110489003" From: Eli Qiao To: libvir-list@redhat.com Date: Mon, 5 Jun 2017 18:02:25 +0800 Message-Id: <1496656945-48015-1-git-send-email-qiaoliyong@gmail.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.25]); Mon, 05 Jun 2017 09:59:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 05 Jun 2017 09:59:12 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'qiaoliyong@gmail.com' RCPT:'' X-RedHat-Spam-Score: -3.033 (BAYES_50, DCC_REPUT_00_12, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_HI, SPF_SOFTFAIL) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: mkletzan@redhat.com, liyong.qiao@intel.com, Eli Qiao Subject: [libvirt] [PATCH] Capabilities: add step to cache control 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 05 Jun 2017 09:59:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch adds cache control step size under control tag. step is calculated by total_cache_size / cbm_length. This will be needed while later doing cache allocation to calculate cbm bits. Besides, count host's cbm length by counting bit instead of checking cbm_mask length, along with test case updated. Signed-off-by: Eli Qiao --- docs/schemas/capability.rng | 3 +++ src/conf/capabilities.c | 19 +++++++++++++++= +--- src/conf/capabilities.h | 1 + .../linux-resctrl/resctrl/info/L3/cbm_mask | 2 +- .../linux-resctrl/resctrl/info/L3/min_cbm_bits | 2 +- .../linux-resctrl/resctrl/info/L3/num_closids | 2 +- tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml | 8 ++++---- tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml | 4 ++-- 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index e5cbfa3..6be7ac9 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -276,6 +276,9 @@ + + + diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 3becc7e..d1266e6 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -908,9 +908,10 @@ virCapabilitiesFormatCaches(virBufferPtr buf, for (j =3D 0; j < bank->ncontrols; j++) { bool min_kilos =3D !(bank->controls[j]->min % 1024); virBufferAsprintf(&controlBuf, - "\n", bank->controls[j]->min >> (min_kilos * 10), + bank->controls[j]->step >> (min_kilos * 10), min_kilos ? "KiB" : "B", virCacheTypeToString(bank->controls[j]->scop= e), bank->controls[j]->max_allocation); @@ -1602,6 +1603,8 @@ virCapabilitiesGetCacheControl(virCapsHostCacheBankPt= r bank, char *cbm_mask =3D NULL; char *type_upper =3D NULL; unsigned int min_cbm_bits =3D 0; + unsigned int cbm_mask_val =3D 0; + unsigned int cbm_mask_len =3D 0; virCapsHostCacheControlPtr control; =20 if (VIR_ALLOC(control) < 0) @@ -1632,8 +1635,18 @@ virCapabilitiesGetCacheControl(virCapsHostCacheBankP= tr bank, =20 virStringTrimOptionalNewline(cbm_mask); =20 - /* cbm_mask: cache bit mask, it's in hex, eg: fffff */ - control->min =3D min_cbm_bits * bank->size / (strlen(cbm_mask) * 4); + /* cbm_mask: cache bit mask, it's in hex, e.g. fffff or 7ff */ + if (virStrToLong_uip(cbm_mask, NULL, 16, &cbm_mask_val) < 0) + goto cleanup; + + while (cbm_mask_val & 0x1) { + cbm_mask_val =3D cbm_mask_val >> 1; + cbm_mask_len ++; + } + + control->step =3D bank->size / cbm_mask_len; + + control->min =3D min_cbm_bits * control->step; =20 control->scope =3D scope; =20 diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index ee87d59..2cc9bdc 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -152,6 +152,7 @@ typedef struct _virCapsHostCacheControl virCapsHostCach= eControl; typedef virCapsHostCacheControl *virCapsHostCacheControlPtr; struct _virCapsHostCacheControl { unsigned long long min; /* minimum cache control size in B */ + unsigned long long step; /* cache control step size in B */ virCacheType scope; /* data, code or both */ unsigned int max_allocation; /* max number of supported allocations */ }; diff --git a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/cbm_mask b= /tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/cbm_mask index 78031da..d482bbb 100644 --- a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/cbm_mask +++ b/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/cbm_mask @@ -1 +1 @@ -fffff +7ff diff --git a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/min_cbm_bi= ts b/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/min_cbm_bits index 0cfbf08..d00491f 100644 --- a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/min_cbm_bits +++ b/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/min_cbm_bits @@ -1 +1 @@ -2 +1 diff --git a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/num_closid= s b/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/num_closids index b8626c4..b6a7d89 100644 --- a/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/num_closids +++ b/tests/vircaps2xmldata/linux-resctrl/resctrl/info/L3/num_closids @@ -1 +1 @@ -4 +16 diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml b/tests/v= ircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml index 49aa0b9..98893b6 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml @@ -42,12 +42,12 @@ - - + + - - + + diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml b/tests/virca= ps2xmldata/vircaps-x86_64-resctrl.xml index cb78b4a..b54f08e 100644 --- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml +++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml @@ -42,10 +42,10 @@ - + - + --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list