From nobody Sun May 5 06:18:00 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=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542376539019174.53570124402972; Fri, 16 Nov 2018 05:55:39 -0800 (PST) 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 EF4BF30820DB; Fri, 16 Nov 2018 13:55:35 +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 925A55C6B0; Fri, 16 Nov 2018 13:55: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 0C5DD181B9E1; Fri, 16 Nov 2018 13:55:33 +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 wAGDWcoE022336 for ; Fri, 16 Nov 2018 08:32:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED7B760CCF; Fri, 16 Nov 2018 13:32:38 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-187.brq.redhat.com [10.40.204.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9403260CCE for ; Fri, 16 Nov 2018 13:32:35 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id 1BA692A6D44; Fri, 16 Nov 2018 14:32:34 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 16 Nov 2018 14:32:33 +0100 Message-Id: <2844a5c59a5525302bce83d502514b227862b333.1542375153.git.jdenemar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Add support for postcopy-requests migration 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: , 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.47]); Fri, 16 Nov 2018 13:55:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" QEMU can report how many times during post-copy migration the domain running on the destination host tried to access a page which has not been migrated yet. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 10 ++++++++++ src/qemu/qemu_domain.c | 5 ++++- src/qemu/qemu_migration_cookie.c | 5 +++++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 2 ++ tools/virsh-domain.c | 8 ++++++++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 71debd92b8..897b06e6d0 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3378,6 +3378,16 @@ typedef enum { */ # define VIR_DOMAIN_JOB_MEMORY_ITERATION "memory_iteration" =20 +/** + * VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS: + * + * virDomainGetJobStats field: number page requests received from the + * destination host during post-copy migration, as VIR_TYPED_PARAM_ULLONG. + * This counter is incremented whenever the migrated domain tries to access + * a memory page which has not been transferred from the source host yet. + */ +# define VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS "memory_postcopy_requests" + /** * VIR_DOMAIN_JOB_DISK_TOTAL: * diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fbe63e2e1d..3dbd9d47ca 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -609,7 +609,10 @@ qemuDomainMigrationJobInfoToParams(qemuDomainJobInfoPt= r jobInfo, stats->ram_dirty_rate) < 0 || virTypedParamsAddULLong(&par, &npar, &maxpar, VIR_DOMAIN_JOB_MEMORY_ITERATION, - stats->ram_iteration) < 0) + stats->ram_iteration) < 0 || + virTypedParamsAddULLong(&par, &npar, &maxpar, + VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS, + stats->ram_postcopy_reqs) < 0) goto error; =20 if (stats->ram_page_size > 0 && diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 60df449d53..84f0101382 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -703,6 +703,9 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf, virBufferAsprintf(buf, "<%1$s>%2$llu\n", VIR_DOMAIN_JOB_MEMORY_ITERATION, stats->ram_iteration); + virBufferAsprintf(buf, "<%1$s>%2$llu\n", + VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS, + stats->ram_postcopy_reqs); =20 virBufferAsprintf(buf, "<%1$s>%2$llu\n", VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, @@ -1102,6 +1105,8 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContext= Ptr ctxt) ctxt, &stats->ram_dirty_rate); virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_ITERATION "[1])", ctxt, &stats->ram_iteration); + virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS "[1]= )", + ctxt, &stats->ram_postcopy_reqs); =20 virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "[1])", ctxt, &stats->ram_page_size); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 48b142a4f4..3430426c4b 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -706,6 +706,7 @@ struct _qemuMonitorMigrationStats { unsigned long long ram_dirty_rate; unsigned long long ram_page_size; unsigned long long ram_iteration; + unsigned long long ram_postcopy_reqs; =20 unsigned long long disk_transferred; unsigned long long disk_remaining; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3de298c9e2..4c151dd405 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3296,6 +3296,8 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr= reply, &stats->ram_page_siz= e)); ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-sync-cou= nt", &stats->ram_iteratio= n)); + ignore_value(virJSONValueObjectGetNumberUlong(ram, "postcopy-reque= sts", + &stats->ram_postcopy= _reqs)); =20 disk =3D virJSONValueObjectGetObject(ret, "disk"); if (disk) { diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 372bdb95d3..a71cc9d0be 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6233,6 +6233,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) } else if (rc) { vshPrint(ctl, "%-17s %-12llu\n", _("Iteration:"), value); } + + if ((rc =3D virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_JOB_MEMORY_POSTCOPY_R= EQS, + &value)) < 0) { + goto save_error; + } else if (rc) { + vshPrint(ctl, "%-17s %-12llu\n", _("Postcopy requests:"), valu= e); + } } =20 if (info.fileTotal || info.fileRemaining || info.fileProcessed) { --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list