From nobody Mon May 6 01:44:19 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=1558604266; cv=none; d=zoho.com; s=zohoarc; b=FwvKj3iz23xb8t0ZItasDkzaEK5mzfBK1MPCBXWjO06svdvAImII8IL3HPSJHWogvjKHfYb3Vyk7fgkiHi4tHppDcMvo2WO3Bx1KYR3KVe7+ehpGsdfSOdIfR/MqK2WpTGz5jiWQ3QCyEyYlrs9WcsIqjYxaQUGk6+CWV6vrGLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604266; 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=IJTm3mxe2kQvxb5u8xObm1q/katDuGBijtx3JyjgxI7CFAoV3ZOYpmXjQ+gsa0twO/+ZKqc7eUb4E54h5HnV5e/B7bJNeKQzKUuFUhd+ovI5+EZgnYAgG1iS8aQK0aQbzN630uS4kXMnjxGhJR1wvEITzaQjf0A42Luwd98OJFg= 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 1558604266334854.1635635300573; Thu, 23 May 2019 02:37:46 -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 D9FD881DEB; Thu, 23 May 2019 09:37:39 +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 A892B67E5F; Thu, 23 May 2019 09:37:39 +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 6E4291806B19; Thu, 23 May 2019 09:37:39 +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 x4N9apxD028415 for ; Thu, 23 May 2019 05:36:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30A1B5D707; Thu, 23 May 2019 09:36:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A0165B681 for ; Thu, 23 May 2019 09:36:48 +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 256C630C250E for ; Thu, 23 May 2019 09:36:35 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:22 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:20 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692906" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:12 +0800 Message-Id: <1558604060-30739-2-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.40]); Thu, 23 May 2019 09:36:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 23 May 2019 09:36:35 +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 (RCVD_IN_DNSWL_HI, SPF_HELO_NONE, 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.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 1/9] 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.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.25]); Thu, 23 May 2019 09:37:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Remove some redundant space and line. Signed-off-by: Wang Huaqiang --- 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 Mon May 6 01:44:19 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=1558604238; cv=none; d=zoho.com; s=zohoarc; b=gZ7w0pXqRb+NmxzjkafHmAw2y9G3YSy5B58SH1c8886qTHJPTzQHnL3ISb2SQZ7XU9HA+/zb4OVspPzEg43kVCHBOSJfV6uuBsZocOSVoOHjL2GXNLqTkmA2FIfZC8FLA1JlLXefOziODKme7+sTTI74OrcDc4jMH54bopeOIpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604238; 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=HCaeDlJ42/bwPCUiY/0AhGUYXVMem9dOV+TOsUU4I6+DCamvI5kC3FY9MgGQVDunT/TyUh/IAKPl04b3IEEg3w1dL2HKuNCaAtsehhIyC4vgovilGCY1ifB7iMfktVc6HRPxZjFV6RGP+CBfvFnlrLqBC8Q6pLhlFjoaz/BhQRE= 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 1558604238091644.9294872452547; Thu, 23 May 2019 02:37:18 -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 29166356FF; Thu, 23 May 2019 09:37:15 +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 619D367E6A; Thu, 23 May 2019 09:37:05 +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 EBF9A1806B13; Thu, 23 May 2019 09:36:53 +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 x4N9amPE028409 for ; Thu, 23 May 2019 05:36:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id E1E451001E63; Thu, 23 May 2019 09:36:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBC4C1001DE1 for ; Thu, 23 May 2019 09:36:46 +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 25C9F811DE for ; Thu, 23 May 2019 09:36:35 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:23 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:21 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692912" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:13 +0800 Message-Id: <1558604060-30739-3-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.27]); Thu, 23 May 2019 09:36:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 23 May 2019 09:36:37 +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: 0 (SPF_HELO_NONE, 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.27 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 2/9] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 May 2019 09:37:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" code cleanup for 'virDomainCachetuneDefParse' and 'virDomainMemorytuneDefParse'. Signed-off-by: Wang Huaqiang --- 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 Mon May 6 01:44:19 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=1558604290; cv=none; d=zoho.com; s=zohoarc; b=P0pN3iAZ9AJMtd7XMQZpl5IxjTj3uloTE82R1m2ElfpZJ64pakbaKpqB912QUvHA6Ai9DpPJWyDbVDje8d7bqXDvwkMW5jobm+eWvK2V4vXdd3O4JHVEJFF4Fiqo4hVACtfGwtGlMIIJlX9evqOELkGe8AfXYpdU+Z3PP+momsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604290; 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=GP3ELK+8g0Ukq2mIZMdeZZR4Be3fVTySi6/4L8W9Ow4=; b=Ov2Hy/QhDjU2yQLRyCDqigr/0tGzJhe+HksQTl/FQwCnmi/8r/M+Ac+1ODk/PVAy5dv+DjKGMwxtnkwQ13yV8JNVXAtFWAYCFjhuHoYLU/4iW7gnSuFe3cj97p2iXvoh86DoobTgFWgUG69InyCVf3mtpmrnnRTBZQyTRy+LFWk= 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 1558604290545135.79699863644964; Thu, 23 May 2019 02:38:10 -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 4ED943082B64; Thu, 23 May 2019 09:38:09 +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 1F5801001E6F; Thu, 23 May 2019 09:38:09 +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 C473E5B424; Thu, 23 May 2019 09:38:07 +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 x4N9axkq028505 for ; Thu, 23 May 2019 05:36:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 307645D707; Thu, 23 May 2019 09:36:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B74A5B681 for ; Thu, 23 May 2019 09:36: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 BB4D081F25 for ; Thu, 23 May 2019 09:36:46 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:23 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:22 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692928" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:14 +0800 Message-Id: <1558604060-30739-4-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.27]); Thu, 23 May 2019 09:36:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 23 May 2019 09:36:51 +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.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 3/9] conf: check if vcpus matches with any 'existing' allocaiton 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.45]); Thu, 23 May 2019 09:38:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In checking if vcpus matches with any exisitng resctrl allocation it should consider if the allocation exists or not. '@resctrl->alloc !=3D NULL' means an allocation exists. Signed-off-by: Wang Huaqiang --- src/conf/domain_conf.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index db25c1f..9c95467 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19088,10 +19088,9 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr= ctxt, /* Checking if the monitor's vcpus 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 @vcpus equals to vcpus of an existing resctrl allocation g= roup. + * Returns -1 if any conflict found. Returns 0 if no conflict and @vcpus is + * not equal to any created resctrl allocation. */ static int virDomainResctrlMonValidateVcpus(virDomainResctrlDefPtr resctrl, @@ -19115,7 +19114,7 @@ virDomainResctrlMonValidateVcpus(virDomainResctrlDe= fPtr resctrl, } } =20 - if (virBitmapEqual(vcpus, resctrl->vcpus)) + if (virBitmapEqual(vcpus, resctrl->vcpus) && resctrl->alloc !=3D NULL) return 1; =20 for (i =3D 0; i < resctrl->nmonitors; i++) { --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 01:44:19 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=1558604246; cv=none; d=zoho.com; s=zohoarc; b=U86El1RqoWmoVVKX8ZyE0HsegB2g5MS7yqHH/efnjReaybM2IgTROmxUoSmMxhUVEasevXCvOQjWUhoWpEitozi575AUbpMyD9tocJexKUcM9cCbhIpDA9cGo7Ibr2o3zXDP1E5eXcOKkI9Bla+/B6n/u0EvkQuQbGBR0w6X/g0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604246; 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=8g9eaS4++DJucfzgT9BvQwqRyvB3bgB4V1bQiTL6LKs=; b=Ry+xthr1WkcfQT52PpW0dkndbfgWzKV5B83rTa4O2wXeiT4dbUUvVhJM7codc2BIyVnzgHqniLBZK1wud08hebFkIk0m8PBAXP4/jZxNgv1iCioqbOmEQgg8CnllD1/WAt5t9SDRyY+g5TW/6DAuU6tVmqpeFbkX5cj7QiOLE/g= 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 1558604246070686.2128908925614; Thu, 23 May 2019 02:37:26 -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 6407E21BA4; Thu, 23 May 2019 09:37:19 +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 339D51001E6C; Thu, 23 May 2019 09:37: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 E6D8D5B423; Thu, 23 May 2019 09:37:13 +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 x4N9b69o028537 for ; Thu, 23 May 2019 05:37:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB2EC6606C; Thu, 23 May 2019 09:37:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E578B67E71 for ; Thu, 23 May 2019 09:37:04 +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 E55CE3001822 for ; Thu, 23 May 2019 09:36:48 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:28 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692942" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:15 +0800 Message-Id: <1558604060-30739-5-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.40]); Thu, 23 May 2019 09:36:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 23 May 2019 09:36:49 +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.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 4/9] conf: Replace 'virResctrlAllocIsEmpty' with @n==0 for indicating no resctrl allocation in configuration file 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.30]); Thu, 23 May 2019 09:37:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" @n denotes the number of element under element in function 'virDomainCachetuneDefParse' or the number of element under element in function virDomainMemorytuneDefParse'. Originally it is using 'virResctrlAllocIsEmpty' function to judge if no resctrl allocation defined in or element, this role could be replaced with checking if @n is zero or not. This replacement is more efficient and avoiding a long function calling path. Signed-off-by: Wang Huaqiang --- 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 9c95467..dcfd2dd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19360,7 +19360,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; } @@ -19550,7 +19550,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 Mon May 6 01:44:19 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=1558604299; cv=none; d=zoho.com; s=zohoarc; b=azihK0sbEyCSIs5F1s8We8YkrK8FWt7qDb7h/LI3hgKdUWbKG3UMlhRH4YnhNX3iYnVathMI1s+NtUt3sP9Z3yJA8RI67Z9WK51wgVBeXOSZiu0tSdiZO2eixpCjZw2iRaZdOvJ98zpwXdUSkDlbCvui9VaBoA9O0url3BPKrSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604299; 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=KuTMDBuUowOLUfgnOOfGlMxlT2SFmZlpojibyA3YN38=; b=Jke+ZnN9fOO7Bj9IWICNCyqWkdzY0dId2G/SkbS6Wzxi4PknFezoMB+cYJeAAHxFa/DtRfBn3Kai7td9b1vEu/S44LBB1Pn62twjN8hFEEhuKBBdOF9ICZzBsqk7TSwp0eovP4LkzVngWX1mFWlWPl656F0IlHUSUyqYE+r7/xs= 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 155860429924549.667135970166896; Thu, 23 May 2019 02:38:19 -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 1A5A7300270E; Thu, 23 May 2019 09:38:18 +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 E0F08679F1; Thu, 23 May 2019 09:38: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 9CA791806B16; Thu, 23 May 2019 09:38:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4N9b2cr028520 for ; Thu, 23 May 2019 05:37:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C1F0196A6; Thu, 23 May 2019 09:37:02 +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 167201969B for ; Thu, 23 May 2019 09:36: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 A2D4BA7DD for ; Thu, 23 May 2019 09:36:51 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:29 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:28 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692947" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:16 +0800 Message-Id: <1558604060-30739-6-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.29]); Thu, 23 May 2019 09:36:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 23 May 2019 09:36:51 +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.23 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 5/9] conf: refactor 'virDomainResctrlVcpuMatch' 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.46]); Thu, 23 May 2019 09:38:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Let 'virDomainResctrlVcpuMatch' return a pointer of @virDomainResctrlDefPtr in its third parameter. Signed-off-by: Wang Huaqiang --- src/conf/domain_conf.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dcfd2dd..b0f5d80 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)) { @@ -19331,19 +19331,19 @@ virDomainCachetuneDefParse(virDomainDefPtr def, return -1; } =20 - if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0) + if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0) return -1; =20 - if (!alloc) { - alloc =3D virResctrlAllocNew(); - if (!alloc) - return -1; - } else { + if (resctrl) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Identical vcpus in cachetunes found")); return -1; } =20 + alloc =3D virResctrlAllocNew(); + if (!alloc) + return -1; + for (i =3D 0; i < n; i++) { if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) return -1; @@ -19519,7 +19519,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 @@ -19535,14 +19534,18 @@ 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 && resctrl->alloc) { + alloc =3D virObjectRef(resctrl->alloc); + } else { alloc =3D virResctrlAllocNew(); - if (!alloc) - return -1; - new_alloc =3D true; + if (resctrl) { + alloc =3D virResctrlAllocNew(); + if (!alloc) + return -1; + } } =20 for (i =3D 0; i < n; i++) { @@ -19557,7 +19560,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) { resctrl =3D virDomainResctrlNew(node, alloc, vcpus, flags); if (!resctrl) return -1; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 01:44:19 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=1558604271; cv=none; d=zoho.com; s=zohoarc; b=SUvLHBcdTFcR3JZWlbon/hOF983ifMdfr4ipzxh0F5isZFHwfRdtOiPlZJIFPXcsfWw/q2QxQ/9I9heDSx3/uccl7OloTw/IFXAvIaAVoLSRhtDOLwLMKDV46X+A3KlbJ3piiuSLDmR2phkqQpd+g7mJvCxYrqzJduIWmCkHvv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604271; 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=AwuKSthY0zPmU3Hk3nqD55jA7yu3Xc9HHCrHCNo++bs=; b=KoN4MyMqHVTUKKHIzB5ariu8eCwUkvgkTTlmF4gXvX1oz1334WtJYqJ2rS9JO4qqNzWKD/Bu3juDBPpJKP22ANuim989IW98SwsCYo2WkEcb6OH4G97fKMTZBzxW8h37ellyjVv+aIGcD+oh5EtT22uQ1w7b9VDpTC6aLnS0x1E= 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 155860427111560.80291382662233; Thu, 23 May 2019 02:37:51 -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 607BC4E919; Thu, 23 May 2019 09:37: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 267056090E; Thu, 23 May 2019 09:37: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 D44405B426; Thu, 23 May 2019 09:37:43 +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 x4N9bEVh028688 for ; Thu, 23 May 2019 05:37:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AE4A6064C; Thu, 23 May 2019 09:37:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84F11620D4 for ; Thu, 23 May 2019 09:37: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 2DCB27FDF5 for ; Thu, 23 May 2019 09:36:59 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:30 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692953" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:17 +0800 Message-Id: <1558604060-30739-7-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.27]); Thu, 23 May 2019 09:37:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 23 May 2019 09:37:04 +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 (RCVD_IN_DNSWL_HI, SPF_HELO_NONE, 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.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 6/9] util: Refactor '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.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.38]); Thu, 23 May 2019 09:37:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Refactor 'virResctrlMonitorFreeStats' to let it available to free the 'virResctrlMonitorStatsPtr' variable. Signed-off-by: Wang Huaqiang --- src/qemu/qemu_driver.c | 1 + src/util/virresctrl.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 42b1ce2..2abed86 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19980,6 +19980,7 @@ qemuDomainFreeResctrlMonData(virQEMUResctrlMonDataP= tr resdata) VIR_FREE(resdata->name); VIR_FREE(resdata->vcpus); virResctrlMonitorFreeStats(resdata->stats, resdata->nstats); + VIR_FREE(resdata->stats); VIR_FREE(resdata); } =20 diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 90532cf..0f18d2b 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2764,7 +2764,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monito= r, cleanup: VIR_FREE(datapath); VIR_FREE(filepath); - VIR_FREE(stat); + virResctrlMonitorFreeStats(&stat, 1); VIR_DIR_CLOSE(dirp); return ret; } @@ -2781,8 +2781,6 @@ virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr = *stats, =20 for (i =3D 0; i < nstats; i++) VIR_FREE(stats[i]); - - VIR_FREE(stats); } =20 =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 01:44:19 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=1558604309; cv=none; d=zoho.com; s=zohoarc; b=ek3RIK08GDPoK2SUb17nKTrYmVPMguL2Q/TnGuluOVKJY/CaoP2dsBlj0ijtAKZza62J5DdW68sArRiSM2UW095YxkjKWyGe1NkC/lXFn8pxo8vuPqtSi6ekkIzHnDeLcguEPcpJmaCAxLxmZr1n1rBzqtvSWbxBGE20HIk2PYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604309; 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=QbYus49fVppvYhNJjdDyyjyDrGOT0Sz9vbWyMI3RpbI=; b=axivi16tjPsUF4xREZb4+eiENzQWSdpNyNBcdKQJS9mu78cAcKKih8zUCNqJtHlBbI/WAeBn9je8nm5Sa//maLoZhTbEJnuJRqY5WsllJlABXKSZhIWJu94JkCfXmpG8yekAiuqO26Ett5BCn+0QXwdmqyp9XnXH5gwjefOA7Co= 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 1558604309467237.9975154194965; Thu, 23 May 2019 02:38:29 -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 6FDD33079B9F; Thu, 23 May 2019 09:38:27 +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 45B195D9D2; Thu, 23 May 2019 09:38: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 B7A615B427; Thu, 23 May 2019 09:38: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 x4N9bBi4028624 for ; Thu, 23 May 2019 05:37:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9D58568D4D; Thu, 23 May 2019 09:37:11 +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 971351802F for ; Thu, 23 May 2019 09:37: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 E3B9A90C77 for ; Thu, 23 May 2019 09:36:59 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:31 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:30 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692963" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:18 +0800 Message-Id: <1558604060-30739-8-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.29]); Thu, 23 May 2019 09:37:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 23 May 2019 09:37: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 (RCVD_IN_DNSWL_HI, SPF_HELO_NONE, 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: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 7/9] 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.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.41]); Thu, 23 May 2019 09:38:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Refactor 'virResctrlMonitorStats' to track multiple statistical records. Signed-off-by: Wang Huaqiang --- src/qemu/qemu_driver.c | 2 +- src/util/virresctrl.c | 17 ++++++++++++++--- src/util/virresctrl.h | 12 ++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2abed86..4ea346c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20120,7 +20120,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 0f18d2b..c2fe2ed 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2686,6 +2686,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; @@ -2742,7 +2743,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, @@ -2752,6 +2753,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; } @@ -2779,8 +2786,12 @@ virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr= *stats, if (!stats) return; =20 - for (i =3D 0; i < nstats; i++) - VIR_FREE(stats[i]); + for (i =3D 0; i < nstats; i++) { + if (stats[i]) { + VIR_FREE(stats[i]->vals); + virStringListFree(stats[i]->features); + } + } } =20 =20 diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index abdeb59..97205bc 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 Mon May 6 01:44:19 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=1558604281; cv=none; d=zoho.com; s=zohoarc; b=dtkOTip6CyuARUDy0+sNASqpB5qdTR25Q/DfavNXI453NQ5tbDrgbuPRVB1cASLj/tOF/uhzr+4Ra7RDnpGmKK7F4PN9xicLqgd8hAdvb7aEhkYZPsIBiirhmzu+s1n843eqJKXV4ee8S+R+a9L6sM3D+aeufiJXZhyzd8GU65o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604281; 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=WA+gNizYFnYeV1r1xpMylESf50azNLWPRCQXVJIxF20=; b=T0R5W/6RkEFkjm257iy9E0n6digwcWXJ60tm9bAV+uetolM6phqK6jBqRBY9QTz1tPs1G4cpEDWdARcdAvJMZDHVhbvj4sGm+BxbcrdRt88eRqTidnkNyWYBAzXxRpXCRHFfNaGT/LEwp9VG0xtuqwuhkJ3VoCPrWlJCZVKOAhk= 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 1558604281952538.8510272758028; Thu, 23 May 2019 02:38:01 -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 9848F30821AE; Thu, 23 May 2019 09:38:00 +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 A51EC672DF; Thu, 23 May 2019 09:37:59 +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 6C2391806B1A; Thu, 23 May 2019 09:37:59 +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 x4N9bIbk029063 for ; Thu, 23 May 2019 05:37:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9965F5D707; Thu, 23 May 2019 09:37:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9301A5B685 for ; Thu, 23 May 2019 09:37:16 +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 749BE30C1AE8 for ; Thu, 23 May 2019 09:37:04 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:32 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:31 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692969" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:19 +0800 Message-Id: <1558604060-30739-9-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.40]); Thu, 23 May 2019 09:37:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 23 May 2019 09:37: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 (RCVD_IN_DNSWL_HI, SPF_HELO_NONE, 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.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 8/9] 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 23 May 2019 09:38:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Export virResctrlMonitorGetStats and make virResctrlMonitorGetCacheOccupancy obsoleted. Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 33 +++++++++++++++++++++++++-------- src/util/virresctrl.c | 46 +++++++++++++++++++++++++++-----------------= -- src/util/virresctrl.h | 6 ++++++ 4 files changed, 59 insertions(+), 27 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9099757..2e3d48c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2771,6 +2771,7 @@ virResctrlMonitorDeterminePath; virResctrlMonitorFreeStats; virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; +virResctrlMonitorGetStats; virResctrlMonitorNew; virResctrlMonitorRemove; virResctrlMonitorSetAlloc; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4ea346c..bc19171 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19987,6 +19987,7 @@ qemuDomainFreeResctrlMonData(virQEMUResctrlMonDataP= tr resdata) =20 /** * qemuDomainGetResctrlMonData: + * @driver: Pointer to qemu driver * @dom: Pointer for the domain that the resctrl monitors reside in * @resdata: Pointer of virQEMUResctrlMonDataPtr pointer for receiving the * virQEMUResctrlMonDataPtr array. Caller is responsible for @@ -20005,16 +20006,29 @@ 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; size_t i =3D 0; size_t j =3D 0; =20 + if (tag =3D=3D VIR_RESCTRL_MONITOR_TYPE_CACHE) { + features =3D driver->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 @@ -20041,9 +20055,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) @@ -20060,7 +20073,8 @@ qemuDomainGetResctrlMonData(virDomainObjPtr dom, =20 =20 static int -qemuDomainGetStatsCpuCache(virDomainObjPtr dom, +qemuDomainGetStatsCpuCache(virQEMUDriverPtr driver, + virDomainObjPtr dom, virDomainStatsRecordPtr record, int *maxparams) { @@ -20074,10 +20088,13 @@ 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 + if (nresdata =3D=3D 0) + return 0; + snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, "cpu.cache.monitor.count"); if (virTypedParamsAddUInt(&record->params, &record->nparams, @@ -20175,7 +20192,7 @@ qemuDomainGetStatsCpuCgroup(virDomainObjPtr dom, =20 =20 static int -qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, +qemuDomainGetStatsCpu(virQEMUDriverPtr driver, virDomainObjPtr dom, virDomainStatsRecordPtr record, int *maxparams, @@ -20184,7 +20201,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 c2fe2ed..76a8d02 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2668,8 +2668,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 @@ -2678,14 +2677,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; @@ -2743,21 +2743,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; @@ -2813,6 +2815,12 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitor= Ptr monitor, virResctrlMonitorStatsPtr **stats, size_t *nstats) { - return virResctrlMonitorGetStats(monitor, "llc_occupancy", - stats, nstats); + char **features =3D NULL; + int ret =3D -1; + + virStringListAdd(&features, "llc_occupancy"); + ret =3D virResctrlMonitorGetStats(monitor, (const char**)features, sta= ts, nstats); + virStringListFree(features); + + return ret; } diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 97205bc..d1905b0 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 Mon May 6 01:44:19 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=1558604253; cv=none; d=zoho.com; s=zohoarc; b=XA3n91Ol0IGVf5jlmeWFaHz057/ml+b1TDx4k2h6xIvoavOfZzyBNAeKHjUx6MXwDj5f4LpGv20eKyHCGV+9dZFXRar3YdQdzHke9JHrJrlj/cTptUQtFQ8rnCqyiN0cmXvzqnP+35C99owH+tWKeJozoTrAG7Vtnc8tq2Tmp7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558604253; 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=dwSvufMsZ5ijClKAGvaEc2skU6Gfkbr5RQZZUVJ8Hrc=; b=QsvlXTnFys1hxHOH44GNqA/1VF9P9c3UV22V4/o24Yxq16uyeQ/nL2IUWt+PdGcdsWxx6JHQm2JTnITLQqFOTpB/UqPynEZkinXb21vFv6flwnLp1kTr8SEuZjYlEMAKftqBP8nkh69n2lYUNGCNHTp1nFvSx7fYCAKROhJ+mDg= 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 1558604253575403.58562972095433; Thu, 23 May 2019 02:37:33 -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 9FF0530024D5; Thu, 23 May 2019 09:37:22 +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 7BD6D6064C; Thu, 23 May 2019 09:37: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 306751806B16; Thu, 23 May 2019 09:37:20 +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 x4N9bH8v029032 for ; Thu, 23 May 2019 05:37:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5ECC1620D0; Thu, 23 May 2019 09:37:17 +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 580EC6013A for ; Thu, 23 May 2019 09:37:17 +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 1F7B21796 for ; Thu, 23 May 2019 09:37:09 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 02:36:33 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2019 02:36:32 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,502,1549958400"; d="scan'208";a="174692976" From: Wang Huaqiang To: libvir-list@redhat.com Date: Thu, 23 May 2019 17:34:20 +0800 Message-Id: <1558604060-30739-10-git-send-email-huaqiang.wang@intel.com> In-Reply-To: <1558604060-30739-1-git-send-email-huaqiang.wang@intel.com> References: <1558604060-30739-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.29]); Thu, 23 May 2019 09:37:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 23 May 2019 09:37: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: 0 (SPF_HELO_NONE, 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: huaqiang.wang@intel.com Subject: [libvirt] [PATCH 9/9] 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.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.40]); Thu, 23 May 2019 09:37:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Wang Huaqiang --- src/libvirt_private.syms | 1 - src/util/virresctrl.c | 29 ----------------------------- src/util/virresctrl.h | 5 ----- 3 files changed, 35 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2e3d48c..41733cc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2769,7 +2769,6 @@ virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; virResctrlMonitorFreeStats; -virResctrlMonitorGetCacheOccupancy; virResctrlMonitorGetID; virResctrlMonitorGetStats; virResctrlMonitorNew; diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 76a8d02..640941c 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2795,32 +2795,3 @@ virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr= *stats, } } } - - -/* - * 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) -{ - char **features =3D NULL; - int ret =3D -1; - - virStringListAdd(&features, "llc_occupancy"); - ret =3D virResctrlMonitorGetStats(monitor, (const char**)features, sta= ts, nstats); - virStringListFree(features); - - return ret; -} diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index d1905b0..ab12ebf 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 virResctrlMonitorFreeStats(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