From nobody Wed May 1 22:37:04 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 1506413655460190.37203792221305; Tue, 26 Sep 2017 01:14:15 -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 21A544A6E5; Tue, 26 Sep 2017 08:14:13 +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 27DEE721C4; Tue, 26 Sep 2017 08:14:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AB7F51806106; Tue, 26 Sep 2017 08:14:07 +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 v8Q803wM029531 for ; Tue, 26 Sep 2017 04:00:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id E7E365885F; Tue, 26 Sep 2017 08:00:03 +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 8AC4166D4E; Tue, 26 Sep 2017 08:00:00 +0000 (UTC) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by mx1.redhat.com (Postfix) with ESMTP id D9FF67E435; Tue, 26 Sep 2017 07:59:57 +0000 (UTC) Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Sep 2017 15:49:47 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id B104B46BA7CC; Tue, 26 Sep 2017 15:49:47 +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; Tue, 26 Sep 2017 15:49:46 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21A544A6E5 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: ext-mx09.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 21A544A6E5 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D9FF67E435 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Authentication-Results: ext-mx03.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 D9FF67E435 X-IronPort-AV: E=Sophos;i="5.42,440,1500912000"; d="scan'208";a="28270214" From: Chao Fan To: , Date: Tue, 26 Sep 2017 15:49:39 +0800 Message-ID: <20170926074939.12564-1-fanc.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: B104B46BA7CC.AAA78 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: fanc.fnst@cn.fujitsu.com X-Spam-Status: No X-Greylist: Delayed for 00:10:09 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Sep 2017 07:59:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Sep 2017 07:59:59 +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.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: izumi.taku@jp.fujitsu.com, caoj.fnst@cn.fujitsu.com, Chao Fan , indou.takao@jp.fujitsu.com Subject: [libvirt] [PATCH] 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 26 Sep 2017 08:14:14 +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 --- include/libvirt/libvirt-domain.h | 10 +++++++++- src/qemu/qemu_domain.c | 5 +++++ 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, 32 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 030a62c43..b05c9d762 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3327,7 +3327,8 @@ typedef enum { */ # define VIR_DOMAIN_JOB_MEMORY_BPS "memory_bps" =20 -/** VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE: +/** + * VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE: * * virDomainGetJobStats field: number of memory pages dirtied by the guest * per second, as VIR_TYPED_PARAM_ULLONG. This statistics makes sense only @@ -3336,6 +3337,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 domian + */ +# 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..9194e70f8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -571,6 +571,11 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo, goto error; =20 if (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 + mirrorStats->total) < 0 || 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