From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153112153763296.40323472166051; Mon, 9 Jul 2018 00:32:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47B6530832C2; Mon, 9 Jul 2018 07:32:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 177683001A49; Mon, 9 Jul 2018 07:32:16 +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 C5CDE1800B6B; Mon, 9 Jul 2018 07:32:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697VvDW015250 for ; Mon, 9 Jul 2018 03:31:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3974308BDAE; Mon, 9 Jul 2018 07:31:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B5659308BDAD for ; Mon, 9 Jul 2018 07:31:55 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 0B67F3DE42 for ; Mon, 9 Jul 2018 07:31:54 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:31:53 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:31:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69733974" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:49 +0800 Message-Id: <1531119658-18549-2-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:54 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 01/10] util: add Intel x86 RDT/CMT support 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add RDT/CMT feature (Intel x86) by interacting with kernel resctrl file system. Integrate code into util/resctrl. --- src/libvirt_private.syms | 10 ++ src/util/virresctrl.c | 338 +++++++++++++++++++++++++++++++++++++++++++= ++++ src/util/virresctrl.h | 40 ++++++ 3 files changed, 388 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3e30490..b10a3a5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2655,6 +2655,16 @@ virResctrlAllocSetID; virResctrlAllocSetSize; virResctrlInfoGetCache; virResctrlInfoNew; +virResctrlMonAddPID; +virResctrlMonCreate; +virResctrlMonDeterminePath; +virResctrlMonGetAlloc; +virResctrlMonGetCacheOccupancy; +virResctrlMonGetID; +virResctrlMonIsRunning; +virResctrlMonNew; +virResctrlMonRemove; +virResctrlMonSetID; =20 =20 # util/virrotatingfile.h diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index e492a63..3dca937 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -90,6 +90,7 @@ typedef virResctrlAllocPerLevel *virResctrlAllocPerLevelP= tr; /* Class definitions and initializations */ static virClassPtr virResctrlInfoClass; static virClassPtr virResctrlAllocClass; +static virClassPtr virResctrlMonClass; =20 =20 /* virResctrlInfo */ @@ -257,6 +258,33 @@ virResctrlAllocDispose(void *obj) } =20 =20 + +/* virResctrlMon*/ +struct _virResctrlMon { + virObject parent; + + /* alloc: keeps the pointer to a allocation group if sharing same + * resctrlfs subdirectory with a allocation group. + * NULL for a standalone monitoring group.*/ + virResctrlAllocPtr alloc; + /* The identifier (any unique string for now) */ + char *id; + /* libvirt-generated path, be identical to path of 'alloc' if sharing + * same resctrlfs subdirectory with allocation group */ + char *path; +}; + + +static void +virResctrlMonDispose(void *obj) +{ + virResctrlMonPtr resctrlMon =3D obj; + + VIR_FREE(resctrlMon->id); + VIR_FREE(resctrlMon->path); +} + + /* Global initialization for classes */ static int virResctrlOnceInit(void) @@ -267,6 +295,9 @@ virResctrlOnceInit(void) if (!VIR_CLASS_NEW(virResctrlAlloc, virClassForObject())) return -1; =20 + if (!VIR_CLASS_NEW(virResctrlMon, virClassForObject())) + return -1; + return 0; } =20 @@ -1612,3 +1643,310 @@ virResctrlAllocRemove(virResctrlAllocPtr alloc) =20 return ret; } + + +virResctrlMonPtr +virResctrlMonNew(void) +{ + if (virResctrlInitialize() < 0) + return NULL; + + return virObjectNew(virResctrlMonClass); +} + + +int +virResctrlMonSetID(virResctrlMonPtr mon, + const char *id) +{ + if (!id) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Resctrl mon group 'id' cannot be NULL")); + return -1; + } + + return VIR_STRDUP(mon->id, id); +} + + +const char * +virResctrlMonGetID(virResctrlMonPtr mon) +{ + return mon->id; +} + + +int +virResctrlMonDeterminePath(virResctrlMonPtr mon, + const char *machinename) +{ + char *grouppath =3D NULL; + int ret =3D -1; + + if (!mon->id) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Resctrl mon group id must be set before creation")); + goto cleanup; + } + + if (!mon->path) { + if (virAsprintf(&grouppath, "%s/mon_groups/%s-%s", + SYSFS_RESCTRL_PATH, machinename, mon->id) < 0) { + + goto cleanup; + } + VIR_STEAL_PTR(mon->path, grouppath); + + } else { + /* if path exists, validate it */ + if (virAsprintf(&grouppath, "%s/%s-%s", + SYSFS_RESCTRL_PATH, machinename, mon->id) < 0) { + goto cleanup; + } + + if (STRNEQ(mon->path, grouppath)) + goto cleanup; + } + + ret =3D 0; + cleanup: + VIR_FREE(grouppath); + return ret; +} + + +int +virResctrlMonAddPID(virResctrlMonPtr mon, + pid_t pid) +{ + char *tasks =3D NULL; + char *pidstr =3D NULL; + int ret =3D 0; + + /* PID only writes to standalone mon group */ + if (mon->alloc) + return 0; + + if (!mon->path) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot add pid to non-existing resctrl mon group")); + return -1; + } + + VIR_DEBUG("Add PID %d to domain %s\n", + pid, mon->path); + + if (virAsprintf(&tasks, "%s/tasks", mon->path) < 0) + return -1; + + if (virAsprintf(&pidstr, "%lld", (long long int) pid) < 0) + goto cleanup; + + if (virFileWriteStr(tasks, pidstr, 0) < 0) { + virReportSystemError(errno, + _("Cannot write pid in tasks file '%s'"), + tasks); + goto cleanup; + } + + ret =3D 0; + cleanup: + VIR_FREE(tasks); + VIR_FREE(pidstr); + return ret; +} + + +int +virResctrlMonCreate(virResctrlAllocPtr alloc, + virResctrlMonPtr mon, + const char *machinename) +{ + int ret =3D -1; + int lockfd =3D -1; + + if (!mon) + return -1; + + if (alloc) { + if (!virFileExists(alloc->path)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resctrl mon group: allocation group exists but not " + "valid")); + return -1; + } + mon->alloc =3D alloc; + + if (virResctrlMonDeterminePath(mon, machinename) < 0) + return -1; + } else { + if (virResctrlMonDeterminePath(mon, machinename) < 0) + return -1; + + lockfd =3D virResctrlLockWrite(); + if (lockfd < 0) + goto cleanup; + + if (virFileExists(mon->path)) { + VIR_DEBUG("Removing resctrl mon group %s", mon->path); + if (rmdir(mon->path) !=3D 0 && errno !=3D ENOENT) { + virReportSystemError(errno, + _("Unable to remove resctrl directory= '%s'"), + mon->path); + goto cleanup; + } + } + + if (virFileMakePath(mon->path) < 0) { + virReportSystemError(errno, + _("Cannot create resctrl directory '%s'"), + mon->path); + goto cleanup; + } + } + + ret =3D 0; + cleanup: + virResctrlUnlock(lockfd); + return ret; +} + + +int +virResctrlMonRemove(virResctrlMonPtr mon) +{ + int ret =3D 0; + + if (!mon->path) + return 0; + + VIR_DEBUG("Removing resctrl mon group %s", mon->path); + if (rmdir(mon->path) !=3D 0 && errno !=3D ENOENT) { + ret =3D -errno; + VIR_ERROR(_("Unable to remove %s (%d)"), mon->path, errno); + } + + return ret; +} + + +bool +virResctrlMonIsRunning(virResctrlMonPtr mon) +{ + bool ret =3D false; + int rv =3D -1; + char *tasks =3D NULL; + + if (mon && virFileExists(mon->path)) { + rv =3D virFileReadValueString(&tasks, "%s/tasks", mon->path); + if (rv < 0) + goto cleanup; + + if (!tasks || !tasks[0]) + goto cleanup; + + ret =3D true; + } + + cleanup: + VIR_FREE(tasks); + return ret; +} + + +static int +virResctrlMonGetStatistic(virResctrlMonPtr mon, + const char *resfile, + unsigned int *value) +{ + DIR *dirp =3D NULL; + int ret =3D -1; + int rv =3D -1; + struct dirent *ent =3D NULL; + unsigned int val =3D 0; + unsigned int valtotal =3D 0; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + char *mondatapath =3D NULL; + + if (!mon->path) + goto cleanup; + + if (!resfile) + goto cleanup; + + *value =3D 0; + + rv =3D virDirOpenIfExists(&dirp, mon->path); + if (rv <=3D 0) + goto cleanup; + + virBufferAsprintf(&buf, "%s/mon_data", + mon->path); + mondatapath =3D virBufferContentAndReset(&buf); + if (!mondatapath) + goto cleanup; + + VIR_DEBUG("Seek llc_occupancy file from root: %s ", + mondatapath); + + if (virDirOpen(&dirp, mondatapath) < 0) + goto cleanup; + + while ((rv =3D virDirRead(dirp, &ent, mondatapath)) > 0) { + VIR_DEBUG("Parsing file '%s'", ent->d_name); + if (ent->d_type !=3D DT_DIR) + continue; + + if (STRNEQLEN(ent->d_name, "mon_L", 5)) + continue; + + rv =3D virFileReadValueUint(&val, + "%s/%s/%s", + mondatapath, ent->d_name, resfile); + + if (rv =3D=3D -2) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("file %s/%s/%s does not exist"), + mondatapath, ent->d_name, resfile); + goto cleanup; + } else { + if (rv < 0) + goto cleanup; + } + + valtotal +=3D val; + } + + *value =3D valtotal; + ret =3D 0; + cleanup: + VIR_FREE(mondatapath); + VIR_DIR_CLOSE(dirp); + return ret; +} + +int +virResctrlMonGetCacheOccupancy(virResctrlMonPtr mon, + unsigned int * cacheoccu) +{ + const char *cacheoccufile =3D "llc_occupancy"; + unsigned int value =3D 0; + int ret =3D - 1; + + *cacheoccu =3D 0; + + ret =3D virResctrlMonGetStatistic(mon, + cacheoccufile, + &value); + if (ret >=3D 0) + *cacheoccu =3D value; + + return ret; +} + + +virResctrlAllocPtr +virResctrlMonGetAlloc(virResctrlMonPtr mon) +{ + return mon->alloc; +} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 9052a2b..6865ab6 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -116,4 +116,44 @@ virResctrlAllocAddPID(virResctrlAllocPtr alloc, int virResctrlAllocRemove(virResctrlAllocPtr alloc); =20 + +/* Monitoring-related things */ +typedef struct _virResctrlMon virResctrlMon; +typedef virResctrlMon *virResctrlMonPtr; + +virResctrlMonPtr +virResctrlMonNew(void); + +int +virResctrlMonSetID(virResctrlMonPtr mon, + const char *id); + +const char * +virResctrlMonGetID(virResctrlMonPtr mon); + +int +virResctrlMonDeterminePath(virResctrlMonPtr mon, + const char *machinename); + +int +virResctrlMonAddPID(virResctrlMonPtr alloc, + pid_t pid); + +int +virResctrlMonCreate(virResctrlAllocPtr pairedalloc, + virResctrlMonPtr mon, + const char *machinename); + +int +virResctrlMonRemove(virResctrlMonPtr mon); + +bool +virResctrlMonIsRunning(virResctrlMonPtr mon); + +int +virResctrlMonGetCacheOccupancy(virResctrlMonPtr mon, + unsigned int * cacheoccu); + +virResctrlAllocPtr +virResctrlMonGetAlloc(virResctrlMonPtr mon); #endif /* __VIR_RESCTRL_H__ */ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121534433933.0206833560492; Mon, 9 Jul 2018 00:32:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1148830E6846; Mon, 9 Jul 2018 07:32:13 +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 BB0A9BAB7; Mon, 9 Jul 2018 07:32:12 +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 75A4A3F7FE; Mon, 9 Jul 2018 07:32:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697W0Js015271 for ; Mon, 9 Jul 2018 03:32:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9D315C54A; Mon, 9 Jul 2018 07:32:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADCB05C893 for ; Mon, 9 Jul 2018 07:31:58 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 20C17155E0 for ; Mon, 9 Jul 2018 07:31:56 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:31:56 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:31:54 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69733981" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:50 +0800 Message-Id: <1531119658-18549-3-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:56 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 02/10] conf: introduce element 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 09 Jul 2018 07:32:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" resmongroup element is used for feature of resctrl monitoring group, and keeps the information for how resctrl monitoring groups is arranged. --- docs/formatdomain.html.in | 17 +++ docs/schemas/domaincommon.rng | 14 ++ src/conf/domain_conf.c | 318 ++++++++++++++++++++++++++++++++++++++= ++++ src/conf/domain_conf.h | 25 ++++ src/libvirt_private.syms | 3 + 5 files changed, 377 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a3afe13..cfb10c4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -757,6 +757,8 @@ <cache id=3D'0' level=3D'3' type=3D'both' size=3D'3' unit=3D'MiB'= /> <cache id=3D'1' level=3D'3' type=3D'both' size=3D'3' unit=3D'MiB'= /> </cachetune> + <resmongroup vcpus=3D"0-3"/> + <resmongroup vcpus=3D"4"/> </cputune> ... </domain> @@ -952,6 +954,21 @@ =20 +
resmongroupSince 4.6.0=
+
+ Optional resmongroup element can be used to create re= sctrl + monitoring group for purpose of reporting cache occupancy informat= oin. + The attribute vcpus specifies vCPUs this monitoring g= roup + applies and which is impacted by the cachetune + vcpus attribute. A resmongroup + vcpus is valid if it has the same setting with that of + cachetune element, but any other kind of overlap betw= een + vcpus of rdtmongroup and + cachetune vcpus is not permitted. Furthe= r, + any other kind of vCPUs overlap between monitoring groups is allow= ed. + Optional attribute id specifies the group name. + +
=20 =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index bd687ce..a8057b1 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -952,6 +952,20 @@ + + + + + + + + [a-zA-Z0-9,-_]+ + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f4e59f6..0cdad79 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2975,6 +2975,18 @@ virDomainSEVDefFree(virDomainSEVDefPtr def) } =20 =20 +static void +virDomainCpuResmonDefFree(virDomainCpuResmonDefPtr resmon) +{ + if (!resmon) + return; + + virObjectUnref(resmon->mon); + virBitmapFree(resmon->vcpus); + VIR_FREE(resmon); +} + + void virDomainDefFree(virDomainDefPtr def) { size_t i; @@ -3152,6 +3164,10 @@ void virDomainDefFree(virDomainDefPtr def) virDomainCachetuneDefFree(def->cachetunes[i]); VIR_FREE(def->cachetunes); =20 + for (i =3D 0; i < def->nresmons; i++) + virDomainCpuResmonDefFree(def->resmons[i]); + VIR_FREE(def->resmons); + VIR_FREE(def->keywrap); =20 if (def->namespaceData && def->ns.free) @@ -19055,6 +19071,264 @@ virDomainCachetuneDefParse(virDomainDefPtr def, } =20 =20 +bool +virDomainCpuResmonDefValidate(virDomainDefPtr def, + const char *id, + virBitmapPtr vcpus, + virResctrlAllocPtr *alloc) +{ + ssize_t i =3D -1; + + /* vcpu should exist in current domain */ + while ((i =3D virBitmapNextSetBit(vcpus, i)) > -1) { + if (!virDomainDefGetVcpu(def, i)) + return false; + } + + if (alloc) + *alloc =3D NULL; + + /* if 'vcpus' equals to vcpus of any existing allocation group, means,= mon + * group is sharing same resctrl resource group with allocation group,= this + * is a legal case. Otherwise, no vcpu overlap is allowed between mon = group + * and any aollocation group. + * if a mon group is sharing the same resource group with one allocati= on + * group, we hope the mon group and the allocation group have a same '= id', + * and the 'alloc' pointer points to the allocation group. */ + for (i =3D 0; i < def->ncachetunes; i++) { + if (virBitmapOverlaps(vcpus, def->cachetunes[i]->vcpus)) { + if (virBitmapEqual(vcpus, def->cachetunes[i]->vcpus)) { + const char *allocid =3D + virResctrlAllocGetID(def->cachetunes[i]->alloc); + if (!allocid || (id && STRNEQ(id, allocid))) + return false; + + if (alloc) + *alloc =3D def->cachetunes[i]->alloc; + return true; + } + + return false; + } + } + + /* if vcpus equals to vcpus of existing mon group vcpus, + * a mon group already created, return True. + * for new mon group no overlap for vcpus */ + for (i =3D 0; i < def->nresmons; i++) { + if (virBitmapEqual(vcpus, def->resmons[i]->vcpus) && + (!id || + STREQ(id, virResctrlMonGetID(def->resmons[i]->mon)))) + return true; + + if (virBitmapOverlaps(vcpus, def->resmons[i]->vcpus)) + return false; + } + + return true; +} + + +virDomainCpuResmonDefPtr +virDomainCpuResmonDefAdd(virDomainDefPtr def, + virBitmapPtr vcpuslist, + const char *monid) +{ + virDomainCpuResmonDefPtr resmon =3D NULL; + virResctrlMonPtr mon =3D NULL; + char *id =3D NULL; + char *vcpus_str =3D NULL; + size_t i =3D -1; + virDomainCpuResmonDefPtr ret =3D NULL; + virBitmapPtr vcpus =3D virBitmapNewCopy(vcpuslist); + + if (VIR_STRDUP(id, monid) < 0) + goto cleanup; + + for (i =3D 0; i < def->nresmons; i++) { + if (virBitmapEqual(vcpus, def->resmons[i]->vcpus)) { + if (!id || + STREQ(id, virResctrlMonGetID(def->resmons[i]->mon))) { + ret =3D def->resmons[i]; + goto cleanup; + } + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("resource monitoring group id mismatch")); + goto cleanup; + } + } + + /* resouce group created by cachtune also has a mon group, if matched + * copying the group id and no sub-directory under resctrl fs will be + * created */ + for (i =3D 0; i < def->ncachetunes; i++) { + if (virBitmapEqual(vcpus, def->cachetunes[i]->vcpus)) { + const char *allocid + =3D virResctrlAllocGetID(def->cachetunes[i]->alloc); + /* for mon group matched in cachetunes list should never + * be disabled because we cannot disable an allocation + * group in runtime */ + if (!id) { + if (VIR_STRDUP(id, allocid) < 0) + goto cleanup; + + } + break; + } + } + + if (!id) { + vcpus_str =3D virBitmapFormat(vcpus); + if (virAsprintf(&id, "vcpus_%s", vcpus_str) < 0) + goto cleanup; + } + + if (VIR_ALLOC(resmon) < 0) + goto cleanup; + + mon =3D virResctrlMonNew(); + if (!mon) + goto cleanup; + + if (virResctrlMonSetID(mon, id) < 0) + goto cleanup; + + VIR_STEAL_PTR(resmon->vcpus, vcpus); + VIR_STEAL_PTR(resmon->mon, mon); + + if (VIR_APPEND_ELEMENT(def->resmons, def->nresmons, resmon) < 0) + goto cleanup; + + ret =3D def->resmons[def->nresmons - 1]; + cleanup: + virBitmapFree(vcpus); + VIR_FREE(id); + virDomainCpuResmonDefFree(resmon); + virObjectUnref(mon); + return ret; +} + + +virResctrlMonPtr +virDomainCpuResmonDefRemove(virDomainDefPtr def, + const char *monid) +{ + virDomainCpuResmonDefPtr resmon =3D NULL; + virResctrlMonPtr mon =3D NULL; + size_t i =3D -1; + + if (!monid) { + virReportError(VIR_ERR_INVALID_ARG, + _("Cannot remove resource monitoring group: " + "group name is NULL")); + goto error; + } + + for (i =3D 0; i < def->nresmons; i++) { + const char *id =3D virResctrlMonGetID(def->resmons[i]->mon); + if (!id) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot remove resource monitoring group: " + "error in get monitoring group name")); + goto error; + } + + if (STREQ(monid, id)) + break; + } + + if (i =3D=3D def->nresmons) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot remove resource monitoring group: " + "no monitoring group '%s' found"), + monid); + goto error; + } + + resmon =3D def->resmons[i]; + VIR_DELETE_ELEMENT(def->resmons, i, def->nresmons); + + mon =3D resmon->mon; + virBitmapFree(resmon->vcpus); + VIR_FREE(resmon); + error: + return mon; +} + + +static int +virDomainCpuResmonDefParse(virDomainDefPtr def, + xmlXPathContextPtr ctxt, + unsigned int flags) +{ + xmlNodePtr oldnode =3D ctxt->node; + xmlNodePtr *nodes =3D NULL; + virBitmapPtr vcpus =3D NULL; + char *vcpus_str =3D NULL; + char *monid =3D NULL; + size_t i =3D 0; + int n =3D 0; + int ret =3D -1; + + if ((n =3D virXPathNodeSet("./cputune/resmongroup", ctxt, &nodes)) < 0) + goto cleanup; + + for (i =3D 0; i < n; i++) { + + if (!(vcpus_str =3D virXMLPropString(nodes[i], "vcpus"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing resmongroup attribute 'vcpus'")); + goto cleanup; + } + + if (virBitmapParse(vcpus_str, &vcpus, VIR_DOMAIN_CPUMASK_LEN) < 0)= { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid resmongroup attribute 'vcpus' value '%s'"), + vcpus_str); + goto cleanup; + } + + virBitmapShrink(vcpus, def->maxvcpus); + + if (virBitmapIsAllClear(vcpus)) { + ret =3D 0; + goto cleanup; + } + + if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) + monid =3D virXMLPropString(nodes[i], "id"); + + if (!virDomainCpuResmonDefValidate(def, monid, vcpus, NULL)) { + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("vcpus or group name conflicts with domain " + "settings")); + goto cleanup; + } + + if (!virDomainCpuResmonDefAdd(def, vcpus, monid)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error in add resource monitoring group settin= gs " + "to configuration file")); + goto cleanup; + } + + virBitmapFree(vcpus); + vcpus =3D NULL; + VIR_FREE(monid); + monid =3D NULL; + } + + ret =3D 0; + cleanup: + ctxt->node =3D oldnode; + virBitmapFree(vcpus); + VIR_FREE(monid); + VIR_FREE(vcpus_str); + VIR_FREE(nodes); + return ret; +} + + static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, xmlNodePtr root, @@ -19648,8 +19922,15 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainCachetuneDefParse(def, ctxt, nodes[i], flags) < 0) goto error; } + VIR_FREE(nodes); =20 + if (virDomainCpuResmonDefParse(def, ctxt, flags) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot extract CPU resource monitoring group setting")); + goto error; + } + if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu)= < 0) goto error; =20 @@ -26943,6 +27224,41 @@ virDomainCachetuneDefFormat(virBufferPtr buf, =20 =20 static int +virDomainCpuResmonDefFormat(virBufferPtr buf, + virDomainDefPtr def, + unsigned int flags) +{ + char *vcpus =3D NULL; + size_t i =3D 0; + int ret =3D -1; + + for (i =3D 0; i < def->nresmons; i++) { + vcpus =3D virBitmapFormat(def->resmons[i]->vcpus); + if (!vcpus) + goto cleanup; + + virBufferAsprintf(buf, "resmons[i]->mon= ); + if (!mon_id) + goto cleanup; + + virBufferAsprintf(buf, " id=3D'%s'", mon_id); + } + virBufferAddLit(buf, "/>\n"); + + VIR_FREE(vcpus); + } + + ret =3D 0; + cleanup: + VIR_FREE(vcpus); + return ret; +} + + +static int virDomainCputuneDefFormat(virBufferPtr buf, virDomainDefPtr def, unsigned int flags) @@ -27047,6 +27363,8 @@ virDomainCputuneDefFormat(virBufferPtr buf, for (i =3D 0; i < def->ncachetunes; i++) virDomainCachetuneDefFormat(&childrenBuf, def->cachetunes[i], flag= s); =20 + virDomainCpuResmonDefFormat(&childrenBuf, def, flags); + if (virBufferCheckError(&childrenBuf) < 0) return -1; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 41d2748..7d31254 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2237,6 +2237,13 @@ struct _virDomainCachetuneDef { virResctrlAllocPtr alloc; }; =20 +typedef struct _virDomainCpuResmonDef virDomainCpuResmonDef; +typedef virDomainCpuResmonDef *virDomainCpuResmonDefPtr; + +struct _virDomainCpuResmonDef { + virBitmapPtr vcpus; + virResctrlMonPtr mon; +}; =20 typedef struct _virDomainVcpuDef virDomainVcpuDef; typedef virDomainVcpuDef *virDomainVcpuDefPtr; @@ -2413,6 +2420,9 @@ struct _virDomainDef { virDomainCachetuneDefPtr *cachetunes; size_t ncachetunes; =20 + virDomainCpuResmonDefPtr *resmons; + size_t nresmons; + virDomainNumaPtr numa; virDomainResourceDefPtr resource; virDomainIdMapDef idmap; @@ -3640,4 +3650,19 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscar= d discard, bool virDomainDefHasManagedPR(const virDomainDef *def); =20 +bool +virDomainCpuResmonDefValidate(virDomainDefPtr def, + const char *id, + virBitmapPtr vcpus, + virResctrlAllocPtr *pairedalloc); + +virDomainCpuResmonDefPtr +virDomainCpuResmonDefAdd(virDomainDefPtr def, + virBitmapPtr vcpus, + const char *monid); + +virResctrlMonPtr +virDomainCpuResmonDefRemove(virDomainDefPtr def, + const char *monid); + #endif /* __DOMAIN_CONF_H */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b10a3a5..9c2b2f0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -243,6 +243,9 @@ virDomainControllerRemove; virDomainControllerTypeToString; virDomainCpuPlacementModeTypeFromString; virDomainCpuPlacementModeTypeToString; +virDomainCpuResmonDefAdd; +virDomainCpuResmonDefRemove; +virDomainCpuResmonDefValidate; virDomainDefAddController; virDomainDefAddImplicitDevices; virDomainDefAddUSBController; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121525649337.108588327799; Mon, 9 Jul 2018 00:32:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7CBDC0587C3; Mon, 9 Jul 2018 07:32:03 +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 8BA42100164E; Mon, 9 Jul 2018 07:32:03 +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 E32983FCC0; Mon, 9 Jul 2018 07:32:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.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 w697VxFH015264 for ; Mon, 9 Jul 2018 03:31:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id D26973001A45; Mon, 9 Jul 2018 07:31:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA9933001A47 for ; Mon, 9 Jul 2018 07:31:59 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 84ABC13AB2 for ; Mon, 9 Jul 2018 07:31:58 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:31:58 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:31:56 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69733987" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:51 +0800 Message-Id: <1531119658-18549-4-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:31:58 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 03/10] tests: add tests for validating 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 09 Jul 2018 07:32:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- tests/genericxml2xmlindata/cachetune-cdp.xml | 3 ++ tests/genericxml2xmlindata/cachetune-small.xml | 2 ++ tests/genericxml2xmlindata/cachetune.xml | 2 ++ .../resmongroup-colliding-cachetune.xml | 34 ++++++++++++++++++= ++++ tests/genericxml2xmltest.c | 3 ++ 5 files changed, 44 insertions(+) create mode 100644 tests/genericxml2xmlindata/resmongroup-colliding-cachet= une.xml diff --git a/tests/genericxml2xmlindata/cachetune-cdp.xml b/tests/genericxm= l2xmlindata/cachetune-cdp.xml index 9718f06..9b0874e 100644 --- a/tests/genericxml2xmlindata/cachetune-cdp.xml +++ b/tests/genericxml2xmlindata/cachetune-cdp.xml @@ -15,6 +15,9 @@ + + + hvm diff --git a/tests/genericxml2xmlindata/cachetune-small.xml b/tests/generic= xml2xmlindata/cachetune-small.xml index ab2d9cf..ef4321e 100644 --- a/tests/genericxml2xmlindata/cachetune-small.xml +++ b/tests/genericxml2xmlindata/cachetune-small.xml @@ -8,6 +8,8 @@ + + hvm diff --git a/tests/genericxml2xmlindata/cachetune.xml b/tests/genericxml2xm= lindata/cachetune.xml index 645cab7..d30c730 100644 --- a/tests/genericxml2xmlindata/cachetune.xml +++ b/tests/genericxml2xmlindata/cachetune.xml @@ -12,6 +12,8 @@ + + hvm diff --git a/tests/genericxml2xmlindata/resmongroup-colliding-cachetune.xml= b/tests/genericxml2xmlindata/resmongroup-colliding-cachetune.xml new file mode 100644 index 0000000..ff85cd4 --- /dev/null +++ b/tests/genericxml2xmlindata/resmongroup-colliding-cachetune.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 4 + + + + + + + + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 7a4fc1e..68a366e 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -145,6 +145,9 @@ mymain(void) =20 DO_TEST("launch-security-sev"); =20 + DO_TEST_FULL("resmongroup-colliding-cachetune", false, true, + TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + virObjectUnref(caps); virObjectUnref(xmlopt); =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121539539184.46766450381347; Mon, 9 Jul 2018 00:32:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F278685A02; Mon, 9 Jul 2018 07:32:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFDB6600CD; Mon, 9 Jul 2018 07:32:17 +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 773891800B69; Mon, 9 Jul 2018 07:32:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697W7rE015287 for ; Mon, 9 Jul 2018 03:32:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59FA6600CD; Mon, 9 Jul 2018 07:32:07 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51B33600C9 for ; Mon, 9 Jul 2018 07:32:01 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 7A4F813A9A for ; Mon, 9 Jul 2018 07:32:00 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:00 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:31:58 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69733997" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:52 +0800 Message-Id: <1531119658-18549-5-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:00 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 04/10] libvirt: add public APIs for resource monitoring group 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 09 Jul 2018 07:32:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" support functions to create, destory and monitoring resctl monioring group. --- include/libvirt/libvirt-domain.h | 13 ++++++ src/conf/domain_conf.c | 2 + src/driver-hypervisor.h | 13 ++++++ src/libvirt-domain.c | 96 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 6 +++ 5 files changed, 130 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 796f2e1..c703346 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4785,5 +4785,18 @@ int virDomainGetLaunchSecurityInfo(virDomainPtr doma= in, virTypedParameterPtr *params, int *nparams, unsigned int flags); +/* + * cpures API + */ +int virDomainSetCPUResmon(virDomainPtr domain, + const char *vcpustr, + const char *mongroup, + int action, + unsigned int flags); + +int virDomainGetCPUResmonSts(virDomainPtr domain, + const char *mongroup, + char **sts); + =20 #endif /* __VIR_LIBVIRT_DOMAIN_H__ */ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0cdad79..393439a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19219,6 +19219,7 @@ virDomainCpuResmonDefRemove(virDomainDefPtr def, =20 if (!monid) { virReportError(VIR_ERR_INVALID_ARG, + "%s", _("Cannot remove resource monitoring group: " "group name is NULL")); goto error; @@ -19228,6 +19229,7 @@ virDomainCpuResmonDefRemove(virDomainDefPtr def, const char *id =3D virResctrlMonGetID(def->resmons[i]->mon); if (!id) { virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Cannot remove resource monitoring group: " "error in get monitoring group name")); goto error; diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index eef31eb..8b736da 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1321,6 +1321,17 @@ typedef int int *nparams, unsigned int flags); =20 +typedef int +(*virDrvDomainSetCPUResmon)(virDomainPtr domain, + const char *vcpustr, + const char *monid, + int action, + unsigned int flags); + +typedef char * +(*virDrvDomainGetCPUResmonSts)(virDomainPtr domain, + const char *monid); + =20 typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; @@ -1572,6 +1583,8 @@ struct _virHypervisorDriver { virDrvConnectBaselineHypervisorCPU connectBaselineHypervisorCPU; virDrvNodeGetSEVInfo nodeGetSEVInfo; virDrvDomainGetLaunchSecurityInfo domainGetLaunchSecurityInfo; + virDrvDomainSetCPUResmon domainSetCPUResmon; + virDrvDomainGetCPUResmonSts domainGetCPUResmonSts; }; =20 =20 diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index ab7266d..8b080fc 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11488,6 +11488,11 @@ virConnectGetDomainCapabilities(virConnectPtr conn, * long long. It is produced by the * emulation_faults perf event * + * VIR_DOMAIN_STATS_CPURES + * "cpu.cacheoccupancy" - the usage of l3 cache (bytes) by applicatio= ns + * running on the platform as unsigned long long. It is + * retrieved from resctrl file system. + * * Note that entire stats groups or individual stat fields may be missing = from * the output in case they are not supported by the given hypervisor, are = not * applicable for the current state of the guest domain, or their retrieval @@ -12220,3 +12225,94 @@ int virDomainGetLaunchSecurityInfo(virDomainPtr do= main, virDispatchError(domain->conn); return -1; } + + +/** + * virDomainSetCPUResmon: + * @domain : a domain object + * @vcpustr: string specifying vcpus list + * @mongroup: mon group id + * @action : action to be performed + * 1 for enabling a rdt monitroing group + * 2 for disabling a rdt monitroing group + * not valid for others + * @flags : bitwise-OR of virDomainModificationImpact + * + * Enable or disable resctrl monitoring. + * + * Returns -1 in case of failure, 0 in case of success. + */ +int +virDomainSetCPUResmon(virDomainPtr domain, + const char *vcpustr, + const char *mongroup, + int action, + unsigned int flags) +{ + int ret; + virConnectPtr conn; + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + + conn =3D domain->conn; + + if (conn->driver->domainSetCPUResmon) { + ret =3D conn->driver->domainSetCPUResmon( + domain, + vcpustr, + mongroup, + action, + flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(domain->conn); + return -1; +} + + +/** + * virDomainGetCPUResmonSts: + * @domain: a domain object + * @mongroup: mon group id + * @status: pointer of a string buffer for holding resctrl mon + * group status string, caller is responsible for free it. + * + * Get domain resctrl status. + * + * Returns -1 in case of failure, 0 in case of success. + */ +int +virDomainGetCPUResmonSts(virDomainPtr domain, + const char *mongroup, + char **status) +{ + /* *allstatus*, the magic string for retrieving all domain's status */ + const char *monid =3D mongroup ? mongroup : "*allstatus*"; + virConnectPtr conn; + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + + conn =3D domain->conn; + + if (conn->driver->domainGetCPUResmonSts) { + *status =3D conn->driver->domainGetCPUResmonSts(domain, monid); + if (*status) + return 0; + + goto error; + } + + virReportUnsupportedError(); + error: + virDispatchError(domain->conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index d4cdbd8..0b75146 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -809,4 +809,10 @@ LIBVIRT_4.5.0 { virNWFilterBindingGetFilterName; } LIBVIRT_4.4.0; =20 +LIBVIRT_4.6.0 { + global: + virDomainSetCPUResmon; + virDomainGetCPUResmonSts; +} LIBVIRT_4.5.0; + # .... define new API here using predicted next version number .... --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121533149218.45912179223808; Mon, 9 Jul 2018 00:32:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC28B308FB89; Mon, 9 Jul 2018 07:32:11 +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 ADFCB3001A49; Mon, 9 Jul 2018 07:32:11 +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 60D9B3FCC3; Mon, 9 Jul 2018 07:32:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697W9Eq015295 for ; Mon, 9 Jul 2018 03:32:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2478C308BDAE; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B5D0308BDAC for ; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 E27AE37E87 for ; Mon, 9 Jul 2018 07:32:02 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:02 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734013" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:53 +0800 Message-Id: <1531119658-18549-6-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:03 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 05/10] qemu: enable resctrl monitoring at booting stage 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 09 Jul 2018 07:32:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" fetching resctrl monitoring group settings from def->resmons and createing resctrl group accodring to cachetune element status. This patch relies on the function of resctrl of util. --- src/qemu/qemu_process.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 40d35cb..eb0778d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2444,10 +2444,12 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver, { int ret =3D -1; size_t i =3D 0; + size_t j =3D 0; virCapsPtr caps =3D NULL; + virResctrlAllocPtr alloc =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; =20 - if (!vm->def->ncachetunes) + if (!vm->def->ncachetunes && !vm->def->nresmons) return 0; =20 /* Force capability refresh since resctrl info can change @@ -2463,6 +2465,29 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver, goto cleanup; } =20 + for (i =3D 0; i < vm->def->nresmons; i++) { + alloc =3D NULL; + for (j =3D 0; j < vm->def->ncachetunes; j++) { + const char *monid + =3D virResctrlMonGetID(vm->def->resmons[i]->mon); + const char *allocid + =3D virResctrlAllocGetID(vm->def->cachetunes[j]->alloc); + if (STREQ(monid, allocid) && + (virBitmapEqual(vm->def->resmons[i]->vcpus, + vm->def->cachetunes[j]->vcpus))) { + alloc =3D vm->def->cachetunes[j]->alloc; + break; + } + + } + + if (virResctrlMonCreate( + alloc, + vm->def->resmons[i]->mon, + priv->machineName) < 0) + goto cleanup; + } + ret =3D 0; cleanup: virObjectUnref(caps); @@ -5272,6 +5297,16 @@ qemuProcessSetupVcpu(virDomainObjPtr vm, } } =20 + for (i =3D 0; i < vm->def->nresmons; i++) { + virDomainCpuResmonDefPtr rt =3D vm->def->resmons[i]; + + if (virBitmapIsBitSet(rt->vcpus, vcpuid)) { + if (virResctrlMonAddPID(rt->mon, vcpupid) < 0) + return -1; + break; + } + } + return 0; } =20 @@ -6960,11 +6995,13 @@ void qemuProcessStop(virQEMUDriverPtr driver, vm->def->name); } =20 - /* Remove resctrl allocation after cgroups are cleaned up which makes = it - * kind of safer (although removing the allocation should work even wi= th - * pids in tasks file */ + /* Remove resctrl allocation and monitoring group after cgroups are cl= eaned + * up which makes it kind of safer (although removing the allocation s= hould + * work even with pids in tasks file */ for (i =3D 0; i < vm->def->ncachetunes; i++) virResctrlAllocRemove(vm->def->cachetunes[i]->alloc); + for (i =3D 0; i < vm->def->nresmons; i++) + virResctrlMonRemove(vm->def->resmons[i]->mon); =20 qemuProcessRemoveDomainStatus(driver, vm); =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121549796684.0500907187419; Mon, 9 Jul 2018 00:32:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5191155E0; Mon, 9 Jul 2018 07:32:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E4E586F1F; Mon, 9 Jul 2018 07:32:27 +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 4758C1800B70; Mon, 9 Jul 2018 07:32:27 +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 w697WAat015316 for ; Mon, 9 Jul 2018 03:32:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id BBF324145; Mon, 9 Jul 2018 07:32:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B07B9413D for ; Mon, 9 Jul 2018 07:32:08 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 F0D7F4E900 for ; Mon, 9 Jul 2018 07:32:07 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:07 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:02 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734019" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:54 +0800 Message-Id: <1531119658-18549-7-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:08 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 06/10] remote: add remote protocol for resctrl monitoring 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Function includes setting and getting the status of resource monitoring group. --- src/remote/remote_daemon_dispatch.c | 45 +++++++++++++++++++++++++++++++++= ++++ src/remote/remote_driver.c | 4 +++- src/remote/remote_protocol.x | 31 ++++++++++++++++++++++++- src/remote_protocol-structs | 16 +++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 4a93f09..fbec052 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7213,3 +7213,48 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPt= r errors, } return -1; } + +static int remoteDispatchDomainGetCPUResmonSts( + virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_cpu_resmon_sts_args *args, + remote_domain_get_cpu_resmon_sts_ret *ret) +{ + int rv =3D -1; + virDomainPtr dom =3D NULL; + char *sts =3D NULL; + char **sts_p =3D NULL; + struct daemonClientPrivate *priv =3D + virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + goto cleanup; + } + + if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + goto cleanup; + + if ((rv =3D virDomainGetCPUResmonSts(dom, args->monid, &sts)) < 0) + goto cleanup; + + if (VIR_ALLOC(sts_p) < 0) + goto cleanup; + + if (VIR_STRDUP(*sts_p, sts) < 0) + goto cleanup; + + ret->sts =3D sts_p; + rv =3D 0; + + cleanup: + if (rv < 0) { + virNetMessageSaveError(rerr); + VIR_FREE(sts_p); + } + virObjectUnref(dom); + VIR_FREE(sts); + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 1d94c2e..3a83df6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8536,7 +8536,9 @@ static virHypervisorDriver hypervisor_driver =3D { .connectCompareHypervisorCPU =3D remoteConnectCompareHypervisorCPU, /*= 4.4.0 */ .connectBaselineHypervisorCPU =3D remoteConnectBaselineHypervisorCPU, = /* 4.4.0 */ .nodeGetSEVInfo =3D remoteNodeGetSEVInfo, /* 4.5.0 */ - .domainGetLaunchSecurityInfo =3D remoteDomainGetLaunchSecurityInfo /* = 4.5.0 */ + .domainGetLaunchSecurityInfo =3D remoteDomainGetLaunchSecurityInfo, /*= 4.5.0 */ + .domainSetCPUResmon =3D remoteDomainSetCPUResmon, /* 4.5.0 */ + .domainGetCPUResmonSts =3D remoteDomainGetCPUResmonSts, /* 4.6.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 28c8feb..fbf88a0 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3557,6 +3557,23 @@ struct remote_connect_list_all_nwfilter_bindings_ret= { /* insert@1 */ unsigned int ret; }; =20 +struct remote_domain_set_cpu_resmon_args { + remote_nonnull_domain dom; + remote_string vcpustr; + remote_string monid; + int action; + unsigned int flags; +}; + +struct remote_domain_get_cpu_resmon_sts_args { + remote_nonnull_domain dom; + remote_nonnull_string monid; +}; + +struct remote_domain_get_cpu_resmon_sts_ret { /* insert@1 */ + remote_string sts; +}; + /*----- Protocol. -----*/ =20 /* Define the program number, protocol version and procedure numbers here.= */ @@ -6312,5 +6329,17 @@ enum remote_procedure { * @acl: connect:search_nwfilter_bindings * @aclfilter: nwfilter_binding:getattr */ - REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401 + REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401, + + /** + * @generate: both + * @acl: domain:write + */ + REMOTE_PROC_DOMAIN_SET_CPU_RESMON =3D 402, + + /** + * @generate: client + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_CPU_RESMON_STS =3D 403 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 6343e14..ddbab04 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2966,6 +2966,20 @@ struct remote_connect_list_all_nwfilter_bindings_ret= { } bindings; u_int ret; }; +struct remote_domain_set_cpu_resmon_args { + remote_nonnull_domain dom; + remote_string vcpustr; + remote_string monid; + int action; + unsigned int flags; +}; +struct remote_domain_get_cpu_resmon_sts_args { + remote_nonnull_domain dom; + remote_nonnull_string monid; +}; +struct remote_domain_get_cpu_resmon_sts_ret { + remote_string sts; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3368,4 +3382,6 @@ enum remote_procedure { REMOTE_PROC_NWFILTER_BINDING_CREATE_XML =3D 399, REMOTE_PROC_NWFILTER_BINDING_DELETE =3D 400, REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401, + REMOTE_PROC_DOMAIN_SET_CPU_RESMON =3D 402, + REMOTE_PROC_DOMAIN_GET_CPU_RESMON_STS =3D 403, }; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121544159497.6782286903706; Mon, 9 Jul 2018 00:32:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D179C307D869; Mon, 9 Jul 2018 07:32:22 +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 9E0D6600CD; Mon, 9 Jul 2018 07:32:22 +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 49B333F646; Mon, 9 Jul 2018 07:32:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.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 w697W9eE015303 for ; Mon, 9 Jul 2018 03:32:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id EF79A30012C2; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E88BD3001A45 for ; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 E59764E916 for ; Mon, 9 Jul 2018 07:32:08 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:07 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:04 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734027" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:55 +0800 Message-Id: <1531119658-18549-8-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 07/10] qemu: add interfaces for dynamically manupulating resctl mon groups 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 09 Jul 2018 07:32:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add interfaces for resource monitoring group - query monitoring group status - dynamically create monitoring group - dynamically destory monitoring group --- src/qemu/qemu_driver.c | 252 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 252 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9a35e04..647d864 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21607,6 +21607,256 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr doma= in, return ret; } =20 + +static int +qemuDomainSetCPUResmon(virDomainPtr dom, + const char *vcpumap, + const char *monid, + int action, + unsigned int flags) +{ + virDomainDefPtr def; + virDomainDefPtr persistentDef; + virQEMUDriverPtr driver =3D dom->conn->privateData; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); + virDomainObjPtr vm =3D NULL; + virBitmapPtr vcpus =3D NULL; + qemuDomainObjPrivatePtr priv =3D NULL; + unsigned int maxvcpus =3D 0; + size_t i =3D 0; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (action !=3D 1 && action !=3D 2) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("unsupported action.")); + return ret; + } + + if (!(vm =3D qemuDomObjFromDomain(dom))) + return ret; + + if (vcpumap) { + if (virBitmapParse(vcpumap, &vcpus, QEMU_GUEST_VCPU_MAX_ID) < 0 || + virBitmapLastSetBit(vcpus) < 0) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("no vcpus selected for modification")); + goto cleanup; + } + } + + if (!vcpus) { + if (!monid) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("bad resource monitoring group ID")); + goto cleanup; + } + + for (i =3D 0; i < vm->def->nresmons; i++) { + const char *id =3D virResctrlMonGetID(vm->def->resmons[i]->mon); + if (id && STREQ(monid, id)) { + vcpus =3D virBitmapNewCopy(vm->def->resmons[i]->vcpus); + break; + } + } + + if (!vcpus) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("bad resource monitoring group ID")); + goto cleanup; + } + } + + priv =3D vm->privateData; + + if (virDomainSetCPUResmonEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto endjob; + + if (action =3D=3D 2) { + /* action =3D=3D 'DESTROY' */ + + if (def) { + virResctrlMonPtr mon =3D virDomainCpuResmonDefRemove(def, moni= d); + if (!mon) + goto endjob; + + /* if allocation group exists, there is no way + * to disable it */ + virResctrlAllocPtr alloc =3D virResctrlMonGetAlloc(mon); + if (!alloc) { + if (virResctrlMonRemove(mon) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error in remove rdt mon group.")); + goto endjob; + } + } + + virObjectUnref(mon); + } + + if (persistentDef) { + virResctrlMonPtr monpersist =3D + virDomainCpuResmonDefRemove(persistentDef, monid); + if (!monpersist) + goto endjob; + + virObjectUnref(monpersist); + } + } + + if (action =3D=3D 1) { + /* action =3D=3D 'CREATE' */ + + if (def) { + virResctrlAllocPtr alloc =3D NULL; + if (!virDomainCpuResmonDefValidate(def, + monid, + vcpus, + &alloc)) { + virReportError(VIR_ERR_INVALID_ARG, + "%s", + _("error in create resource monitoring " + "group vcpus or group name conflicts " + "with domain settings")); + goto endjob; + } + + virDomainCpuResmonDefPtr resmon =3D + virDomainCpuResmonDefAdd(def, vcpus, monid); + + if (!resmon) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot create set rdt monitoring for " + "live configuration.")); + goto endjob; + } + + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, + vm, driver->caps) < 0) + goto endjob; + + if (!virResctrlMonIsRunning(resmon->mon)) { + if (virResctrlMonCreate(alloc, + resmon->mon, + priv->machineName) < 0) + goto endjob; + + maxvcpus =3D virDomainDefGetVcpusMax(vm->def); + for (i =3D 0; i < maxvcpus; i++) { + virDomainVcpuDefPtr vcpu + =3D virDomainDefGetVcpu(vm->def, i); + + if (!vcpu->online) + continue; + + if (virBitmapIsBitSet(resmon->vcpus, i)) { + pid_t vcpupid =3D qemuDomainGetVcpuPid(vm, i); + if (virResctrlMonAddPID(resmon->mon, vcpupid) < 0) + goto endjob; + } + } + } + } + + if (persistentDef) { + if (!virDomainCpuResmonDefValidate(persistentDef, + monid, vcpus, + NULL)) { + virReportError(VIR_ERR_INVALID_ARG, + "%s", + _("Error in creating resource monitoring " + "group: vcpus or group name conflicts " + "with domain settings")); + goto endjob; + } + + if (!virDomainCpuResmonDefAdd(persistentDef, + vcpus, + monid)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot create set resource monitoring gr= oup " + "for domain persistent configuration")); + goto endjob; + } + + if (virDomainSaveConfig(cfg->configDir, driver->caps, + persistentDef) < 0) + goto endjob; + } + } + + ret =3D 0; + endjob: + qemuDomainObjEndJob(driver, vm); + + cleanup: + virBitmapFree(vcpus); + virDomainObjEndAPI(&vm); + virObjectUnref(cfg); + return ret; +} + +static char * +qemuDomainGetCPUResmonSts(virDomainPtr dom, const char *monid) +{ + virDomainObjPtr vm =3D NULL; + virDomainCpuResmonDefPtr resmon =3D NULL; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + char *bufstr =3D NULL; + char *sts =3D NULL; + size_t i =3D 0; + bool listallstatus =3D false; + + /* "*allstatus*" is the magic string for getting all existing + * mon group status */ + if (STREQ(monid, "*allstatus*")) + listallstatus =3D true; + + if (virAsprintf(&sts, "no group found") < 0) + goto cleanup; + + if (!(vm =3D qemuDomObjFromDomain(dom))) + return sts; + + if (virDomainGetCPUResmonStsEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + for (i =3D 0; i < vm->def->nresmons; i++) { + resmon =3D vm->def->resmons[i]; + const char *id =3D virResctrlMonGetID(resmon->mon); + if (!id) + goto cleanup; + + if (!listallstatus && STRNEQ(monid, id)) + continue; + + if (virResctrlMonIsRunning(resmon->mon)) + virBufferStrcat(&buf, "group name: ", id, ";", NULL); + } + + bufstr =3D virBufferContentAndReset(&buf); + + if (bufstr) { + VIR_FREE(sts); + if (VIR_STRDUP(sts, bufstr) < 0) + goto cleanup; + VIR_FREE(bufstr); + } + + cleanup: + virBufferFreeAndReset(&buf); + virDomainObjEndAPI(&vm); + return sts; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -21832,6 +22082,8 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .connectBaselineHypervisorCPU =3D qemuConnectBaselineHypervisorCPU, /*= 4.4.0 */ .nodeGetSEVInfo =3D qemuNodeGetSEVInfo, /* 4.5.0 */ .domainGetLaunchSecurityInfo =3D qemuDomainGetLaunchSecurityInfo, /* 4= .5.0 */ + .domainSetCPUResmon =3D qemuDomainSetCPUResmon, /* 4.6.0 */ + .domainGetCPUResmonSts =3D qemuDomainGetCPUResmonSts, /* 4.6.0 */ }; =20 =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121554703620.90270372758; Mon, 9 Jul 2018 00:32:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 469FD30832EE; Mon, 9 Jul 2018 07:32:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E45BC600CD; Mon, 9 Jul 2018 07:32:32 +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 8E08F1800B6B; Mon, 9 Jul 2018 07:32:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697WCGY015334 for ; Mon, 9 Jul 2018 03:32:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B8FF100194B; Mon, 9 Jul 2018 07:32:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23C251001949 for ; Mon, 9 Jul 2018 07:32:10 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 1B28F3DE42 for ; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:07 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:06 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734032" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:56 +0800 Message-Id: <1531119658-18549-9-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 08/10] tool: add command cpuresource to interact with cpu resources 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A tool to create, destroy and query resource monitoring group lively. --- tools/virsh-domain.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 139 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e9b88f0..6aa674e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7677,6 +7677,139 @@ cmdIOThreadDel(vshControl *ctl, const vshCmd *cmd) return ret; } =20 +static const vshCmdInfo info_cpuresource[] =3D { + {.name =3D "help", + .data =3D N_("get or set hardware CPU RDT monitoring group") + }, + {.name =3D "desc", + .data =3D N_("Create or destroy CPU resource monitoring group.\n" + " To get current CPU resource monitoring group status: " + " virsh # cpuresource [domain]") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_cpurescource[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL(0), + {.name =3D "group_name", + .type =3D VSH_OT_ALIAS, + .help =3D "group-name" + }, + {.name =3D "group-name", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, + .help =3D N_("group name to manipulate") + }, + {.name =3D "vcpulist", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, + .help =3D N_("ids of vcpus to manipulate") + }, + {.name =3D "create", + .type =3D VSH_OT_BOOL, + .help =3D N_("Create CPU resctrl monitoring group for functions such = as " + "monitoring cache occupancy"), + }, + {.name =3D "destroy", + .type =3D VSH_OT_BOOL, + .help =3D N_("Destroy CPU resctrl monitoring group") + }, + VIRSH_COMMON_OPT_LIVE(N_("modify/get running state")), + VIRSH_COMMON_OPT_CONFIG(N_("modify/get persistent configuration")), + VIRSH_COMMON_OPT_DOMAIN_CURRENT, + {.name =3D NULL} +}; + + +static bool +cmdCpuResource(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + bool ret =3D false; + char *status =3D NULL; + int action =3D 0; + bool config =3D vshCommandOptBool(cmd, "config"); + bool live =3D vshCommandOptBool(cmd, "live"); + bool enable =3D vshCommandOptBool(cmd, "create"); + bool disable =3D vshCommandOptBool(cmd, "destroy"); + bool current =3D vshCommandOptBool(cmd, "current"); + const char *vcpustr =3D NULL; + const char *group_name =3D NULL; + unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; + char **tok =3D NULL; + size_t ntok =3D 0; + size_t i =3D 0; + int maxvcpus =3D 0; + + VSH_EXCLUSIVE_OPTIONS_VAR(enable, disable); + + VSH_EXCLUSIVE_OPTIONS_VAR(current, live); + VSH_EXCLUSIVE_OPTIONS_VAR(current, config); + + VSH_REQUIRE_OPTION("disable", "group-name"); + + if (config) + flags |=3D VIR_DOMAIN_AFFECT_CONFIG; + if (live) + flags |=3D VIR_DOMAIN_AFFECT_LIVE; + + if (vshCommandOptStringReq(ctl, cmd, "group-name", &group_name)) + return false; + + if (vshCommandOptStringReq(ctl, cmd, "vcpulist", &vcpustr)) + return false; + + if (enable && !vcpustr && !group_name) { + vshError(ctl, _("Option --create requires at least one " + "of the options --group-name or --vcpulist")); + return false; + } + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (!enable && !disable) { + if (virDomainGetCPUResmonSts(dom, group_name, &status) < 0) + goto cleanup; + + if (!status) + goto cleanup; + + maxvcpus =3D virDomainGetMaxVcpus(dom); + if (maxvcpus =3D=3D -1) + goto cleanup; + + if (!(tok =3D virStringSplitCount(status, ";", maxvcpus + 1, &ntok= ))) + goto cleanup; + + if (ntok > maxvcpus) + ntok =3D maxvcpus; + + vshPrint(ctl, "CPU Resource Monitoring Group Status: \n"); + + for (i =3D 0; i < ntok; i++) + vshPrint(ctl, " %s\n", tok[i]); + } else { + if (disable) + action =3D 2; + if (enable) + action =3D 1; + + if (virDomainSetCPUResmon(dom, vcpustr, group_name, action, flags)= < 0) + goto cleanup; + + if (!status) + goto cleanup; + } + + ret =3D true; + cleanup: + VIR_FREE(status); + virStringListFree(tok); + virshDomainFree(dom); + return ret; +} + /* * "cpu-stats" command */ @@ -13726,6 +13859,12 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_attach_device, .flags =3D 0 }, + {.name =3D "cpu-resource", + .handler =3D cmdCpuResource, + .opts =3D opts_cpurescource, + .info =3D info_cpuresource, + .flags =3D 0 + }, {.name =3D "attach-disk", .handler =3D cmdAttachDisk, .opts =3D opts_attach_disk, --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531121544561101.84024202902424; Mon, 9 Jul 2018 00:32:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20A1E30820E6; Mon, 9 Jul 2018 07:32:23 +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 E48445D6B4; Mon, 9 Jul 2018 07:32:22 +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 98B493F64F; Mon, 9 Jul 2018 07:32:22 +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 w697WBGU015323 for ; Mon, 9 Jul 2018 03:32:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0AF7D413D; Mon, 9 Jul 2018 07:32:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01B915DD73 for ; Mon, 9 Jul 2018 07:32:10 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 9F26730832C2 for ; Mon, 9 Jul 2018 07:32:09 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:09 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:08 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734039" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:57 +0800 Message-Id: <1531119658-18549-10-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:09 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 09/10] tools: show cpu cache occupancy information in domstats 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 09 Jul 2018 07:32:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" add cache occupancy information in command virsh domstats for domains has resource monitoring groups. --- include/libvirt/libvirt-domain.h | 1 + src/qemu/qemu_driver.c | 105 +++++++++++++++++++++++++++++++++++= ++++ tools/virsh-domain-monitor.c | 7 +++ 3 files changed, 113 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index c703346..c7ee425 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2041,6 +2041,7 @@ typedef enum { VIR_DOMAIN_STATS_INTERFACE =3D (1 << 4), /* return domain interfaces i= nfo */ VIR_DOMAIN_STATS_BLOCK =3D (1 << 5), /* return domain block info */ VIR_DOMAIN_STATS_PERF =3D (1 << 6), /* return domain perf event info */ + VIR_DOMAIN_STATS_CPU_RES =3D (1<<7), /* return CPU resource info */ } virDomainStatsTypes; =20 typedef enum { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 647d864..9b6e3fe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20330,6 +20330,110 @@ qemuDomainGetStatsPerf(virQEMUDriverPtr driver AT= TRIBUTE_UNUSED, return ret; } =20 + +static int +qemuDomainGetStatsCPUResmon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, + virDomainObjPtr vm, + virDomainStatsRecordPtr record, + int *maxparams, + unsigned int privflags ATTRIBUTE_UNUSED) +{ + char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; + size_t i =3D 0; + size_t l =3D 0; + unsigned int llc_occu =3D 0; + int ret =3D -1; + char *vcpustr =3D NULL; + + for (i =3D 0; i < vm->def->nresmons; i++) { + virDomainCpuResmonDefPtr resmon =3D vm->def->resmons[i]; + + llc_occu =3D 0; + if (virResctrlMonIsRunning(resmon->mon)) { + if (virResctrlMonGetCacheOccupancy(resmon->mon, &llc_occu) < 0) + goto cleanup; + } + + const char *mon_id =3D virResctrlMonGetID(resmon->mon); + if (!mon_id) + goto cleanup; + if (!(vcpustr =3D virBitmapFormat(resmon->vcpus))) + goto cleanup; + + /* for vcpu string, both '1-3' and '1,3' are valid format and + * representing different vcpu set. But it is not easy to + * differentiate them at first galance, to avoid this case + * substituting all '-' with ',', e.g. substitute '1-3' with + * '1,2,3' */ + for (l =3D 0; l < strlen(vcpustr); l++) { + if (vcpustr[l] =3D=3D '-') { + char strbuf[256]; + unsigned int cpul =3D 0; + unsigned int cpur =3D 0; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + unsigned int icpu =3D 0; + char *tmp =3D NULL; + + /* virStrToLong_ui is very tricking in processing '-'. to + * avoid to trigger error, replace '-' with '_' */ + vcpustr[l] =3D '_'; + + if (virStrToLong_ui(vcpustr, &tmp, 10, &cpul) < 0) + goto cleanup; + if (virStrToLong_ui(vcpustr + l + 1, &tmp, 10, &cpur) < 0) + goto cleanup; + if (cpur < cpul) + goto cleanup; + + for (icpu =3D cpul; icpu <=3D cpur; icpu++) { + snprintf(strbuf, 256, "%d", icpu); + virBufferStrcat(&buf, strbuf, NULL); + if (icpu !=3D cpur) + virBufferStrcat(&buf, ",", NULL); + } + + VIR_FREE(vcpustr); + vcpustr =3D virBufferContentAndReset(&buf); + + break; + } + } + + snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "cpu.cacheoccupancy.%s.value", + mon_id); + + if (virTypedParamsAddInt(&record->params, + &record->nparams, + maxparams, + param_name, + llc_occu) < 0) { + goto cleanup; + } + + snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, + "cpu.cacheoccupancy.%s.vcpus", + mon_id); + + if (virTypedParamsAddString(&record->params, + &record->nparams, + maxparams, + param_name, + vcpustr) < 0) { + goto cleanup; + } + + VIR_FREE(vcpustr); + vcpustr =3D NULL; + } + + ret =3D 0; + cleanup: + VIR_FREE(vcpustr); + return ret; +} + + typedef int (*qemuDomainGetStatsFunc)(virQEMUDriverPtr driver, virDomainObjPtr dom, @@ -20351,6 +20455,7 @@ static struct qemuDomainGetStatsWorker qemuDomainGe= tStatsWorkers[] =3D { { qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false }, { qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true }, { qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false }, + { qemuDomainGetStatsCPUResmon, VIR_DOMAIN_STATS_CPU_RES, false }, { NULL, 0, false } }; =20 diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 87660ee..5f65f3d 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -2099,6 +2099,10 @@ static const vshCmdOptDef opts_domstats[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("report only stats that are accessible instantly"), }, + {.name =3D "cpu-resource", + .type =3D VSH_OT_BOOL, + .help =3D N_("report cpu resource information"), + }, VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("list of domains to get stats for")= , 0), {.name =3D NULL} }; @@ -2164,6 +2168,9 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "perf")) stats |=3D VIR_DOMAIN_STATS_PERF; =20 + if (vshCommandOptBool(cmd, "cpu-resource")) + stats |=3D VIR_DOMAIN_STATS_CPU_RES; + if (vshCommandOptBool(cmd, "list-active")) flags |=3D VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE; =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 18:12:55 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153112155016459.949937679329764; Mon, 9 Jul 2018 00:32:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4DAB5D68A; Mon, 9 Jul 2018 07:32:28 +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 A64D12015E41; Mon, 9 Jul 2018 07:32:28 +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 4BA8A264F0; Mon, 9 Jul 2018 07:32:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w697WFmi015355 for ; Mon, 9 Jul 2018 03:32:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D9D71798D; Mon, 9 Jul 2018 07:32:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02F4A183C0 for ; Mon, 9 Jul 2018 07:32:12 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 381A530832C2 for ; Mon, 9 Jul 2018 07:32:11 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 00:32:11 -0700 Received: from david-unc.bj.intel.com ([10.238.145.77]) by fmsmga004.fm.intel.com with ESMTP; 09 Jul 2018 00:32:09 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,329,1526367600"; d="scan'208";a="69734046" From: Wang Huaqiang To: libvir-list@redhat.com Date: Mon, 9 Jul 2018 15:00:58 +0800 Message-Id: <1531119658-18549-11-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> References: <1531119658-18549-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 09 Jul 2018 07:32:11 +0000 (UTC) for IP:'192.55.52.88' DOMAIN:'mga01.intel.com' HELO:'mga01.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 192.55.52.88 mga01.intel.com 192.55.52.88 mga01.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: shaohe.feng@intel.com, Wang Huaqiang , bing.niu@intel.com, jian-feng.ding@intel.com, rui.zang@intel.com Subject: [libvirt] [PATCHv2 10/10] news: add Intel x86 RDT CMT feature 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 09 Jul 2018 07:32:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 773c95b..d406e51 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -44,6 +44,16 @@ support should be available to the guest. + + + Add support for Intel x86 RDT CMT(Cache Monitoring Technology) + + + Report domain cache occupancy information based on vcpu groups. + Add a live command 'cpu-resource' for creating, destroying and + reporing the CPU resource monitoring group status. + +
--=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list