From nobody Fri May 3 11:48:28 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506588694129822.7820863636881; Thu, 28 Sep 2017 01:51:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B12235B12A; Thu, 28 Sep 2017 08:51:32 +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 7C0307DB5E; Thu, 28 Sep 2017 08:51:31 +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 3AC831806102; Thu, 28 Sep 2017 08:51:30 +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 v8S8Xl5J032320 for ; Thu, 28 Sep 2017 04:33:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC78E7E68D; Thu, 28 Sep 2017 08:33:47 +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 DFD257E67F; Thu, 28 Sep 2017 08:33:45 +0000 (UTC) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by mx1.redhat.com (Postfix) with ESMTP id 3806EC01A71C; Thu, 28 Sep 2017 08:33:41 +0000 (UTC) Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 28 Sep 2017 16:33:39 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 0A19146BA7DF; Thu, 28 Sep 2017 16:33:34 +0800 (CST) Received: from localhost (10.167.225.56) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.361.1; Thu, 28 Sep 2017 16:33:33 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2B12235B12A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2B12235B12A DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3806EC01A71C Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=fanc.fnst@cn.fujitsu.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3806EC01A71C X-IronPort-AV: E=Sophos;i="5.42,449,1500912000"; d="scan'208";a="28512353" From: Chao Fan To: , , , Date: Thu, 28 Sep 2017 16:32:26 +0800 Message-ID: <20170928083226.26391-1-fanc.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 0A19146BA7DF.ABAF4 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: fanc.fnst@cn.fujitsu.com X-Spam-Status: No X-Greylist: Delayed for 06:47:39 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 28 Sep 2017 08:33:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 28 Sep 2017 08:33:44 +0000 (UTC) for IP:'183.91.158.132' DOMAIN:'mail.cn.fujitsu.com' HELO:'heian.cn.fujitsu.com' FROM:'fanc.fnst@cn.fujitsu.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (RP_MATCHES_RCVD) 183.91.158.132 mail.cn.fujitsu.com 183.91.158.132 mail.cn.fujitsu.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: izumi.taku@jp.fujitsu.com, caoj.fnst@cn.fujitsu.com, Chao Fan , indou.takao@jp.fujitsu.com, Li Zhijian Subject: [libvirt] [PATCH v2] qemu: add the print of page size in cmd domjobinfo 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: , 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.29]); Thu, 28 Sep 2017 08:51:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The command "info migrate" of qemu outputs the dirty-pages-rate during migration, but page size is different in different architectures. So page size should be output to calculate dirty pages in bytes. Page size is already implemented with commit 030ce1f8612215fcbe9d353dfeaeb2937f8e3f94 in qemu. Now Implement the counter-part in libvirt. Signed-off-by: Chao Fan Signed-off-by: Li Zhijian --- v1 -> v2: Follow the suggestion of John Ferlan: 1. Drop the fix for unrelated coding style problem. 2. Fix typo. 3. Improve a judgment logic when failing to get page size. --- include/libvirt/libvirt-domain.h | 7 +++++++ src/qemu/qemu_domain.c | 6 ++++++ src/qemu/qemu_migration_cookie.c | 7 +++++++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 2 ++ tools/virsh-domain.c | 8 ++++++++ 6 files changed, 31 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 030a62c43..1f4ddcf66 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3336,6 +3336,13 @@ typedef enum { # define VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE "memory_dirty_rate" =20 /** + * VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE: + * + * virDomainGetJobStats field: page size of the memory in this domain + */ +# define VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "page_size" + +/** * VIR_DOMAIN_JOB_MEMORY_ITERATION: * * virDomainGetJobStats field: current iteration over domain's memory diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index cb371f1e8..ce342b670 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -570,6 +570,12 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo, stats->ram_iteration) < 0) goto error; =20 + if (stats->ram_page_size && (!(stats->ram_pag_size > 0) || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, + stats->ram_page_size) < 0)) + goto error; + if (virTypedParamsAddULLong(&par, &npar, &maxpar, VIR_DOMAIN_JOB_DISK_TOTAL, stats->disk_total + diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index eef40a6cd..bc6a8dc55 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -654,6 +654,10 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr bu= f, stats->ram_iteration); =20 virBufferAsprintf(buf, "<%1$s>%2$llu\n", + VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, + stats->ram_page_size); + + virBufferAsprintf(buf, "<%1$s>%2$llu\n", VIR_DOMAIN_JOB_DISK_TOTAL, stats->disk_total); virBufferAsprintf(buf, "<%1$s>%2$llu\n", @@ -1014,6 +1018,9 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContext= Ptr ctxt) virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_ITERATION "[1])", ctxt, &stats->ram_iteration); =20 + virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "[1])", + ctxt, &stats->ram_page_size); + virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_TOTAL "[1])", ctxt, &stats->disk_total); virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_PROCESSED "[1])", diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6414d2483..1e3322433 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -677,6 +677,7 @@ struct _qemuMonitorMigrationStats { unsigned long long ram_normal; unsigned long long ram_normal_bytes; unsigned long long ram_dirty_rate; + unsigned long long ram_page_size; unsigned long long ram_iteration; =20 unsigned long long disk_transferred; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 63b855920..625cbc134 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2892,6 +2892,8 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr= reply, &stats->ram_normal_b= ytes)); ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-pages-ra= te", &stats->ram_dirty_ra= te)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "page-size", + &stats->ram_page_siz= e)); ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-sync-cou= nt", &stats->ram_iteratio= n)); =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a3f3b7c7b..a50713d6e 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6021,6 +6021,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) } =20 if ((rc =3D virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, + &value)) < 0) { + goto save_error; + } else if (rc) { + vshPrint(ctl, "%-17s %-12llu bytes\n", _("Page size:"), value); + } + + if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_MEMORY_ITERATION, &value)) < 0) { goto save_error; --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list