From nobody Fri May 3 22:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584095549; cv=none; d=zohomail.com; s=zohoarc; b=KpSWELLwOryj3mfk65drqnSTx3G8ojxKXp/MPlGdd1GeoCspyJuE8GdA6jVI/nRT0R3CW5zuNagkxeDa4MZlVZdwmP2Y79Eu/e39BiCLbjoTHhfZfKjLguN7S9iWEAeOky3VPwHbZe91X/KeOA99vIbuyl+8zqE0IwMpLdVHw2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584095549; h=Content-Type:Content-Transfer-Encoding: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; bh=jealFJWRwXog3m3+gGWZ0kWOZ+sJot2DcLbtmIlySJk=; b=THvPWpAPfJXOPmY68GOAFFJm7oDv0YOqaelNniE0AwiLeHBMYLQLlOyIgBsyow5Raxc0HDrHCwvAuDjCvDKuP2YNoYO8PZvOeGalgID++D2Jio+kNs8EjH2p6yzacdDsTsUG/p/ymeMVF4pOxmACzqLFHtMZmG0tW4H1qb5lzz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584095549516463.42820598787955; Fri, 13 Mar 2020 03:32:29 -0700 (PDT) Received: from localhost ([::1]:56674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChcC-0001Fi-E1 for importer@patchew.org; Fri, 13 Mar 2020 06:32:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38928) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChac-0008Jw-Hw for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jChaa-0005pa-PE for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37627 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jChaa-0005mt-Fj for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-zw0RP_k5PUeArv9zgMxQow-1; Fri, 13 Mar 2020 06:30:45 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3A4A800D4E; Fri, 13 Mar 2020 10:30:44 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4B3A8B773; Fri, 13 Mar 2020 10:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584095447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jealFJWRwXog3m3+gGWZ0kWOZ+sJot2DcLbtmIlySJk=; b=PFtDU0I9sL2H9RI6ngoTEVqYZDoEi28CIsGNrSmht40LRdqElQKYEMLYb+KbTYi5Ipgngn FBAiJvKYw4DpuANeFzVrynS0KFu6SlNatsNk8FQlk+0jUUBgUmO7eCnf67fl++6eJDZsU2 cDwMG2l+8GZTMgvggML3/JEfSgh9F8Q= X-MC-Unique: zw0RP_k5PUeArv9zgMxQow-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com, zhukeqian1@huawei.com, quintela@redhat.com Subject: [PULL 1/5] configure: Improve zstd test Date: Fri, 13 Mar 2020 10:30:35 +0000 Message-Id: <20200313103039.150133-2-dgilbert@redhat.com> In-Reply-To: <20200313103039.150133-1-dgilbert@redhat.com> References: <20200313103039.150133-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Juan Quintela There were one error on the test (missing an s for --exists). But we really need a recent zstd (1.4.0). Thanks to Michal Privoznik to provide the right vension. Signed-off-by: Juan Quintela Reported-by: Richard Henderson Message-Id: <20200310111431.173151-1-quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 3c7470096f..eb49bb6680 100755 --- a/configure +++ b/configure @@ -2475,7 +2475,8 @@ fi # zstd check =20 if test "$zstd" !=3D "no" ; then - if $pkg_config --exist libzstd ; then + libzstd_minver=3D"1.4.0" + if $pkg_config --atleast-version=3D$libzstd_minver libzstd ; then zstd_cflags=3D"$($pkg_config --cflags libzstd)" zstd_libs=3D"$($pkg_config --libs libzstd)" LIBS=3D"$zstd_libs $LIBS" --=20 2.24.1 From nobody Fri May 3 22:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584095549; cv=none; d=zohomail.com; s=zohoarc; b=SJcouBa/C9SuToQg2VOxMWyKZoRPR+McZ/sZqvoEgqjGyMb4qFZJGl266GbFa7sj2IRbo3RbBrCTT4RV1efczhuLn2dPBnAhi0GIpMRmvIkGz9uIt6oZMKcsu3jhihYPD3H6xNW3l82pEMPJIMI8V8uzb0RC0Z9cq+mIlu3y4JE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584095549; h=Content-Type:Content-Transfer-Encoding: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; bh=8Ilh5twvEhfre1mz234YZWMn9UbV7IQ+O7d/iKntKls=; b=KOnvXUf5aBM5JkkghLqYraV60T+0GMjh8qh18dqj0UGL+xxlCueO79eC3k0PvDwXE9DzDzRTp7TwmEJ8j0G4wiiXdDHHqDjuyZ4byp8SyHa+RmgA6GOgH5mg7f4tOpQJw4jOlHIS8HgsKOFsCMkU6YMwNRlF5mnBZsOrA0Swsaw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584095549300857.0360241991361; Fri, 13 Mar 2020 03:32:29 -0700 (PDT) Received: from localhost ([::1]:56672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChcC-0001F6-73 for importer@patchew.org; Fri, 13 Mar 2020 06:32:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38992) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChae-0008LW-6o for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jChac-0005tj-9F for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:52 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:52858 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jChac-0005qx-4K for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-4ZIzarBBO1eIpsL_z_O7SQ-1; Fri, 13 Mar 2020 06:30:47 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C0DB107ACC9; Fri, 13 Mar 2020 10:30:46 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFACA8B773; Fri, 13 Mar 2020 10:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584095449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Ilh5twvEhfre1mz234YZWMn9UbV7IQ+O7d/iKntKls=; b=Z3PR9ZcN8JeEcFGMgPZ3+TWtdm2MJM+Px0uPhXPUMKgK1PvpKjrNCZO/AI5GloJk/EPeH5 wi26laNLcU6CQho1JWA4GGefUFvn4rPQl/tWWH1lLMq246uD586MiFGK2XNzoZgC8hlUC6 2rNsECNDDnLHfp8wuJ2Ng8/lIDUTznA= X-MC-Unique: 4ZIzarBBO1eIpsL_z_O7SQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com, zhukeqian1@huawei.com, quintela@redhat.com Subject: [PULL 2/5] migration/throttle: Add throttle-trig-thres migration parameter Date: Fri, 13 Mar 2020 10:30:36 +0000 Message-Id: <20200313103039.150133-3-dgilbert@redhat.com> In-Reply-To: <20200313103039.150133-1-dgilbert@redhat.com> References: <20200313103039.150133-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Keqian Zhu Currently, if the bytes_dirty_period is more than the 50% of bytes_xfer_period, we start or increase throttling. If we make this percentage higher, then we can tolerate higher dirty rate during migration, which means less impact on guest. The side effect of higher percentage is longer migration time. We can make this parameter configurable to switch between mig- ration time first or guest performance first. The default value is 50 and valid range is 1 to 100. Signed-off-by: Keqian Zhu Message-Id: <20200224023142.39360-1-zhukeqian1@huawei.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 24 ++++++++++++++++++++ migration/ram.c | 52 +++++++++++++++++++++++++------------------ monitor/hmp-cmds.c | 7 ++++++ qapi/migration.json | 16 ++++++++++++- 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0b2045ccbd..59da5d0625 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -78,6 +78,7 @@ /*0: means nocompress, 1: best speed, ... 9: best compress ratio */ #define DEFAULT_MIGRATE_COMPRESS_LEVEL 1 /* Define default autoconverge cpu throttle migration parameters */ +#define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 #define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 #define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 #define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99 @@ -778,6 +779,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->compress_wait_thread =3D s->parameters.compress_wait_thread; params->has_decompress_threads =3D true; params->decompress_threads =3D s->parameters.decompress_threads; + params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; params->has_cpu_throttle_initial =3D true; params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; params->has_cpu_throttle_increment =3D true; @@ -1169,6 +1172,15 @@ static bool migrate_params_check(MigrationParameters= *params, Error **errp) return false; } =20 + if (params->has_throttle_trigger_threshold && + (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "throttle_trigger_threshold", + "an integer in the range of 1 to 100"); + return false; + } + if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { @@ -1298,6 +1310,10 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, dest->decompress_threads =3D params->decompress_threads; } =20 + if (params->has_throttle_trigger_threshold) { + dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; + } + if (params->has_cpu_throttle_initial) { dest->cpu_throttle_initial =3D params->cpu_throttle_initial; } @@ -1382,6 +1398,10 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) s->parameters.decompress_threads =3D params->decompress_threads; } =20 + if (params->has_throttle_trigger_threshold) { + s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; + } + if (params->has_cpu_throttle_initial) { s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; } @@ -3558,6 +3578,9 @@ static Property migration_properties[] =3D { DEFINE_PROP_UINT8("x-decompress-threads", MigrationState, parameters.decompress_threads, DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), + DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, + parameters.throttle_trigger_threshold, + DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, parameters.cpu_throttle_initial, DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), @@ -3667,6 +3690,7 @@ static void migration_instance_init(Object *obj) params->has_compress_level =3D true; params->has_compress_threads =3D true; params->has_decompress_threads =3D true; + params->has_throttle_trigger_threshold =3D true; params->has_cpu_throttle_initial =3D true; params->has_cpu_throttle_increment =3D true; params->has_max_bandwidth =3D true; diff --git a/migration/ram.c b/migration/ram.c index 0ef68798d2..02cfd76d19 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -896,11 +896,38 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) } } =20 +static void migration_trigger_throttle(RAMState *rs) +{ + MigrationState *s =3D migrate_get_current(); + uint64_t threshold =3D s->parameters.throttle_trigger_threshold; + + uint64_t bytes_xfer_period =3D ram_counters.transferred - rs->bytes_xf= er_prev; + uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; + uint64_t bytes_dirty_threshold =3D bytes_xfer_period * threshold / 100; + + /* During block migration the auto-converge logic incorrectly detects + * that ram migration makes no progress. Avoid this by disabling the + * throttling logic during the bulk phase of block migration. */ + if (migrate_auto_converge() && !blk_mig_bulk_active()) { + /* The following detection logic can be refined later. For now: + Check to see if the ratio between dirtied bytes and the approx. + amount of bytes that just got transferred since the last time + we were in this routine reaches the threshold. If that happens + twice, start or increase throttling. */ + + if ((bytes_dirty_period > bytes_dirty_threshold) && + (++rs->dirty_rate_high_cnt >=3D 2)) { + trace_migration_throttle(); + rs->dirty_rate_high_cnt =3D 0; + mig_throttle_guest_down(); + } + } +} + static void migration_bitmap_sync(RAMState *rs) { RAMBlock *block; int64_t end_time; - uint64_t bytes_xfer_now; =20 ram_counters.dirty_sync_count++; =20 @@ -927,26 +954,7 @@ static void migration_bitmap_sync(RAMState *rs) =20 /* more than 1 second =3D 1000 millisecons */ if (end_time > rs->time_last_bitmap_sync + 1000) { - bytes_xfer_now =3D ram_counters.transferred; - - /* During block migration the auto-converge logic incorrectly dete= cts - * that ram migration makes no progress. Avoid this by disabling t= he - * throttling logic during the bulk phase of block migration. */ - if (migrate_auto_converge() && !blk_mig_bulk_active()) { - /* The following detection logic can be refined later. For now: - Check to see if the dirtied bytes is 50% more than the appr= ox. - amount of bytes that just got transferred since the last ti= me we - were in this routine. If that happens twice, start or incre= ase - throttling */ - - if ((rs->num_dirty_pages_period * TARGET_PAGE_SIZE > - (bytes_xfer_now - rs->bytes_xfer_prev) / 2) && - (++rs->dirty_rate_high_cnt >=3D 2)) { - trace_migration_throttle(); - rs->dirty_rate_high_cnt =3D 0; - mig_throttle_guest_down(); - } - } + migration_trigger_throttle(rs); =20 migration_update_rates(rs, end_time); =20 @@ -955,7 +963,7 @@ static void migration_bitmap_sync(RAMState *rs) /* reset period counters */ rs->time_last_bitmap_sync =3D end_time; rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D bytes_xfer_now; + rs->bytes_xfer_prev =3D ram_counters.transferred; } if (migrate_use_events()) { qapi_event_send_migration_pass(ram_counters.dirty_sync_count); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 1c69d51b97..58724031ea 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -407,6 +407,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS), params->decompress_threads); + assert(params->has_throttle_trigger_threshold); + monitor_printf(mon, "%s: %u\n", + MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_TH= RESHOLD), + params->throttle_trigger_threshold); assert(params->has_cpu_throttle_initial); monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIA= L), @@ -1254,6 +1258,9 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) p->has_decompress_threads =3D true; visit_type_int(v, param, &p->decompress_threads, &err); break; + case MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD: + p->has_throttle_trigger_threshold =3D true; + visit_type_int(v, param, &p->throttle_trigger_threshold, &err); case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL: p->has_cpu_throttle_initial =3D true; visit_type_int(v, param, &p->cpu_throttle_initial, &err); diff --git a/qapi/migration.json b/qapi/migration.json index d44d99cd78..0d1c0712ca 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -540,6 +540,10 @@ # compression, so set the decompress-threads to the n= umber about 1/4 # of compress-threads is adequate. # +# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_x= fer_period +# to trigger throttling. It is expressed as p= ercentage. +# The default value is 50. (Since 5.0) +# # @cpu-throttle-initial: Initial percentage of time guest cpus are throttl= ed # when migration auto-converge is activated. The # default value is 20. (Since 2.7) @@ -625,7 +629,7 @@ 'data': ['announce-initial', 'announce-max', 'announce-rounds', 'announce-step', 'compress-level', 'compress-threads', 'decompress-threads', - 'compress-wait-thread', + 'compress-wait-thread', 'throttle-trigger-threshold', 'cpu-throttle-initial', 'cpu-throttle-increment', 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', @@ -660,6 +664,10 @@ # # @decompress-threads: decompression thread count # +# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_x= fer_period +# to trigger throttling. It is expressed as p= ercentage. +# The default value is 50. (Since 5.0) +# # @cpu-throttle-initial: Initial percentage of time guest cpus are # throttled when migration auto-converge is activat= ed. # The default value is 20. (Since 2.7) @@ -752,6 +760,7 @@ '*compress-threads': 'int', '*compress-wait-thread': 'bool', '*decompress-threads': 'int', + '*throttle-trigger-threshold': 'int', '*cpu-throttle-initial': 'int', '*cpu-throttle-increment': 'int', '*tls-creds': 'StrOrNull', @@ -813,6 +822,10 @@ # # @decompress-threads: decompression thread count # +# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_x= fer_period +# to trigger throttling. It is expressed as p= ercentage. +# The default value is 50. (Since 5.0) +# # @cpu-throttle-initial: Initial percentage of time guest cpus are # throttled when migration auto-converge is activat= ed. # (Since 2.7) @@ -905,6 +918,7 @@ '*compress-threads': 'uint8', '*compress-wait-thread': 'bool', '*decompress-threads': 'uint8', + '*throttle-trigger-threshold': 'uint8', '*cpu-throttle-initial': 'uint8', '*cpu-throttle-increment': 'uint8', '*tls-creds': 'str', --=20 2.24.1 From nobody Fri May 3 22:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584095613; cv=none; d=zohomail.com; s=zohoarc; b=Q44JILydExFcrrX2SWKjVo0B4BtE5zvGYKPNRvZyeL3JoVrcUSpcITzZ+k7pIKqW3puV+IOSg34Ed+WqBr98Euvhk9wdCCvUJhSiXB5ZAdNE0UHbJGj3SHJMuIgHR2M+MP9/4KgytJQ51UH/z1+tYlBENXEndOI7wOqKoxkIe8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584095613; h=Content-Type:Content-Transfer-Encoding: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; bh=fciT879zSkhcAGmUXRf98FMw7LxC/2yx1e2Pv/uU6aM=; b=MPiP1EBR82Lf3GsUMXNQUbNN+K9qv7SvlTqRMDF7+7cr2/QcVt+eDFEq+5YXYUBJTWCORb7S9qrZg+9SWg/3Ns4xDwPz625/ZziSV8pJJERa/lqvqvZQCFortdUppFOdnG6TJU2ODuJD9ZmJXt5M9SgLYTphIfx6Jw8k6NuVQGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584095613855416.55209439273517; Fri, 13 Mar 2020 03:33:33 -0700 (PDT) Received: from localhost ([::1]:56686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChdE-00032D-S1 for importer@patchew.org; Fri, 13 Mar 2020 06:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39014) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChae-0008MD-R2 for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jChad-0005wq-1f for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:52 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:22709 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jChac-0005ud-TP for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-gFIuVPbOMPacTUoVdhessQ-1; Fri, 13 Mar 2020 06:30:48 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BEB4107ACCA; Fri, 13 Mar 2020 10:30:47 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71F418FBE1; Fri, 13 Mar 2020 10:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584095450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fciT879zSkhcAGmUXRf98FMw7LxC/2yx1e2Pv/uU6aM=; b=CIzCsZyeWgDEiGJj8Ga1L4zfjWLg71uRI+WAkFd6rhlV6VEPrdCZA2OC2JIh/RQMZvSwdO jdiQRIcJV4vpGlCCGDGIbsPrVJT6+fI1tXFt4FL/yztDhuJg5dTWsR3gjKDfWY+ulcmAkP WSE+CPa6rdjbmkuysLS/yEODM35zjj8= X-MC-Unique: gFIuVPbOMPacTUoVdhessQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com, zhukeqian1@huawei.com, quintela@redhat.com Subject: [PULL 3/5] COLO: Optimize memory back-up process Date: Fri, 13 Mar 2020 10:30:37 +0000 Message-Id: <20200313103039.150133-4-dgilbert@redhat.com> In-Reply-To: <20200313103039.150133-1-dgilbert@redhat.com> References: <20200313103039.150133-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: zhanghailiang This patch will reduce the downtime of VM for the initial process, Previously, we copied all these memory in preparing stage of COLO while we need to stop VM, which is a time-consuming process. Here we optimize it by a trick, back-up every page while in migration process while COLO is enabled, though it affects the speed of the migration, but it obviously reduce the downtime of back-up all SVM'S memory in COLO preparing stage. Signed-off-by: zhanghailiang Message-Id: <20200224065414.36524-5-zhang.zhanghailiang@huawei.com> Signed-off-by: Dr. David Alan Gilbert minor typo fixes --- migration/colo.c | 3 +++ migration/ram.c | 66 +++++++++++++++++++++++++++++++++++------------- migration/ram.h | 1 + 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 93c5a452fb..44942c4e23 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -26,6 +26,7 @@ #include "qemu/main-loop.h" #include "qemu/rcu.h" #include "migration/failover.h" +#include "migration/ram.h" #ifdef CONFIG_REPLICATION #include "replication.h" #endif @@ -845,6 +846,8 @@ void *colo_process_incoming_thread(void *opaque) */ qemu_file_set_blocking(mis->from_src_file, true); =20 + colo_incoming_start_dirty_log(); + bioc =3D qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE); fb =3D qemu_fopen_channel_input(QIO_CHANNEL(bioc)); object_unref(OBJECT(bioc)); diff --git a/migration/ram.c b/migration/ram.c index 02cfd76d19..31f4a9dc09 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2994,7 +2994,6 @@ int colo_init_ram_cache(void) } return -errno; } - memcpy(block->colo_cache, block->host, block->used_length); } } =20 @@ -3008,19 +3007,36 @@ int colo_init_ram_cache(void) =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { unsigned long pages =3D block->max_length >> TARGET_PAGE_BITS; - block->bmap =3D bitmap_new(pages); - bitmap_set(block->bmap, 0, pages); } } - ram_state =3D g_new0(RAMState, 1); - ram_state->migration_dirty_pages =3D 0; - qemu_mutex_init(&ram_state->bitmap_mutex); - memory_global_dirty_log_start(); =20 + ram_state_init(&ram_state); return 0; } =20 +/* TODO: duplicated with ram_init_bitmaps */ +void colo_incoming_start_dirty_log(void) +{ + RAMBlock *block =3D NULL; + /* For memory_global_dirty_log_start below. */ + qemu_mutex_lock_iothread(); + qemu_mutex_lock_ramlist(); + + memory_global_dirty_log_sync(); + WITH_RCU_READ_LOCK_GUARD() { + RAMBLOCK_FOREACH_NOT_IGNORED(block) { + ramblock_sync_dirty_bitmap(ram_state, block); + /* Discard this dirty bitmap record */ + bitmap_zero(block->bmap, block->max_length >> TARGET_PAGE_BITS= ); + } + memory_global_dirty_log_start(); + } + ram_state->migration_dirty_pages =3D 0; + qemu_mutex_unlock_ramlist(); + qemu_mutex_unlock_iothread(); +} + /* It is need to hold the global lock to call this helper */ void colo_release_ram_cache(void) { @@ -3040,9 +3056,7 @@ void colo_release_ram_cache(void) } } } - qemu_mutex_destroy(&ram_state->bitmap_mutex); - g_free(ram_state); - ram_state =3D NULL; + ram_state_cleanup(&ram_state); } =20 /** @@ -3356,7 +3370,7 @@ static int ram_load_precopy(QEMUFile *f) =20 while (!ret && !(flags & RAM_SAVE_FLAG_EOS)) { ram_addr_t addr, total_ram_bytes; - void *host =3D NULL; + void *host =3D NULL, *host_bak =3D NULL; uint8_t ch; =20 /* @@ -3387,20 +3401,35 @@ static int ram_load_precopy(QEMUFile *f) RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) { RAMBlock *block =3D ram_block_from_stream(f, flags); =20 + host =3D host_from_ram_block_offset(block, addr); /* - * After going into COLO, we should load the Page into colo_ca= che. + * After going into COLO stage, we should not load the page + * into SVM's memory directly, we put them into colo_cache fir= stly. + * NOTE: We need to keep a copy of SVM's ram in colo_cache. + * Previously, we copied all these memory in preparing stage o= f COLO + * while we need to stop VM, which is a time-consuming process. + * Here we optimize it by a trick, back-up every page while in + * migration process while COLO is enabled, though it affects = the + * speed of the migration, but it obviously reduce the downtim= e of + * back-up all SVM'S memory in COLO preparing stage. */ - if (migration_incoming_in_colo_state()) { - host =3D colo_cache_from_block_offset(block, addr); - } else { - host =3D host_from_ram_block_offset(block, addr); + if (migration_incoming_colo_enabled()) { + if (migration_incoming_in_colo_state()) { + /* In COLO stage, put all pages into cache temporarily= */ + host =3D colo_cache_from_block_offset(block, addr); + } else { + /* + * In migration stage but before COLO stage, + * Put all pages into both cache and SVM's memory. + */ + host_bak =3D colo_cache_from_block_offset(block, addr); + } } if (!host) { error_report("Illegal RAM offset " RAM_ADDR_FMT, addr); ret =3D -EINVAL; break; } - if (!migration_incoming_in_colo_state()) { ramblock_recv_bitmap_set(block, host); } @@ -3514,6 +3543,9 @@ static int ram_load_precopy(QEMUFile *f) if (!ret) { ret =3D qemu_file_get_error(f); } + if (!ret && host_bak) { + memcpy(host_bak, host, TARGET_PAGE_SIZE); + } } =20 ret |=3D wait_for_decompress_done(); diff --git a/migration/ram.h b/migration/ram.h index a553d40751..5ceaff7cb4 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -66,5 +66,6 @@ int ram_dirty_bitmap_reload(MigrationState *s, RAMBlock *= rb); /* ram cache */ int colo_init_ram_cache(void); void colo_release_ram_cache(void); +void colo_incoming_start_dirty_log(void); =20 #endif --=20 2.24.1 From nobody Fri May 3 22:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584095709; cv=none; d=zohomail.com; s=zohoarc; b=FEZ3b/2Suld+WnaLPl7MtWlSkeRqvG76YKNG6qegGmrsDoHo67qvajZVyrH9rWBYMMRMlDYCmeRclokbWEOdDi5cQHrpvnBbpYYxqg0A+5uwkU782cIA9z5YVlPaDZ3UBuI9ti2bZYWGrht+lwfjtKiinVEnXEdRFeDpptU33GA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584095709; h=Content-Type:Content-Transfer-Encoding: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; bh=IoS97/vnReQKjmCvIt3PaY5H5AiaLEfodgcBzzWrux4=; b=doOcUBL3fIZ+xaSyAl6BUyAjxDXeTzXK8S54K43nzS9tpBKJ25yKrh2Agz0CcASVJmVO1Gxs5JkYVejEtWQXyqHDd+fJ730LsAMW/XBX8/RADsjOPRuLFevipI3fajTK2u4dERCjCvipJl06cE7Nnq0eGfp/MQzy+TU2+vCPvyE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158409570952040.73760537670603; Fri, 13 Mar 2020 03:35:09 -0700 (PDT) Received: from localhost ([::1]:56694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChem-0003x3-Gz for importer@patchew.org; Fri, 13 Mar 2020 06:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39034) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChaf-0008NB-Ds for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jChae-0005zn-Ao for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:53 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25839 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jChae-0005zM-6i for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-7-PuSvyBMWMTuTXDdMLxq3dw-1; Fri, 13 Mar 2020 06:30:49 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1E061922960; Fri, 13 Mar 2020 10:30:48 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE4608B773; Fri, 13 Mar 2020 10:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584095451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IoS97/vnReQKjmCvIt3PaY5H5AiaLEfodgcBzzWrux4=; b=hW4LA7CzmXcfrXPXnLn7CtuhsYLsrBTWoMiFytM5w9oweT6zePdg0axzqeArUiGeFipM2D PYgpzqmg5ew6TxSakg1MfQXqoKGPTivo+j3aPu3vvU533FxhTGLJurtsHIshF5laQPJwPF i3JA9HIaV/IfceqXghR4z3cmWAiHt2c= X-MC-Unique: PuSvyBMWMTuTXDdMLxq3dw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com, zhukeqian1@huawei.com, quintela@redhat.com Subject: [PULL 4/5] ram/colo: only record bitmap of dirty pages in COLO stage Date: Fri, 13 Mar 2020 10:30:38 +0000 Message-Id: <20200313103039.150133-5-dgilbert@redhat.com> In-Reply-To: <20200313103039.150133-1-dgilbert@redhat.com> References: <20200313103039.150133-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: zhanghailiang It is only need to record bitmap of dirty pages while goes into COLO stage. Signed-off-by: zhanghailiang Message-Id: <20200224065414.36524-6-zhang.zhanghailiang@huawei.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 31f4a9dc09..c12cfdbe26 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2742,7 +2742,7 @@ static inline void *host_from_ram_block_offset(RAMBlo= ck *block, } =20 static inline void *colo_cache_from_block_offset(RAMBlock *block, - ram_addr_t offset) + ram_addr_t offset, bool record_bitmap) { if (!offset_in_ramblock(block, offset)) { return NULL; @@ -2758,7 +2758,8 @@ static inline void *colo_cache_from_block_offset(RAMB= lock *block, * It help us to decide which pages in ram cache should be flushed * into VM's RAM later. */ - if (!test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) { + if (record_bitmap && + !test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) { ram_state->migration_dirty_pages++; } return block->colo_cache + offset; @@ -3416,13 +3417,13 @@ static int ram_load_precopy(QEMUFile *f) if (migration_incoming_colo_enabled()) { if (migration_incoming_in_colo_state()) { /* In COLO stage, put all pages into cache temporarily= */ - host =3D colo_cache_from_block_offset(block, addr); + host =3D colo_cache_from_block_offset(block, addr, tru= e); } else { /* * In migration stage but before COLO stage, * Put all pages into both cache and SVM's memory. */ - host_bak =3D colo_cache_from_block_offset(block, addr); + host_bak =3D colo_cache_from_block_offset(block, addr,= false); } } if (!host) { --=20 2.24.1 From nobody Fri May 3 22:39:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584095776; cv=none; d=zohomail.com; s=zohoarc; b=hEAnyR3eNdfN3jcn9q5yUbx3Ex+9+O5FBHCs5qoPgALKJajAVWejHFvXxj7TnTbTmJO8Th2tlZyxdgkWVhqRcGL6C/dWcbOsmqURxqyC/S/nUubTb6ZQjcvwvHYlUpOqjh+g4zf++GhJgyzqysKd7t5zdzuYO+JfDEBA5ieB+cY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584095776; h=Content-Type:Content-Transfer-Encoding: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; bh=Jg6I2rHJFJo3oQEwS/VJa7D6UAlAcUHnkuu+usViVfg=; b=YgB79ZHf/jhJ4OCNCKccdGM8f1OdiVFvxPKGKKedDH/F/eHqr4R7xqiS0lpWn5348Uqb6D9muZuI3lNJv1Pi/PhWrGEFWIJFeSlV7MtYz9pqMgAlscghAIEWV+HJPJEYRcOU7GCR1qlkEvJeGDLdrCdnjY6kW/sC64F+2GrGeCk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15840957760330.7422953032032638; Fri, 13 Mar 2020 03:36:16 -0700 (PDT) Received: from localhost ([::1]:56722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChfq-0005jY-Vs for importer@patchew.org; Fri, 13 Mar 2020 06:36:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39082) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jChag-0008PX-MA for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jChaf-000646-Jo for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39193 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jChaf-000628-Fo for qemu-devel@nongnu.org; Fri, 13 Mar 2020 06:30:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-3kqMX2ixPRamFDGmFBTyEQ-1; Fri, 13 Mar 2020 06:30:51 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EA38DB20; Fri, 13 Mar 2020 10:30:50 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16FA28B773; Fri, 13 Mar 2020 10:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584095453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jg6I2rHJFJo3oQEwS/VJa7D6UAlAcUHnkuu+usViVfg=; b=VG7M1zijxfdd+Cyuosm7bip3exRV8xLkkVT+Ex6tdjkQzb3DQtTsjFXthc2y7ZcvCb2WST tSW8SEBaQNOIYCM814Do0X6XmJKytYXrifMj8li9I3oC88PrQOl4Wuwwl9/nmBO4dCb2of owhLkF8BE6qcyihNM5BWQ46s7A9eORM= X-MC-Unique: 3kqMX2ixPRamFDGmFBTyEQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com, zhukeqian1@huawei.com, quintela@redhat.com Subject: [PULL 5/5] migration: recognize COLO as part of activating process Date: Fri, 13 Mar 2020 10:30:39 +0000 Message-Id: <20200313103039.150133-6-dgilbert@redhat.com> In-Reply-To: <20200313103039.150133-1-dgilbert@redhat.com> References: <20200313103039.150133-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: zhanghailiang We will migrate parts of dirty pages backgroud lively during the gap time of two checkpoints, without this modification, it will not work because ram_save_iterate() will check it before send RAM_SAVE_FLAG_EOS at the end of it. Signed-off-by: zhanghailiang Message-Id: <20200224065414.36524-7-zhang.zhanghailiang@huawei.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/migration/migration.c b/migration/migration.c index 59da5d0625..c1d88ace7f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -854,6 +854,7 @@ bool migration_is_setup_or_active(int state) case MIGRATION_STATUS_PRE_SWITCHOVER: case MIGRATION_STATUS_DEVICE: case MIGRATION_STATUS_WAIT_UNPLUG: + case MIGRATION_STATUS_COLO: return true; =20 default: --=20 2.24.1