From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224032; cv=none; d=zoho.com; s=zohoarc; b=bZOT6IuGm2iomNL/IQCER24IdngG1A1i/VGyVPZJLQdk2E4H52Q0v926t21vEta2mo/DFFZMIGHTrXZdf0Dl6OTMzCiMnD7gMvpW4sN1S8zr/eW+ATu2+Q3Y8hiosH6C0mlhaF0jp5G1xmNUVSJpuuPSi31b0IajxyRVYHsAqe8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224032; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jP81zUbYDVD/ZGISPiaA2MQ1t17uWkZUTAOLPLJ9Ky4=; b=Vfq/shbiA/jiuL4omEHeBPl0E8hMVmUYaJbDvMuVF0ULJRdWb8u8wunn72Gvc2m1j2wIefLUMBRk4pxUyxvDqZU0MrUkdNog6jYQfp7iKArbGWhk8H7LM0XhrBvLkXTqureuPM9HzGY4VQU6k+ecSDr4CC1359SAF5i52yJ9sPI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224032212207.14594309184235; Mon, 10 Jun 2019 20:33:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0426D307D91F; Tue, 11 Jun 2019 03:33:48 +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 F2C8A5C226; Tue, 11 Jun 2019 03:33:46 +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 BC1E2C589; Tue, 11 Jun 2019 03:33:45 +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 x5B3XivA022152 for ; Mon, 10 Jun 2019 23:33:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C4811001DD1; Tue, 11 Jun 2019 03:33:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07EAF1001DCC for ; Tue, 11 Jun 2019 03:33:41 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 A567086658 for ; Tue, 11 Jun 2019 03:33:39 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:38 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:06 +0800 Message-Id: <1560223876-28816-2-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:39 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 01/11] util, conf: Handle default monitor group of an allocation properly 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 'default monitor of an allocation' is defined as the resctrl monitor group that created along with an resctrl allocation, which is created by resctrl file system. If the monitor group specified in domain configuration file is happened to be a default monitor group of an allocation, then it is not necessary to create monitor group since it is already created. But if an monitor group is not an allocation default group, you should create the group under folder '/sys/fs/resctrl/mon_groups' and fill the vcpu PIDs to 'tasks' file. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 + src/qemu/qemu_process.c | 3 ++- src/util/virresctrl.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9099757..b95f958 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2756,6 +2756,7 @@ virResctrlAllocForeachMemory; virResctrlAllocFormat; virResctrlAllocGetID; virResctrlAllocGetUnused; +virResctrlAllocIsEmpty; virResctrlAllocNew; virResctrlAllocRemove; virResctrlAllocSetCacheSize; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9046677..ed3b94c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5561,7 +5561,8 @@ qemuProcessSetupVcpu(virDomainObjPtr vm, for (j =3D 0; j < ct->nmonitors; j++) { mon =3D ct->monitors[j]; =20 - if (virBitmapEqual(ct->vcpus, mon->vcpus)) + if (virBitmapEqual(ct->vcpus, mon->vcpus) && + !virResctrlAllocIsEmpty(ct->alloc)) continue; =20 if (virBitmapIsBitSet(mon->vcpus, vcpuid)) { diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 90532cf..fb66ea3 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2560,7 +2560,8 @@ virResctrlMonitorDeterminePath(virResctrlMonitorPtr m= onitor, return -1; } =20 - if (STREQ_NULLABLE(monitor->id, monitor->alloc->id)) { + if (!virResctrlAllocIsEmpty(monitor->alloc) && + STREQ_NULLABLE(monitor->id, monitor->alloc->id)) { if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0) return -1; return 0; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224067; cv=none; d=zoho.com; s=zohoarc; b=D8TppFZ9A7WfJwra/IqAecyi4Mt35dBYdzbJ5cg37Ni9lyw66iBpKnLdKXTxF/JCdSVfmGvkcVshZaEMEHHJlt69d8HXGmytRcKz1unktfRbi5u6adEiUTiGV0KFDtlQp8P1LcAZEFxMbsxknFgzOhppG+qZ2G4Jfql1zdQvoCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=y+Ji2cBCvd4cgCte1CNfOicQvJLNCtVXNFnU5T4HoOE=; b=R9lvWG7OVMsCKgQ+/HFaMdE6NpOAoAWc73Ex9Oh6mSmeeQ3yRsoYdQL53WfQB01mbJGJwtqt3BwoL/Nk2RLVBY4YBF88LwSUy2Ebaammk0IoMrRDOUxCQrA4lMrFAPDgt2AIPNjx/uOs6oIjOVjfGnc2GgIHR9HDcc8VPAUOq6s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224067898405.30102640801977; Mon, 10 Jun 2019 20:34:27 -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 297FE81127; Tue, 11 Jun 2019 03:34:26 +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 F34B51001DE3; Tue, 11 Jun 2019 03:34:25 +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 AF0B81806B1B; Tue, 11 Jun 2019 03:34:25 +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 x5B3XjcM022169 for ; Mon, 10 Jun 2019 23:33:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C6AA5C226; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67E455C219 for ; Tue, 11 Jun 2019 03:33:43 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 B851C307D91F for ; Tue, 11 Jun 2019 03:33:39 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:39 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:07 +0800 Message-Id: <1560223876-28816-3-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:39 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 02/11] conf: code cleanup, remove empty line and one space 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.27]); Tue, 11 Jun 2019 03:34:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Remove some redundant space and line. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a3a5141..e3c8aa0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19519,7 +19519,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, VIR_AUTOPTR(virBitmap) vcpus =3D NULL; VIR_AUTOFREE(xmlNodePtr *) nodes =3D NULL; VIR_AUTOUNREF(virResctrlAllocPtr) alloc =3D NULL; - ssize_t i =3D 0; int n; int ret =3D -1; @@ -27395,7 +27394,7 @@ virDomainCachetuneDefFormat(virBufferPtr buf, &childrenBuf) < 0) goto cleanup; =20 - for (i =3D 0; i < resctrl->nmonitors; i ++) { + for (i =3D 0; i < resctrl->nmonitors; i++) { if (virDomainResctrlMonDefFormatHelper(resctrl->monitors[i], VIR_RESCTRL_MONITOR_TYPE_CA= CHE, &childrenBuf) < 0) --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224068; cv=none; d=zoho.com; s=zohoarc; b=DfC6N278e05SQXcHuBjEt5YTi2xOTq01tB2mbhKMoRjF5SikmDPEytIckrQx1gsjA3HM708Yj1rpw9DpE/u/OfW62EyJxCwnnYV7yoQwMCTneav+5S1NJEy7VuIEwmts/mfMwJBr+vWkn9vihA3D075oDv4yiatp5VVH6y7tzXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224068; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BG+6g4s4RqoqO0kGMVPy+xdnzOoCvJd15PfH0UkeWLc=; b=MZVxY9IyhBORtarHKmxNjGdVRk1p0gp1hqwbrrITILFfl4XLh6/8dN4xMTI4sXeEksDXd/frL03upnliQrepr2NImFPTJE+NqOWfLo0P01w72yPdXMv+1TXWSR67BedmB2h5trw/apfr8V4SXqXBKguG1h3FX56lLHmzKl9daIc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224068518495.3706358352405; Mon, 10 Jun 2019 20:34:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 498437FDE9; Tue, 11 Jun 2019 03:34:26 +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 2322A18B84; Tue, 11 Jun 2019 03:34:26 +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 CDF9A1806B1A; Tue, 11 Jun 2019 03:34:25 +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 x5B3Xjrn022157 for ; Mon, 10 Jun 2019 23:33:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 38E566061B; Tue, 11 Jun 2019 03:33:45 +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 3329E60A9F for ; Tue, 11 Jun 2019 03:33:43 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 C064F2F8BEE for ; Tue, 11 Jun 2019 03:33:40 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:40 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:39 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:08 +0800 Message-Id: <1560223876-28816-4-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 11 Jun 2019 03:33:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 11 Jun 2019 03:33:41 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 03/11] conf: code cleanup for return error code directly X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 11 Jun 2019 03:34:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" code cleanup for 'virDomainCachetuneDefParse' and 'virDomainMemorytuneDefParse'. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e3c8aa0..db25c1f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19321,40 +19321,38 @@ virDomainCachetuneDefParse(virDomainDefPtr def, ctxt->node =3D node; =20 if (virDomainResctrlParseVcpus(def, node, &vcpus) < 0) - goto cleanup; + return -1; =20 - if (virBitmapIsAllClear(vcpus)) { - ret =3D 0; - goto cleanup; - } + if (virBitmapIsAllClear(vcpus)) + return 0; =20 if ((n =3D virXPathNodeSet("./cache", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot extract cache nodes under cachetune")); - goto cleanup; + return -1; } =20 if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0) - goto cleanup; + return -1; =20 if (!alloc) { alloc =3D virResctrlAllocNew(); if (!alloc) - goto cleanup; + return -1; } else { virReportError(VIR_ERR_XML_ERROR, "%s", _("Identical vcpus in cachetunes found")); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) - goto cleanup; + return -1; } =20 resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags); if (!resctrl) - goto cleanup; + return -1; =20 if (virDomainResctrlMonDefParse(def, ctxt, node, VIR_RESCTRL_MONITOR_TYPE_CACHE, @@ -19527,37 +19525,35 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, ctxt->node =3D node; =20 if (virDomainResctrlParseVcpus(def, node, &vcpus) < 0) - goto cleanup; + return -1; =20 - if (virBitmapIsAllClear(vcpus)) { - ret =3D 0; - goto cleanup; - } + if (virBitmapIsAllClear(vcpus)) + return 0; =20 if ((n =3D virXPathNodeSet("./node", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot extract memory nodes under memorytune")); - goto cleanup; + return -1; } =20 if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0) - goto cleanup; + return -1; =20 if (!alloc) { alloc =3D virResctrlAllocNew(); if (!alloc) - goto cleanup; + return -1; new_alloc =3D true; } =20 for (i =3D 0; i < n; i++) { if (virDomainMemorytuneDefParseMemory(ctxt, nodes[i], alloc) < 0) - goto cleanup; - } - if (virResctrlAllocIsEmpty(alloc)) { - ret =3D 0; - goto cleanup; + return -1; } + + if (virResctrlAllocIsEmpty(alloc)) + return 0; + /* * If this is a new allocation, format ID and append to resctrl, other= wise * just update the existing alloc information, which is done in above @@ -19565,7 +19561,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, if (new_alloc) { resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags); if (!resctrl) - goto cleanup; + return -1; =20 if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) goto cleanup; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224078; cv=none; d=zoho.com; s=zohoarc; b=J/znmWiv3F9s4t7XJRCU0f7uX0wEJ9DhocNmhg2ooMMXRO2CyTPhfH3/vog8kcAarCQfV3MCwyB671XasffxPZJevupqcKiyhZcI2s21d13C/pXL3VPRmqA5L4HhWmNXOgIEXd1cX8HCXoQ38Co+UruuQwmCK7t/0w7BVUKMYr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224078; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=N3XxS5zCameP711Lu+q4LMAOlVCaQpp2PYwUFqmkuzc=; b=WNxjCnj5eVTT5ZByOKETD/sHr8julnuSrq8+97wqWVwi9qDB3H8olDthdecWUYk0s4M9wR+WU6F5M+dZtHuQhdYrhzYSe3E1z42XOFh+c6llmUUxT+WrigOZAv8CEIXk+w34IPdMpWucKphMZotKKavvQh3KNyZjkP83UCAzK7c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224078111982.8888619090048; Mon, 10 Jun 2019 20:34:38 -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 7F6A07FDF5; Tue, 11 Jun 2019 03:34:36 +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 562C15D720; Tue, 11 Jun 2019 03:34:36 +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 18653206D6; Tue, 11 Jun 2019 03:34:36 +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 x5B3Xj2T022158 for ; Mon, 10 Jun 2019 23:33:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B1D96062A; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33AE160603 for ; Tue, 11 Jun 2019 03:33:42 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 CBD8687622 for ; Tue, 11 Jun 2019 03:33:41 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:41 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:40 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:09 +0800 Message-Id: <1560223876-28816-5-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:42 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 04/11] conf: some code cleanup 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.27]); Tue, 11 Jun 2019 03:34:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Creating object and judging if it is successfully created in fewer lines. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index db25c1f..e4a6dfb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19336,8 +19336,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, return -1; =20 if (!alloc) { - alloc =3D virResctrlAllocNew(); - if (!alloc) + if (!(alloc =3D virResctrlAllocNew())) return -1; } else { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -19350,8 +19349,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, return -1; } =20 - resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags); - if (!resctrl) + if (!(resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags))) return -1; =20 if (virDomainResctrlMonDefParse(def, ctxt, node, @@ -19540,8 +19538,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, return -1; =20 if (!alloc) { - alloc =3D virResctrlAllocNew(); - if (!alloc) + if (!(alloc =3D virResctrlAllocNew())) return -1; new_alloc =3D true; } @@ -19559,8 +19556,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, * just update the existing alloc information, which is done in above * virDomainMemorytuneDefParseMemory */ if (new_alloc) { - resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags); - if (!resctrl) + if (!(resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags))) return -1; =20 if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224083; cv=none; d=zoho.com; s=zohoarc; b=HCjpPbL2+0DFOVJznK2s1w70r03efDuu5NjQQPt2Qy1ygGeQLs/FXl5+oyUmMVWXkRjYiyFZ0mJcF3n148llZ1vXuUxCVHpwc3f+XrJxcefQaplLY9HaeZtByC12PXmLq4qplk+wA+VqSAg2XW5tytGQjzxFnPj27cxXWVi0XWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=O8U33AO5k7slbETkp0ccfmkME/F6vQF/GneUwSyaAaM=; b=oiSpeyx+VSEzVoZZhS59OTdubntBfP/3NYjP7ouqPE5rfpM20PefewhJOHqZ5k+txUBRGPFyT12Wjho2mqJPSU8frczs1/GFcIoosodXwIOViyayM4K2LEQpqHnhv0Naq2vltGkYPIxc/tEA3gYwn9hXiT0PMXD9woMdXnIlL0A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224083336230.95787220849422; Mon, 10 Jun 2019 20:34:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A51332F8BF7; Tue, 11 Jun 2019 03:34:41 +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 820205C64A; Tue, 11 Jun 2019 03:34:41 +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 44C7C1806B1B; Tue, 11 Jun 2019 03:34:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5B3XkeU022183 for ; Mon, 10 Jun 2019 23:33:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2AC4C5D705; Tue, 11 Jun 2019 03:33:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 262FD5D6A9 for ; Tue, 11 Jun 2019 03:33:43 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 05D34883BA for ; Tue, 11 Jun 2019 03:33:43 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:42 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:10 +0800 Message-Id: <1560223876-28816-6-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:43 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 05/11] conf: refactor 'virDomainResctrlVcpuMatch' and some code cleanup 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 11 Jun 2019 03:34:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Let 'virDomainResctrlVcpuMatch' to retrieve a pointer of virDomainResctrlDefPtr in its third parameter instead of virResctrlAllocPtr, if @vcpus is matched with the vcpus of some resctrl allocation in list of @def->resctrls. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e4a6dfb..ca2dba9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18992,7 +18992,7 @@ virDomainResctrlParseVcpus(virDomainDefPtr def, static int virDomainResctrlVcpuMatch(virDomainDefPtr def, virBitmapPtr vcpus, - virResctrlAllocPtr *alloc) + virDomainResctrlDefPtr *resctrl) { ssize_t i =3D 0; =20 @@ -19001,7 +19001,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def, * Just updating memory allocation information of that group */ if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) { - *alloc =3D virObjectRef(def->resctrls[i]->alloc); + *resctrl =3D def->resctrls[i]; break; } if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) { @@ -19332,18 +19332,18 @@ virDomainCachetuneDefParse(virDomainDefPtr def, return -1; } =20 - if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0) + if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0) return -1; =20 - if (!alloc) { - if (!(alloc =3D virResctrlAllocNew())) - return -1; - } else { + if (resctrl) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Identical vcpus in cachetunes found")); return -1; } =20 + if (!(alloc =3D virResctrlAllocNew())) + return -1; + for (i =3D 0; i < n; i++) { if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) return -1; @@ -19518,7 +19518,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, ssize_t i =3D 0; int n; int ret =3D -1; - bool new_alloc =3D false; =20 ctxt->node =3D node; =20 @@ -19534,13 +19533,14 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, return -1; } =20 - if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0) + if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0) return -1; =20 - if (!alloc) { + if (resctrl) { + alloc =3D virObjectRef(resctrl->alloc); + } else { if (!(alloc =3D virResctrlAllocNew())) return -1; - new_alloc =3D true; } =20 for (i =3D 0; i < n; i++) { @@ -19555,7 +19555,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, * If this is a new allocation, format ID and append to resctrl, other= wise * just update the existing alloc information, which is done in above * virDomainMemorytuneDefParseMemory */ - if (new_alloc) { + if (!resctrl) { if (!(resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags))) return -1; =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224087; cv=none; d=zoho.com; s=zohoarc; b=heOPiFfrZsEFiokzQFgApIylr5EG2KqOVYjLqpTwhfayFa1e3nNxYSz/UahPMg4YoEAnjbEQOg7Vccth4zz/Ch/WUFtM4Zupr2lO/4Oasc7ppstTSS3e+8HhcIr4xhNHPJRYS7CzU4PskmYU4ZII13WVTo4sJf/4LjXrx+H/BHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224087; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vv6eVRD1xzWgHeD4SNmOxor+pfEiEMvUKeM3F0sslqw=; b=c1OnArNBm4VDhEdkVOHq8PY2yWB4o/sW5o0rBZKbc9VulgyAJ0UMGU8f9VIdY5jDJ9+WMYsWTLEuGomJSc4F+pMOztPJQsaKjh1z10z/psb8ZD23PYycHhQ5NxZ48fZYBP3zcYBR4N25Aknu2Aocg5wDbW7T3BRyyIUdOwCQvas= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224087319110.37907168235381; Mon, 10 Jun 2019 20:34:47 -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 7FF20C0578FA; Tue, 11 Jun 2019 03:34:45 +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 2DB951001DEE; Tue, 11 Jun 2019 03:34:45 +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 C327B206D8; Tue, 11 Jun 2019 03:34:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5B3Xk5S022188 for ; Mon, 10 Jun 2019 23:33:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A66060C05; Tue, 11 Jun 2019 03:33:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8577460BF1 for ; Tue, 11 Jun 2019 03:33:44 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 B04C987633 for ; Tue, 11 Jun 2019 03:33:43 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:43 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:42 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:11 +0800 Message-Id: <1560223876-28816-7-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Jun 2019 03:33:43 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 06/11] conf: Append 'resctrl' object according to number of monitor group directly 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.31]); Tue, 11 Jun 2019 03:34:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 'virResctrlAllocIsEmpty' checks if cache allocation or memory bandwidth allocation settings are specified in configuration file. It is not proper to be used in checking memory bandwidth allocation is specified in XML settings because this function could not distinguish memory bandwidth allocations from cache allocations. Here using the local variable @n, which indicates the cache allocation groups or memory bandwidth groups depending on the context it is in, to decide if append a new @resctrl object. If @n is zero and no monitors groups specified in XML, then we should not append a new @resctrl object to @def->resctrls. This kind of replacement is also more efficient and avoiding a long function calling path. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ca2dba9..676a2ac 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19359,7 +19359,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def, =20 /* If no element or element in , do not * append any resctrl element */ - if (!resctrl->nmonitors && virResctrlAllocIsEmpty(alloc)) { + if (!resctrl->nmonitors && n =3D=3D 0) { ret =3D 0; goto cleanup; } @@ -19548,7 +19548,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, return -1; } =20 - if (virResctrlAllocIsEmpty(alloc)) + if (n =3D=3D 0) return 0; =20 /* --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224076; cv=none; d=zoho.com; s=zohoarc; b=Rnu1w76SCaR+YnIVJShL7AN/gPB1855tgw5IKcT+G96WL9feS2QaO41Q8/LU6ETL3DfK8K/E0ENcfU+iVCgSmfpGfkTpO7LRn0PhNjDBlwki+Eq8OFupAoso439Js88CGtsTHzh4Gy1PMqO9/QbHg8YYJA2J58R8/E9JzUxHIz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224076; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=MKW8CL0mRbkWS2rgpx+J75t3IXK8djd0zRs8COkKbWE=; b=VnzfJaHhJ3IqfX+C8XU9whDFoSqC+wjCN9KFc+NVZaHYgYj3DU+dOfGXVZi+Ll00D3kmwoKp5aBKaNzmH52iaOb67vxjFKDGGvz1E937crFlmM1MCoZz2vZVY6tcW+kZIRaKBd15lYmU5aC0v1AZz3+v1H+PZ+jFsiwtskVtsdM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224076556769.3379033769212; Mon, 10 Jun 2019 20:34:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C03D83001824; Tue, 11 Jun 2019 03:34:34 +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 8B3FB19C70; Tue, 11 Jun 2019 03:34:34 +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 2E4F3206D3; Tue, 11 Jun 2019 03:34:34 +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 x5B3Xjps022178 for ; Mon, 10 Jun 2019 23:33:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6FF91001DD1; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AFCE81001DCC for ; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 156D5307D90D for ; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:44 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:43 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:12 +0800 Message-Id: <1560223876-28816-8-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:45 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 07/11] util: Refactor and rename 'virResctrlMonitorFreeStats' 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 11 Jun 2019 03:34:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Refactor and rename 'virResctrlMonitorFreeStats' to 'virResctrlMonitorStatsFree' to free one 'virResctrlMonitorStatsPtr' object. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 2 +- src/qemu/qemu_driver.c | 6 +++++- src/util/virresctrl.c | 14 ++++---------- src/util/virresctrl.h | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b95f958..1d949b3 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2769,13 +2769,13 @@ virResctrlInfoNew; virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; -virResctrlMonitorFreeStats; virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; virResctrlMonitorNew; virResctrlMonitorRemove; virResctrlMonitorSetAlloc; virResctrlMonitorSetID; +virResctrlMonitorStatsFree; =20 =20 # util/virrotatingfile.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 42b1ce2..85fbe21 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19977,9 +19977,13 @@ struct _virQEMUResctrlMonData { static void qemuDomainFreeResctrlMonData(virQEMUResctrlMonDataPtr resdata) { + size_t i =3D 0; + VIR_FREE(resdata->name); VIR_FREE(resdata->vcpus); - virResctrlMonitorFreeStats(resdata->stats, resdata->nstats); + for (i =3D 0; i < resdata->nstats; i++) + virResctrlMonitorStatsFree(resdata->stats[i]); + VIR_FREE(resdata->stats); VIR_FREE(resdata); } =20 diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index fb66ea3..af0e5c0 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2765,25 +2765,19 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr moni= tor, cleanup: VIR_FREE(datapath); VIR_FREE(filepath); - VIR_FREE(stat); + virResctrlMonitorStatsFree(stat); VIR_DIR_CLOSE(dirp); return ret; } =20 =20 void -virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats, - size_t nstats) +virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stat) { - size_t i =3D 0; - - if (!stats) + if (!stat) return; =20 - for (i =3D 0; i < nstats; i++) - VIR_FREE(stats[i]); - - VIR_FREE(stats); + VIR_FREE(stat); } =20 =20 diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index abdeb59..d46e533 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -233,6 +233,6 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr= monitor, size_t *nstats); =20 void -virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats, - size_t nstats); +virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stats); + #endif /* LIBVIRT_VIRRESCTRL_H */ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224040; cv=none; d=zoho.com; s=zohoarc; b=LhguV7BB+6r157EW2kKm4CH2k4luKb4yAUMYY9SyJqf8riJknHWkBQfhCek8jjC3weSPnONo1zqrbmb2uZi2Uq0QDY730vTXd9ZIhDHQYrucva0qFqmat/UBT2/OIAaL0Cj4vHoK9LqTuNxBNc6d1C5VSSJHitwvzF0ZlqlZ/Cc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224040; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SNKK23V2XkxaHabKDcu6H2pJeS8Cv+CyYOHsahXgWwc=; b=fBl4zW8pE3gAjwNHUasehCtX/xQ/zvQCnX0fz6tG0VJwStPNNMaDENQXP7SmV5ThT98AJhqS20/9iXcHxTV2uaZc8lbFuLWlHuJ2Ys1g24mdWRGFDQDlDEHDaIy3D8mM/EhuxTQZ3W+vizLCONzK+pzhqIfgA0Vv50B0ECHZY/I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224040914634.3836901876813; Mon, 10 Jun 2019 20:34:00 -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 7D8BB308A953; Tue, 11 Jun 2019 03:33:54 +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 475FC1001DD1; Tue, 11 Jun 2019 03:33:54 +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 F2DB3206D4; Tue, 11 Jun 2019 03:33:53 +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 x5B3XrMX022236 for ; Mon, 10 Jun 2019 23:33:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 26AD7608E4; Tue, 11 Jun 2019 03:33:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 214F260A9F for ; Tue, 11 Jun 2019 03:33:53 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 C8F01307D90D for ; Tue, 11 Jun 2019 03:33:45 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:45 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:44 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:13 +0800 Message-Id: <1560223876-28816-9-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 11 Jun 2019 03:33:46 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 08/11] util: Refactor 'virResctrlMonitorStats' 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.41]); Tue, 11 Jun 2019 03:33:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Refactor 'virResctrlMonitorStats' to track multiple statistical records. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 2 +- src/util/virresctrl.c | 11 ++++++++++- src/util/virresctrl.h | 12 ++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 85fbe21..6b7d3ea 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20123,7 +20123,7 @@ qemuDomainGetStatsCpuCache(virDomainObjPtr dom, "cpu.cache.monitor.%zu.bank.%zu.bytes", i, j); if (virTypedParamsAddUInt(&record->params, &record->nparams, maxparams, param_name, - resdata[i]->stats[j]->val) < 0) + resdata[i]->stats[j]->vals[0]) < 0) goto cleanup; } } diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index af0e5c0..0117b8f 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2687,6 +2687,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monito= r, { int rv =3D -1; int ret =3D -1; + unsigned int val =3D 0; DIR *dirp =3D NULL; char *datapath =3D NULL; char *filepath =3D NULL; @@ -2743,7 +2744,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monito= r, if (virStrToLong_uip(node_id, NULL, 0, &stat->id) < 0) goto cleanup; =20 - rv =3D virFileReadValueUint(&stat->val, "%s/%s/%s", datapath, + rv =3D virFileReadValueUint(&val, "%s/%s/%s", datapath, ent->d_name, resource); if (rv =3D=3D -2) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2753,6 +2754,12 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monit= or, if (rv < 0) goto cleanup; =20 + if (VIR_APPEND_ELEMENT(stat->vals, stat->nvals, val) < 0) + goto cleanup; + + if (virStringListAdd(&stat->features, resource) < 0) + goto cleanup; + if (VIR_APPEND_ELEMENT(*stats, *nstats, stat) < 0) goto cleanup; } @@ -2777,6 +2784,8 @@ virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr = stat) if (!stat) return; =20 + virStringListFree(stat->features); + VIR_FREE(stat->vals); VIR_FREE(stat); } =20 diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index d46e533..4dabb9c 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -194,8 +194,16 @@ typedef virResctrlMonitor *virResctrlMonitorPtr; typedef struct _virResctrlMonitorStats virResctrlMonitorStats; typedef virResctrlMonitorStats *virResctrlMonitorStatsPtr; struct _virResctrlMonitorStats { - unsigned int id; - unsigned int val; + /* The system assigned cache ID associated with statistical record */ + unsigned int id; + /* @features is a NULL terminal string list tracking the statistical r= ecord + * name.*/ + char **features; + /* @vals store the statistical record values and @val[0] is the value = for + * @features[0], @val[1] for@features[1] ... respectively */ + unsigned int *vals; + /* The length of @vals array */ + size_t nvals; }; =20 virResctrlMonitorPtr --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224092; cv=none; d=zoho.com; s=zohoarc; b=T3BKvm9O0sX7pV/BNKhjG70kFwdWsphvtb5punQ2Ri+w6o/CQuwl2W3jaPNQLS3OYhFtGIi6CrHHtagtzzdKpoCS8ER5A2WY9U1Ux0wyrkp4E1sD3276DxsNYvyx7/xCUmz2uy7w/LF1ter+Irk+SRUho5qGa4YJflFIC9HbGrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224092; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mjfpvUV7tThPfr2ULI00Qqi1HCgMudmNN8/RqRcKO14=; b=FPq9LX8RzoqgFgsxS5oLzUETcm3QKr/mkXA5KznBHupbeB62LtC2Ps8d2LEdBt0HZNSU/CL0HFlfnHqdQTLruqq0uE4ttRmCgcPykrq9Rv/gAD7i3a1WFwpePtXc6ocmzC43hYSGkWFGmqRjoBx/uTJfaKFaPiWNDjsDNj50WnQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560224092366627.927728935581; Mon, 10 Jun 2019 20:34:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 566BF3082E25; Tue, 11 Jun 2019 03:34:50 +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 2284F6062A; Tue, 11 Jun 2019 03:34:50 +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 CA69C1806B1B; Tue, 11 Jun 2019 03:34:49 +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 x5B3Xm6q022213 for ; Mon, 10 Jun 2019 23:33:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1FE1C1001DD1; Tue, 11 Jun 2019 03:33:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1AE5D1001DCC for ; Tue, 11 Jun 2019 03:33:48 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 3FE4D308125C for ; Tue, 11 Jun 2019 03:33:47 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:46 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:45 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:14 +0800 Message-Id: <1560223876-28816-10-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 11 Jun 2019 03:33:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 11 Jun 2019 03:33:47 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 09/11] util: Extend virresctl API to retrieve multiple monitor statistics 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 11 Jun 2019 03:34:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Export virResctrlMonitorGetStats and make virResctrlMonitorGetCacheOccupancy obsoleted. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 33 +++++++++++++++++++++++++-------- src/util/virresctrl.c | 44 +++++++++++++++++++++++++------------------- src/util/virresctrl.h | 6 ++++++ 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1d949b3..3a4f526 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2771,6 +2771,7 @@ virResctrlMonitorCreate; virResctrlMonitorDeterminePath; virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; +virResctrlMonitorGetStats; virResctrlMonitorNew; virResctrlMonitorRemove; virResctrlMonitorSetAlloc; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6b7d3ea..300a5de 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19991,6 +19991,7 @@ qemuDomainFreeResctrlMonData(virQEMUResctrlMonDataP= tr resdata) /** * qemuDomainGetResctrlMonData: * @dom: Pointer for the domain that the resctrl monitors reside in + * @driver: Pointer to qemu driver * @resdata: Pointer of virQEMUResctrlMonDataPtr pointer for receiving the * virQEMUResctrlMonDataPtr array. Caller is responsible for * freeing the array. @@ -20008,16 +20009,32 @@ qemuDomainFreeResctrlMonData(virQEMUResctrlMonDat= aPtr resdata) * Returns -1 on failure, or 0 on success. */ static int -qemuDomainGetResctrlMonData(virDomainObjPtr dom, +qemuDomainGetResctrlMonData(virQEMUDriverPtr driver, + virDomainObjPtr dom, virQEMUResctrlMonDataPtr **resdata, size_t *nresdata, virResctrlMonitorType tag) { virDomainResctrlDefPtr resctrl =3D NULL; virQEMUResctrlMonDataPtr res =3D NULL; + char **features =3D NULL; + virCapsPtr caps =3D NULL; size_t i =3D 0; size_t j =3D 0; =20 + caps =3D virQEMUDriverGetCapabilities(driver, false); + + if (tag =3D=3D VIR_RESCTRL_MONITOR_TYPE_CACHE) { + features =3D caps->host.cache.monitor->features; + } else { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Unsupported resctrl monitor type")); + return -1; + } + + if (virStringListLength((const char * const *)features) =3D=3D 0) + return 0; + for (i =3D 0; i < dom->def->nresctrls; i++) { resctrl =3D dom->def->resctrls[i]; =20 @@ -20044,9 +20061,8 @@ qemuDomainGetResctrlMonData(virDomainObjPtr dom, if (VIR_STRDUP(res->name, virResctrlMonitorGetID(monitor)) < 0) goto error; =20 - if (virResctrlMonitorGetCacheOccupancy(monitor, - &res->stats, - &res->nstats) < 0) + if (virResctrlMonitorGetStats(monitor, (const char **)features, + &res->stats, &res->nstats) < 0) goto error; =20 if (VIR_APPEND_ELEMENT(*resdata, *nresdata, res) < 0) @@ -20063,7 +20079,8 @@ qemuDomainGetResctrlMonData(virDomainObjPtr dom, =20 =20 static int -qemuDomainGetStatsCpuCache(virDomainObjPtr dom, +qemuDomainGetStatsCpuCache(virQEMUDriverPtr driver, + virDomainObjPtr dom, virDomainStatsRecordPtr record, int *maxparams) { @@ -20077,7 +20094,7 @@ qemuDomainGetStatsCpuCache(virDomainObjPtr dom, if (!virDomainObjIsActive(dom)) return 0; =20 - if (qemuDomainGetResctrlMonData(dom, &resdata, &nresdata, + if (qemuDomainGetResctrlMonData(driver, dom, &resdata, &nresdata, VIR_RESCTRL_MONITOR_TYPE_CACHE) < 0) goto cleanup; =20 @@ -20178,7 +20195,7 @@ qemuDomainGetStatsCpuCgroup(virDomainObjPtr dom, =20 =20 static int -qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, +qemuDomainGetStatsCpu(virQEMUDriverPtr driver, virDomainObjPtr dom, virDomainStatsRecordPtr record, int *maxparams, @@ -20187,7 +20204,7 @@ qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRI= BUTE_UNUSED, if (qemuDomainGetStatsCpuCgroup(dom, record, maxparams) < 0) return -1; =20 - if (qemuDomainGetStatsCpuCache(dom, record, maxparams) < 0) + if (qemuDomainGetStatsCpuCache(driver, dom, record, maxparams) < 0) return -1; =20 return 0; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 0117b8f..80acb70 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2669,8 +2669,7 @@ virResctrlMonitorStatsSorter(const void *a, * virResctrlMonitorGetStats * * @monitor: The monitor that the statistic data will be retrieved from. - * @resource: The name for resource name. 'llc_occupancy' for cache resour= ce. - * "mbm_total_bytes" and "mbm_local_bytes" for memory bandwidth resource. + * @resources: A string list for the monitor feature names. * @stats: Pointer of of virResctrlMonitorStatsPtr array for holding cache= or * memory bandwidth usage data. * @nstats: A size_t pointer to hold the returned array length of @stats @@ -2679,14 +2678,15 @@ virResctrlMonitorStatsSorter(const void *a, * * Returns 0 on success, -1 on error. */ -static int +int virResctrlMonitorGetStats(virResctrlMonitorPtr monitor, - const char *resource, + const char **resources, virResctrlMonitorStatsPtr **stats, size_t *nstats) { int rv =3D -1; int ret =3D -1; + size_t i =3D 0; unsigned int val =3D 0; DIR *dirp =3D NULL; char *datapath =3D NULL; @@ -2744,21 +2744,23 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr moni= tor, if (virStrToLong_uip(node_id, NULL, 0, &stat->id) < 0) goto cleanup; =20 - rv =3D virFileReadValueUint(&val, "%s/%s/%s", datapath, - ent->d_name, resource); - if (rv =3D=3D -2) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("File '%s/%s/%s' does not exist."), - datapath, ent->d_name, resource); - } - if (rv < 0) - goto cleanup; + for (i =3D 0; resources[i]; i++) { + rv =3D virFileReadValueUint(&val, "%s/%s/%s", datapath, + ent->d_name, resources[i]); + if (rv =3D=3D -2) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("File '%s/%s/%s' does not exist."), + datapath, ent->d_name, resources[i]); + } + if (rv < 0) + goto cleanup; =20 - if (VIR_APPEND_ELEMENT(stat->vals, stat->nvals, val) < 0) - goto cleanup; + if (VIR_APPEND_ELEMENT(stat->vals, stat->nvals, val) < 0) + goto cleanup; =20 - if (virStringListAdd(&stat->features, resource) < 0) - goto cleanup; + if (virStringListAdd(&stat->features, resources[i]) < 0) + goto cleanup; + } =20 if (VIR_APPEND_ELEMENT(*stats, *nstats, stat) < 0) goto cleanup; @@ -2808,6 +2810,10 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitor= Ptr monitor, virResctrlMonitorStatsPtr **stats, size_t *nstats) { - return virResctrlMonitorGetStats(monitor, "llc_occupancy", - stats, nstats); + int ret =3D -1; + const char *features[2] =3D {"llc_occupancy", NULL}; + + ret =3D virResctrlMonitorGetStats(monitor, features, stats, nstats); + + return ret; } diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 4dabb9c..9ef51b7 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -236,6 +236,12 @@ int virResctrlMonitorRemove(virResctrlMonitorPtr monitor); =20 int +virResctrlMonitorGetStats(virResctrlMonitorPtr monitor, + const char **resources, + virResctrlMonitorStatsPtr **stats, + size_t *nstats); + +int virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, virResctrlMonitorStatsPtr **stats, size_t *nstats); --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224097; cv=none; d=zoho.com; s=zohoarc; b=TlBck2gYLX6s0FsI6q0UOMONOyhBVb3vK3qgQrSvYAxTwpqj+i9KUQIyqWYpXf480CdbYxc03STdg2b95n8Qy7yYE7Ffy00M7piGs+9WJK6Qf82I4Ah+SLYqshuZ0JZOS9PpwbAuhLpAFQI0yg7WcnE647epN/Yedi/9fcLmikU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224097; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lJ2OUIZtxmAzqIRdgc69zx9LrpCZJebDwJKgWQ/XqTc=; b=MYHIVIcY/NgT5GyZJ7lY+9OpvHWSfJkSAsulW3fF6V4bhLqJo+2Fnq5y4JrBasVl7Qf8K7fRQsPI6p7MchiAgmuocOwMfaVsqcl1Ud07h+Wu1m6J4z4lWfnTylIi1wBE6SoVnvMNiOQdfDjZWTtBiKyhi4akBz0q3HT1enLvpTA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15602240978805.943015490978496; Mon, 10 Jun 2019 20:34:57 -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 246CD309174E; Tue, 11 Jun 2019 03:34:56 +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 EC3891001DE3; Tue, 11 Jun 2019 03:34:55 +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 ABEB91806B1F; Tue, 11 Jun 2019 03:34:55 +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 x5B3Xuai022246 for ; Mon, 10 Jun 2019 23:33:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6D8775C231; Tue, 11 Jun 2019 03:33:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66B9E5C226 for ; Tue, 11 Jun 2019 03:33:55 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 1E8F0308125C for ; Tue, 11 Jun 2019 03:33:48 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:47 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:46 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:15 +0800 Message-Id: <1560223876-28816-11-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 11 Jun 2019 03:33:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 11 Jun 2019 03:33:48 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 10/11] util: Remove unused virResctrlMonitorGetCacheOccupancy 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.41]); Tue, 11 Jun 2019 03:34:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 - src/util/virresctrl.c | 27 --------------------------- src/util/virresctrl.h | 5 ----- 3 files changed, 33 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3a4f526..96de17e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2769,7 +2769,6 @@ virResctrlInfoNew; virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; -virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; virResctrlMonitorGetStats; virResctrlMonitorNew; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 80acb70..90b77e6 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2790,30 +2790,3 @@ virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr= stat) VIR_FREE(stat->vals); VIR_FREE(stat); } - - -/* - * virResctrlMonitorGetCacheOccupancy - * - * @monitor: The monitor that the statistic data will be retrieved from. - * @stats: Array of virResctrlMonitorStatsPtr for receiving cache occupancy - * data. Caller is responsible to free this array. - * @nstats: A size_t pointer to hold the returned array length of @caches - * - * Get cache or memory bandwidth utilization information. - * - * Returns 0 on success, -1 on error. - */ - -int -virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, - virResctrlMonitorStatsPtr **stats, - size_t *nstats) -{ - int ret =3D -1; - const char *features[2] =3D {"llc_occupancy", NULL}; - - ret =3D virResctrlMonitorGetStats(monitor, features, stats, nstats); - - return ret; -} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 9ef51b7..cdfe205 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -241,11 +241,6 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor, virResctrlMonitorStatsPtr **stats, size_t *nstats); =20 -int -virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor, - virResctrlMonitorStatsPtr **stats, - size_t *nstats); - void virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stats); =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 07:01:10 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 ARC-Seal: i=1; a=rsa-sha256; t=1560224069; cv=none; d=zoho.com; s=zohoarc; b=Fdck3JTnFb6sLVJgOD061adtx/CpKNZBUZ+3/0/QyxmhrOGedUoMvs8ZT8ZA2CeCiUCk3nD43JRyZVVa7xbm+aquMa4P0YLze2eApp87i4fY+yoMDXZYR/DZNLMJRmjA0ip7NxtnPUiybDNau/z5bBXsO+WdaGbRo2QG6gs87nU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560224069; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=j6YJcz99AhQt5A+z8F9vosacrMaYurNlyOzpcPYXEks=; b=GgyI/gYLt/oPJlO6g7cl13x2oPXo5FIvzokhkeA9XQVt0FP2QUKnPixN4dTOHYnRlpqenQjQdfz850p2UwikJ3w7CiTYhdUR+OM8tH6MNvj9YmGFyq9guXCc3MSioZ9qc/YAY5Uqoi/izoKEcQNoi1ECDO5iE/r2nsmWBQLmYjM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156022406991099.90513258381634; Mon, 10 Jun 2019 20:34:29 -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 2804830821F4; Tue, 11 Jun 2019 03:34:28 +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 F3CE52B32C; Tue, 11 Jun 2019 03:34: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 BDE821806B20; Tue, 11 Jun 2019 03:34: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 x5B3Xwev022256 for ; Mon, 10 Jun 2019 23:33:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF9C0426D; Tue, 11 Jun 2019 03:33:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA5F05DA2E for ; Tue, 11 Jun 2019 03:33:56 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 3976BC057EC6 for ; Tue, 11 Jun 2019 03:33:49 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 20:33:48 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga001.fm.intel.com with ESMTP; 10 Jun 2019 20:33:47 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 11:31:16 +0800 Message-Id: <1560223876-28816-12-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> References: <1560223876-28816-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 11 Jun 2019 03:33:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 11 Jun 2019 03:33:49 +0000 (UTC) for IP:'134.134.136.31' DOMAIN:'mga06.intel.com' HELO:'mga06.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 134.134.136.31 mga06.intel.com 134.134.136.31 mga06.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com, tao.su@intel.com Subject: [libvirt] [PATCHv2 11/11] conf: Refactor and rename the function to validate a new resctrl monitor 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.47]); Tue, 11 Jun 2019 03:34:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" A new algorithm for detecting the vcpus and monitor type conflicts between new monitor an existing allocation and monitor groups. After refactoring, since we are verifying both @vcpus and monitor type @tag at the same time, the validating function name has been renamed from virDomainResctrlMonValidateVcpus to virDomainResctrlValidateMonitor. Signed-off-by: Wang Huaqiang Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 62 +++++++++++++++++++++++++++++++---------------= ---- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 676a2ac..2af81c0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19085,29 +19085,32 @@ virDomainCachetuneDefParseCache(xmlXPathContextPt= r ctxt, } =20 =20 -/* Checking if the monitor's vcpus is conflicted with existing allocation - * and monitors. +/* Checking if the monitor's vcpus and tag is conflicted with existing + * allocation and monitors. * - * Returns 1 if @vcpus equals to @resctrl->vcpus, then the monitor will - * share the underlying resctrl group with @resctrl->alloc. Returns - 1 - * if any conflict found. Returns 0 if no conflict and @vcpus is not equal - * to @resctrl->vcpus. + * Returns 1 if @monitor->vcpus equals to @resctrl->vcpus, then the monitor + * will share the underlying resctrl group with @resctrl->alloc. Returns -1 + * if any conflict found. Returns 0 if no conflict and @monitor->vcpus is + * not equal to @resctrl->vcpus. */ static int -virDomainResctrlMonValidateVcpus(virDomainResctrlDefPtr resctrl, - virBitmapPtr vcpus) +virDomainResctrlValidateMonitor(virDomainResctrlDefPtr resctrl, + virDomainResctrlMonDefPtr monitor) { size_t i =3D 0; int vcpu =3D -1; - size_t mons_same_alloc_vcpus =3D 0; + bool vcpus_overlap_any =3D false; + bool vcpus_equal_to_resctrl =3D false; + bool vcpus_overlap_no_resctrl =3D false; + bool default_alloc_monitor =3D virResctrlAllocIsEmpty(resctrl->alloc); =20 - if (virBitmapIsAllClear(vcpus)) { + if (virBitmapIsAllClear(monitor->vcpus)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("vcpus is empty")); return -1; } =20 - while ((vcpu =3D virBitmapNextSetBit(vcpus, vcpu)) >=3D 0) { + while ((vcpu =3D virBitmapNextSetBit(monitor->vcpus, vcpu)) >=3D 0) { if (!virBitmapIsBitSet(resctrl->vcpus, vcpu)) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Monitor vcpus conflicts with allocation")); @@ -19115,29 +19118,40 @@ virDomainResctrlMonValidateVcpus(virDomainResctrl= DefPtr resctrl, } } =20 - if (virBitmapEqual(vcpus, resctrl->vcpus)) - return 1; + vcpus_equal_to_resctrl =3D virBitmapEqual(monitor->vcpus, resctrl->vcp= us); =20 for (i =3D 0; i < resctrl->nmonitors; i++) { - if (virBitmapEqual(resctrl->vcpus, resctrl->monitors[i]->vcpus)) { - mons_same_alloc_vcpus++; - continue; + if (virBitmapEqual(monitor->vcpus, resctrl->monitors[i]->vcpus)) { + if (monitor->tag !=3D resctrl->monitors[i]->tag) { + continue; + } else { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Identical vcpus found in same type monit= ors")); + return -1; + } } =20 - if (virBitmapOverlaps(vcpus, resctrl->monitors[i]->vcpus)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Monitor vcpus conflicts with monitors")); + if (virBitmapOverlaps(monitor->vcpus, resctrl->monitors[i]->vcpus)) + vcpus_overlap_any =3D true; =20 - return -1; - } + if (vcpus_equal_to_resctrl || + virBitmapEqual(resctrl->monitors[i]->vcpus, resctrl->vcpus)) + continue; + + if (virBitmapOverlaps(monitor->vcpus, resctrl->monitors[i]->vcpus)) + vcpus_overlap_no_resctrl =3D true; } =20 - if (mons_same_alloc_vcpus > 1) { + if (vcpus_overlap_no_resctrl || + (default_alloc_monitor && vcpus_overlap_any)) { virReportError(VIR_ERR_INVALID_ARG, "%s", - _("Too many monitors have the same vcpu as allocati= on")); + _("vcpus overlaps in resctrl groups")); return -1; } =20 + if (vcpus_equal_to_resctrl && !default_alloc_monitor) + return 1; + return 0; } =20 @@ -19211,7 +19225,7 @@ virDomainResctrlMonDefParse(virDomainDefPtr def, if (virDomainResctrlParseVcpus(def, nodes[i], &domresmon->vcpus) <= 0) goto cleanup; =20 - rv =3D virDomainResctrlMonValidateVcpus(resctrl, domresmon->vcpus); + rv =3D virDomainResctrlValidateMonitor(resctrl, domresmon); if (rv < 0) goto cleanup; =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list