From nobody Fri May 3 01:31:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149059938184998.14674956112106; Mon, 27 Mar 2017 00:23:01 -0700 (PDT) Received: from localhost ([::1]:44773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOzU-0006W2-L5 for importer@patchew.org; Mon, 27 Mar 2017 03:23:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOyE-0005q5-Gw for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csOyD-0002V6-Oy for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:21:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58872) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csOyD-0002V0-JR for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:21:41 -0400 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 A180BC0799A3 for ; Mon, 27 Mar 2017 07:21:40 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-7-78.pek2.redhat.com [10.72.7.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AEBC77543; Mon, 27 Mar 2017 07:21:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A180BC0799A3 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A180BC0799A3 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:21:24 +0800 Message-Id: <1490599288-11751-2-git-send-email-peterx@redhat.com> In-Reply-To: <1490599288-11751-1-git-send-email-peterx@redhat.com> References: <1490599288-11751-1-git-send-email-peterx@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.31]); Mon, 27 Mar 2017 07:21:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/5] migration: set current_active_state once X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "\\ Dr . David Alan Gilbert \\ " , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We set it right above this one. No need to set it twice. CC: Juan Quintela CC: "Dr. David Alan Gilbert" Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 54060f7..f9f4d98 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1938,7 +1938,6 @@ static void *migration_thread(void *opaque) qemu_savevm_state_begin(s->to_dst_file, &s->params); =20 s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; - current_active_state =3D MIGRATION_STATUS_ACTIVE; migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_ACTIVE); =20 --=20 2.7.4 From nobody Fri May 3 01:31:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490599521563823.888340739151; Mon, 27 Mar 2017 00:25:21 -0700 (PDT) Received: from localhost ([::1]:44782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csP1j-0008HS-0g for importer@patchew.org; Mon, 27 Mar 2017 03:25:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOzB-0006TZ-NQ for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csOzA-0002uX-Mh for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csOzA-0002uK-FI for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:40 -0400 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 88AFCD1FE3 for ; Mon, 27 Mar 2017 07:22:39 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-7-78.pek2.redhat.com [10.72.7.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5105177524; Mon, 27 Mar 2017 07:21:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 88AFCD1FE3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 88AFCD1FE3 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:21:25 +0800 Message-Id: <1490599288-11751-3-git-send-email-peterx@redhat.com> In-Reply-To: <1490599288-11751-1-git-send-email-peterx@redhat.com> References: <1490599288-11751-1-git-send-email-peterx@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.27]); Mon, 27 Mar 2017 07:22:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/5] migration: rename max_size to threshold_size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "\\ Dr . David Alan Gilbert \\ " , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In migration codes (especially in migration_thread()), max_size is used in many place for the threshold value that we will start to do the final flush and jump to the next stage to dump the whole rest things to destination. However its name is confusing to first readers. Let's rename it to "threshold_size" when proper and add a comment for it. No functional change is made. CC: Juan Quintela CC: "Dr. David Alan Gilbert" Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- include/migration/vmstate.h | 3 ++- migration/migration.c | 17 +++++++++-------- migration/savevm.c | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f2dbf84..dad3984 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -56,7 +56,8 @@ typedef struct SaveVMHandlers { =20 /* This runs outside the iothread lock! */ int (*save_live_setup)(QEMUFile *f, void *opaque); - void (*save_live_pending)(QEMUFile *f, void *opaque, uint64_t max_size, + void (*save_live_pending)(QEMUFile *f, void *opaque, + uint64_t threshold_size, uint64_t *non_postcopiable_pending, uint64_t *postcopiable_pending); LoadStateHandler *load_state; diff --git a/migration/migration.c b/migration/migration.c index f9f4d98..b065fe4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1907,7 +1907,8 @@ static void *migration_thread(void *opaque) int64_t initial_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); int64_t setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); int64_t initial_bytes =3D 0; - int64_t max_size =3D 0; + /* We'll do the final flush when reachs threshold_size */ + int64_t threshold_size =3D 0; int64_t start_time =3D initial_time; int64_t end_time; bool old_vm_running =3D false; @@ -1951,17 +1952,17 @@ static void *migration_thread(void *opaque) if (!qemu_file_rate_limit(s->to_dst_file)) { uint64_t pend_post, pend_nonpost; =20 - qemu_savevm_state_pending(s->to_dst_file, max_size, &pend_nonp= ost, - &pend_post); + qemu_savevm_state_pending(s->to_dst_file, threshold_size, + &pend_nonpost, &pend_post); pending_size =3D pend_nonpost + pend_post; - trace_migrate_pending(pending_size, max_size, + trace_migrate_pending(pending_size, threshold_size, pend_post, pend_nonpost); - if (pending_size && pending_size >=3D max_size) { + if (pending_size && pending_size >=3D threshold_size) { /* Still a significant amount to transfer */ =20 if (migrate_postcopy_ram() && s->state !=3D MIGRATION_STATUS_POSTCOPY_ACTIVE && - pend_nonpost <=3D max_size && + pend_nonpost <=3D threshold_size && atomic_read(&s->start_postcopy)) { =20 if (!postcopy_start(s, &old_vm_running)) { @@ -1993,13 +1994,13 @@ static void *migration_thread(void *opaque) initial_bytes; uint64_t time_spent =3D current_time - initial_time; double bandwidth =3D (double)transferred_bytes / time_spent; - max_size =3D bandwidth * s->parameters.downtime_limit; + threshold_size =3D bandwidth * s->parameters.downtime_limit; =20 s->mbps =3D (((double) transferred_bytes * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0; =20 trace_migrate_transferred(transferred_bytes, time_spent, - bandwidth, max_size); + bandwidth, threshold_size); /* if we haven't sent anything, we don't want to recalculate 10000 is a small enough number for our purposes */ if (s->dirty_bytes_rate && transferred_bytes > 10000) { diff --git a/migration/savevm.c b/migration/savevm.c index 3b19a4a..59c04eb 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1197,7 +1197,7 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, = bool iterable_only) * the result is split into the amount for units that can and * for units that can't do postcopy. */ -void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size, +void qemu_savevm_state_pending(QEMUFile *f, uint64_t threshold_size, uint64_t *res_non_postcopiable, uint64_t *res_postcopiable) { @@ -1216,7 +1216,7 @@ void qemu_savevm_state_pending(QEMUFile *f, uint64_t = max_size, continue; } } - se->ops->save_live_pending(f, se->opaque, max_size, + se->ops->save_live_pending(f, se->opaque, threshold_size, res_non_postcopiable, res_postcopiable); } } --=20 2.7.4 From nobody Fri May 3 01:31:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490599471610567.2525029279071; Mon, 27 Mar 2017 00:24:31 -0700 (PDT) Received: from localhost ([::1]:44780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csP0v-0007dU-1e for importer@patchew.org; Mon, 27 Mar 2017 03:24:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOzG-0006XU-PL for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csOzG-0002vm-1a for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51786) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csOzF-0002vW-SP for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:45 -0400 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 EBA4E8E673 for ; Mon, 27 Mar 2017 07:22:44 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-7-78.pek2.redhat.com [10.72.7.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67966BA889; Mon, 27 Mar 2017 07:22:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EBA4E8E673 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EBA4E8E673 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:21:26 +0800 Message-Id: <1490599288-11751-4-git-send-email-peterx@redhat.com> In-Reply-To: <1490599288-11751-1-git-send-email-peterx@redhat.com> References: <1490599288-11751-1-git-send-email-peterx@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.25]); Mon, 27 Mar 2017 07:22:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/5] hmp: info migrate_capability format tunes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "\\ Dr . David Alan Gilbert \\ " , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Dump the info in a single line is hard to read. Do it one per line. Also, the first "capabilities:" didn't help much. Let's remove it. CC: "Dr. David Alan Gilbert" Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hmp.c b/hmp.c index edb8970..95eef8c 100644 --- a/hmp.c +++ b/hmp.c @@ -265,13 +265,11 @@ void hmp_info_migrate_capabilities(Monitor *mon, cons= t QDict *qdict) caps =3D qmp_query_migrate_capabilities(NULL); =20 if (caps) { - monitor_printf(mon, "capabilities: "); for (cap =3D caps; cap; cap =3D cap->next) { - monitor_printf(mon, "%s: %s ", + monitor_printf(mon, "%s: %s\n", MigrationCapability_lookup[cap->value->capabili= ty], cap->value->state ? "on" : "off"); } - monitor_printf(mon, "\n"); } =20 qapi_free_MigrationCapabilityStatusList(caps); --=20 2.7.4 From nobody Fri May 3 01:31:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490599480300756.9168990287719; Mon, 27 Mar 2017 00:24:40 -0700 (PDT) Received: from localhost ([::1]:44781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csP15-0007lv-2c for importer@patchew.org; Mon, 27 Mar 2017 03:24:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOzP-0006dM-Ru for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csOzL-00030R-CB for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csOzL-00030C-3L for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:51 -0400 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 315BFA203B for ; Mon, 27 Mar 2017 07:22:50 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-7-78.pek2.redhat.com [10.72.7.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18B3FBA889; Mon, 27 Mar 2017 07:22:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 315BFA203B Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 315BFA203B From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:21:27 +0800 Message-Id: <1490599288-11751-5-git-send-email-peterx@redhat.com> In-Reply-To: <1490599288-11751-1-git-send-email-peterx@redhat.com> References: <1490599288-11751-1-git-send-email-peterx@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.26]); Mon, 27 Mar 2017 07:22:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/5] hmp: info migrate_parameters format tunes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "\\ Dr . David Alan Gilbert \\ " , peterx@redhat.com, Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Do the same (one per line) to the parameter list. CC: "Dr. David Alan Gilbert" Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/hmp.c b/hmp.c index 95eef8c..b33e39e 100644 --- a/hmp.c +++ b/hmp.c @@ -282,46 +282,44 @@ void hmp_info_migrate_parameters(Monitor *mon, const = QDict *qdict) params =3D qmp_query_migrate_parameters(NULL); =20 if (params) { - monitor_printf(mon, "parameters:"); assert(params->has_compress_level); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_LEVEL], params->compress_level); assert(params->has_compress_threads); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_THREADS= ], params->compress_threads); assert(params->has_decompress_threads); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREA= DS], params->decompress_threads); assert(params->has_cpu_throttle_initial); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INI= TIAL], params->cpu_throttle_initial); assert(params->has_cpu_throttle_increment); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INC= REMENT], params->cpu_throttle_increment); - monitor_printf(mon, " %s: '%s'", + monitor_printf(mon, "%s: '%s'\n", MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS], params->has_tls_creds ? params->tls_creds : ""); - monitor_printf(mon, " %s: '%s'", + monitor_printf(mon, "%s: '%s'\n", MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME], params->has_tls_hostname ? params->tls_hostname : ""); assert(params->has_max_bandwidth); - monitor_printf(mon, " %s: %" PRId64 " bytes/second", + monitor_printf(mon, "%s: %" PRId64 " bytes/second\n", MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH], params->max_bandwidth); assert(params->has_downtime_limit); - monitor_printf(mon, " %s: %" PRId64 " milliseconds", + monitor_printf(mon, "%s: %" PRId64 " milliseconds\n", MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT], params->downtime_limit); assert(params->has_x_checkpoint_delay); - monitor_printf(mon, " %s: %" PRId64, + monitor_printf(mon, "%s: %" PRId64 "\n", MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DEL= AY], params->x_checkpoint_delay); - monitor_printf(mon, "\n"); } =20 qapi_free_MigrationParameters(params); --=20 2.7.4 From nobody Fri May 3 01:31:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490599599127110.74007885164144; Mon, 27 Mar 2017 00:26:39 -0700 (PDT) Received: from localhost ([::1]:44794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csP30-0000yx-0D for importer@patchew.org; Mon, 27 Mar 2017 03:26:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csOzT-0006fr-3P for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:23:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csOzS-00036W-5f for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59886) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csOzR-00036D-Vd for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:22:58 -0400 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 13276C065107; Mon, 27 Mar 2017 07:22:57 +0000 (UTC) Received: from pxdev.xzpeter.org (vpn1-7-78.pek2.redhat.com [10.72.7.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41813BA889; Mon, 27 Mar 2017 07:22:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 13276C065107 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 13276C065107 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:21:28 +0800 Message-Id: <1490599288-11751-6-git-send-email-peterx@redhat.com> In-Reply-To: <1490599288-11751-1-git-send-email-peterx@redhat.com> References: <1490599288-11751-1-git-send-email-peterx@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.31]); Mon, 27 Mar 2017 07:22:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/5] cpu: throttle: fix throttle time slice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela , "\\ Dr . David Alan Gilbert \\ " , peterx@redhat.com, "Jason J . Herne" , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" IIUC the throttle idea is that: we split a CPU_THROTTLE_TIMESLICE_NS time slice into two parts - one for vcpu, one for throttle thread (which will suspend the thread by a sleep). However current algorithm on calculating the working piece and sleeping piece is strange. Assume a 99% throttle, what we want is to merely stop vcpu from running, but the old logic will just first let the vcpu run for a very long time (which is "CPU_THROTTLE_TIMESLICE_NS / (1-pct)" =3D 1 second) before doing anything else. Fixing it up to the simplest but imho accurate logic. CC: Paolo Bonzini CC: Richard Henderson CC: Jason J. Herne Signed-off-by: Peter Xu --- cpus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index 167d961..7976ce4 100644 --- a/cpus.c +++ b/cpus.c @@ -633,7 +633,6 @@ static const VMStateDescription vmstate_timers =3D { static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque) { double pct; - double throttle_ratio; long sleeptime_ns; =20 if (!cpu_throttle_get_percentage()) { @@ -641,8 +640,7 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_c= pu_data opaque) } =20 pct =3D (double)cpu_throttle_get_percentage()/100; - throttle_ratio =3D pct / (1 - pct); - sleeptime_ns =3D (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE_NS); + sleeptime_ns =3D (long)((1 - pct) * CPU_THROTTLE_TIMESLICE_NS); =20 qemu_mutex_unlock_iothread(); atomic_set(&cpu->throttle_thread_scheduled, 0); @@ -668,7 +666,7 @@ static void cpu_throttle_timer_tick(void *opaque) =20 pct =3D (double)cpu_throttle_get_percentage()/100; timer_mod(throttle_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT) + - CPU_THROTTLE_TIMESLICE_NS / (1-pct)); + CPU_THROTTLE_TIMESLICE_NS * pct); } =20 void cpu_throttle_set(int new_throttle_pct) --=20 2.7.4