From patchwork Thu Jul 28 11:59:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZoJzAsk/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Ltq5X47lyz9sGC for ; Thu, 28 Jul 2022 22:02:23 +1000 (AEST) Received: from localhost ([::1]:46062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Db-0001Tz-OM for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:02:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Ba-0001Mi-4v for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2BT-0001ig-Lj for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EDNsgNORhf5MUfZCXD5Dgxbpg5HCOhY3hdxecTLw2cA=; b=ZoJzAsk/ugeuaTepgpiq4ZsFV7U5JsxdEb+YANIi08DxJFVRbAeSgCgsmgiRjONXA9dKCm Y6S04Z7kEZyzgsQt1j/+Tp9JWOTOfY/BPpAdMaNjKF7UIGGAZC1s9gSToBEGNw2SVoH2nC lpGtDNxDby/BrjluKqGpmMF5AbPWtdw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-4RCJgOFFMG6ywvFr9K1pwg-1; Thu, 28 Jul 2022 08:00:03 -0400 X-MC-Unique: 4RCJgOFFMG6ywvFr9K1pwg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 092C7185A7A4; Thu, 28 Jul 2022 12:00:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DB5D90A11; Thu, 28 Jul 2022 12:00:01 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 1/6] multifd: Create property multifd-sync-after-each-section Date: Thu, 28 Jul 2022 13:59:52 +0200 Message-Id: <20220728115957.5554-2-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We used to synchronize all channels at the end of each RAM section sent. That is not needed, so preparing to only synchronize once every full round in latests patches. Notice that we initialize the property as true. We will change the default when we introduce the new mechanism. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Rename each-iteration to after-each-section Signed-off-by: Juan Quintela --- migration/migration.h | 6 ++++++ hw/core/machine.c | 1 + migration/migration.c | 11 ++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/migration/migration.h b/migration/migration.h index cdad8aceaa..6abd2a51f5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -373,6 +373,11 @@ struct MigrationState { * This save hostname when out-going migration starts */ char *hostname; + /* + * Synchronize channels after each section is sent. + * We used to do that on the past, but it is suboptimal. + */ + bool multifd_sync_after_each_section; }; void migrate_set_state(int *state, int old_state, int new_state); @@ -415,6 +420,7 @@ int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); +bool migrate_multifd_sync_after_each_section(void); #ifdef CONFIG_LINUX bool migrate_use_zero_copy_send(void); diff --git a/hw/core/machine.c b/hw/core/machine.c index a673302cce..9645a25f8f 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -43,6 +43,7 @@ GlobalProperty hw_compat_7_0[] = { { "arm-gicv3-common", "force-8-bit-prio", "on" }, { "nvme-ns", "eui64-default", "on"}, + { "migration", "multifd-sync-after-each-section", "on"}, }; const size_t hw_compat_7_0_len = G_N_ELEMENTS(hw_compat_7_0); diff --git a/migration/migration.c b/migration/migration.c index e03f698a3c..ebca4f2d8a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2592,6 +2592,13 @@ bool migrate_use_multifd(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; } +bool migrate_multifd_sync_after_each_section(void) +{ + MigrationState *s = migrate_get_current(); + + return s->multifd_sync_after_each_section; +} + bool migrate_pause_before_switchover(void) { MigrationState *s; @@ -4384,7 +4391,9 @@ static Property migration_properties[] = { DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_hostname), DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), - + /* We will change to false when we introduce the new mechanism */ + DEFINE_PROP_BOOL("multifd-sync-after-each-section", MigrationState, + multifd_sync_after_each_section, true), /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL), From patchwork Thu Jul 28 11:59:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N7er+QXf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LtqBh3CFHz9sGG for ; Thu, 28 Jul 2022 22:06:52 +1000 (AEST) Received: from localhost ([::1]:54636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Hv-0007aM-2R for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Bc-0001Tc-CG for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2BX-0001uU-4R for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5qdRb6gqRIKnblEV7C9qQdk26wiQGLGm8w/a6dGQnj0=; b=N7er+QXfQFm3RDGMLJai79WJXrG6qKoEPlWUyhjuBiG8+RsDZpQq0zqHLcxUDGCXnlQqMM kqjFgX/hAfq142pDo4QzQCS0AUE9AOzx0qm9cV3q91HKE2dDsRH+xG667ZEJjm1EsuyWTi +64IrDG0hkHIMMlSn2kmwbcDPqsm2w0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-7X370mTLPh2inPykRuCqvw-1; Thu, 28 Jul 2022 08:00:05 -0400 X-MC-Unique: 7X370mTLPh2inPykRuCqvw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 234BA380115C; Thu, 28 Jul 2022 12:00:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 549C018EB5; Thu, 28 Jul 2022 12:00:03 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 2/6] multifd: Protect multifd_send_sync_main() calls Date: Thu, 28 Jul 2022 13:59:53 +0200 Message-Id: <20220728115957.5554-3-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We only need to do that on the ram_save_iterate() call on sending and on destination when we get a RAM_SAVE_FLAG_EOS. In setup() and complete() we need to synch in both new and old cases, so don't add a check there. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Remove the wrappers that we take out on patch 5. --- migration/ram.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index b94669ba5d..6b71ce74f6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3338,9 +3338,11 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) out: if (ret >= 0 && migration_is_setup_or_active(migrate_get_current()->state)) { - ret = multifd_send_sync_main(rs->f); - if (ret < 0) { - return ret; + if (migrate_multifd_sync_after_each_section()) { + ret = multifd_send_sync_main(rs->f); + if (ret < 0) { + return ret; + } } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); @@ -4084,7 +4086,9 @@ int ram_load_postcopy(QEMUFile *f, int channel) case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_sync_after_each_section()) { + multifd_recv_sync_main(); + } break; default: error_report("Unknown combination of migration flags: 0x%x" @@ -4361,7 +4365,9 @@ static int ram_load_precopy(QEMUFile *f) break; case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_sync_after_each_section()) { + multifd_recv_sync_main(); + } break; default: if (flags & RAM_SAVE_FLAG_HOOK) { From patchwork Thu Jul 28 11:59:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gHmiXRx4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Ltq5X4KrNz9sGG for ; Thu, 28 Jul 2022 22:02:23 +1000 (AEST) Received: from localhost ([::1]:46050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Dc-0001TC-44 for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:02:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Ba-0001Od-Sn for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30040) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2BX-0001vS-88 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9eQXzjiIYrGn1Mps/yU0K3o9rMppIzKMyUPjXLAgpqQ=; b=gHmiXRx43TjhiE5jSiFsYvBoPiNTwP5947dMV9qIRIHZtHoZ29RU4eVlChxA+BQ3u7gNMU ISuhpinIPBVd2U2yCVTRasrMdQJQ8Z5l9KHgDFr1CHGw6d4GT7vyjbcEf5Qj/vYz0Ou3aC dUqbbxxVNVs+xxPGjGy1CguLTt7ZxSg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-Hjzye1uRM5SYLVh21JOHrw-1; Thu, 28 Jul 2022 08:00:07 -0400 X-MC-Unique: Hjzye1uRM5SYLVh21JOHrw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E627F3C0CD53; Thu, 28 Jul 2022 12:00:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 729C790A04; Thu, 28 Jul 2022 12:00:05 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 3/6] migration: Simplify ram_find_and_save_block() Date: Thu, 28 Jul 2022 13:59:54 +0200 Message-Id: <20220728115957.5554-4-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We will need later that find_dirty_block() return errors, so simplify the loop. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 6b71ce74f6..c2c939ee03 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2524,7 +2524,6 @@ static int ram_find_and_save_block(RAMState *rs) { PageSearchStatus pss; int pages = 0; - bool again, found; /* No dirty page as there is zero RAM */ if (!ram_bytes_total()) { @@ -2540,27 +2539,25 @@ static int ram_find_and_save_block(RAMState *rs) } do { - again = true; - found = get_queued_page(rs, &pss); - - if (!found) { + if (!get_queued_page(rs, &pss)) { /* * Recover previous precopy ramblock/offset if postcopy has * preempted precopy. Otherwise find the next dirty bit. */ if (postcopy_preempt_triggered(rs)) { postcopy_preempt_restore(rs, &pss, false); - found = true; } else { /* priority queue empty, so just search for something dirty */ - found = find_dirty_block(rs, &pss, &again); + bool again = true; + if (!find_dirty_block(rs, &pss, &again)) { + if (!again) { + break; + } + } } } - - if (found) { - pages = ram_save_host_page(rs, &pss); - } - } while (!pages && again); + pages = ram_save_host_page(rs, &pss); + } while (!pages); rs->last_seen_block = pss.block; rs->last_page = pss.page; From patchwork Thu Jul 28 11:59:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hMEnW7OK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LtqBk03KWz9sGH for ; Thu, 28 Jul 2022 22:06:54 +1000 (AEST) Received: from localhost ([::1]:54590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Hs-0007YL-CO for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:06:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Bf-0001bg-PN for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2BZ-0001vo-3M for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZlPntIRJj9BXF9pQct0SK0auD/ClxUCDfmxA47cebgo=; b=hMEnW7OK506phxxb99M2TwYWVkJiPZx1huAoJW739fk3S+uBC/RKdJvIWhNR2kMKmXYWPA M85X15bnHLLRaL+0kAW1ouHNifFhaiaYIx3gq2ptvh3YY6/C7le981BemHGFthefnHV6iA 75WdM7ly0HO0mi3HRy85YGCZzVKKpKA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-jNkz-ik-PymEg-LUZcWOwg-1; Thu, 28 Jul 2022 08:00:09 -0400 X-MC-Unique: jNkz-ik-PymEg-LUZcWOwg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A34B4811E75; Thu, 28 Jul 2022 12:00:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 459EC18EB5; Thu, 28 Jul 2022 12:00:07 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 4/6] migration: Make find_dirty_block() return a single parameter Date: Thu, 28 Jul 2022 13:59:55 +0200 Message-Id: <20220728115957.5554-5-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We used to return two bools, just return a single int with the following meaning: old return / again / new return false false PAGE_ALL_CLEAN false true PAGE_TRY_AGAIN true true PAGE_DIRTY_FOUND /* We don't care about again at all */ Signed-off-by: Juan Quintela --- migration/ram.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c2c939ee03..1507ba1991 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1532,17 +1532,23 @@ retry: return pages; } +#define PAGE_ALL_CLEAN 0 +#define PAGE_TRY_AGAIN 1 +#define PAGE_DIRTY_FOUND 2 /** * find_dirty_block: find the next dirty page and update any state * associated with the search process. * - * Returns true if a page is found + * Returns: + * PAGE_ALL_CLEAN: no dirty page found, give up + * PAGE_TRY_AGAIN: no dirty page found, retry for next block + * PAGE_DIRTY_FOUND: dirty page found * * @rs: current RAM state * @pss: data about the state of the current dirty page scan * @again: set to false if the search has scanned the whole of RAM */ -static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again) +static int find_dirty_block(RAMState *rs, PageSearchStatus *pss) { /* * This is not a postcopy requested page, mark it "not urgent", and use @@ -1558,8 +1564,7 @@ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again) * We've been once around the RAM and haven't found anything. * Give up. */ - *again = false; - return false; + return PAGE_ALL_CLEAN; } if (!offset_in_ramblock(pss->block, ((ram_addr_t)pss->page) << TARGET_PAGE_BITS)) { @@ -1588,13 +1593,10 @@ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again) } } /* Didn't find anything this time, but try again on the new block */ - *again = true; - return false; + return PAGE_TRY_AGAIN; } else { - /* Can go around again, but... */ - *again = true; - /* We've found something so probably don't need to */ - return true; + /* We've found something */ + return PAGE_DIRTY_FOUND; } } @@ -2538,7 +2540,7 @@ static int ram_find_and_save_block(RAMState *rs) pss.block = QLIST_FIRST_RCU(&ram_list.blocks); } - do { + while (true){ if (!get_queued_page(rs, &pss)) { /* * Recover previous precopy ramblock/offset if postcopy has @@ -2548,16 +2550,21 @@ static int ram_find_and_save_block(RAMState *rs) postcopy_preempt_restore(rs, &pss, false); } else { /* priority queue empty, so just search for something dirty */ - bool again = true; - if (!find_dirty_block(rs, &pss, &again)) { - if (!again) { + int res = find_dirty_block(rs, &pss); + if (res != PAGE_DIRTY_FOUND) { + if (res == PAGE_ALL_CLEAN) { break; + } else if (res == PAGE_TRY_AGAIN) { + continue; } } } } pages = ram_save_host_page(rs, &pss); - } while (!pages); + if (pages) { + break; + } + } rs->last_seen_block = pss.block; rs->last_page = pss.page; From patchwork Thu Jul 28 11:59:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OlHOykj+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LtqBg3wBJz9sGC for ; Thu, 28 Jul 2022 22:06:51 +1000 (AEST) Received: from localhost ([::1]:54870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Hw-0007jp-BU for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:06:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Be-0001Yi-L6 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Bc-0001xl-R6 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fuYKXod9meK5/3kuBVMs3EAPF/cb5AdSc/xEpwKg5J0=; b=OlHOykj+Nwiv61g5N7cc6fKJ1fzw9WYFZhxohIHgD49h77eP8K1XRV1RTDVVq1Ac2T1Dz6 V+7tqkBx6lnEroZ+6S3dkD7bhOs/AMgz7oorKz7fK6/TzWXWkethYJTDFkNvaMg/WXABiO WGnZTTB2kRxjaqDfSnt/xPt8fwotxoU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-6E4Jy28mNCSdoVZ_IESdOw-1; Thu, 28 Jul 2022 08:00:11 -0400 X-MC-Unique: 6E4Jy28mNCSdoVZ_IESdOw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DECF811E76; Thu, 28 Jul 2022 12:00:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1BF594561; Thu, 28 Jul 2022 12:00:08 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 5/6] multifd: Only sync once each full round of memory Date: Thu, 28 Jul 2022 13:59:56 +0200 Message-Id: <20220728115957.5554-6-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We need to add a new flag to mean to sync at that point. Notice that we still synchronize at the end of setup and at the end of complete stages. Signed-off-by: Juan Quintela --- Add missing qemu_fflush(), now it passes all tests always. --- migration/migration.c | 2 +- migration/ram.c | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ebca4f2d8a..7905145d7d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4393,7 +4393,7 @@ static Property migration_properties[] = { DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), /* We will change to false when we introduce the new mechanism */ DEFINE_PROP_BOOL("multifd-sync-after-each-section", MigrationState, - multifd_sync_after_each_section, true), + multifd_sync_after_each_section, false), /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL), diff --git a/migration/ram.c b/migration/ram.c index 1507ba1991..234603ee4f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -82,6 +82,7 @@ #define RAM_SAVE_FLAG_XBZRLE 0x40 /* 0x80 is reserved in migration.h start with 0x100 next */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 +#define RAM_SAVE_FLAG_MULTIFD_SYNC 0x200 XBZRLECacheStats xbzrle_counters; @@ -1540,6 +1541,7 @@ retry: * associated with the search process. * * Returns: + * <0: An error happened * PAGE_ALL_CLEAN: no dirty page found, give up * PAGE_TRY_AGAIN: no dirty page found, retry for next block * PAGE_DIRTY_FOUND: dirty page found @@ -1572,6 +1574,14 @@ static int find_dirty_block(RAMState *rs, PageSearchStatus *pss) pss->page = 0; pss->block = QLIST_NEXT_RCU(pss->block, next); if (!pss->block) { + if (!migrate_multifd_sync_after_each_section()) { + int ret = multifd_send_sync_main(rs->f); + if (ret < 0) { + return ret; + } + qemu_put_be64(rs->f, RAM_SAVE_FLAG_MULTIFD_SYNC); + qemu_fflush(rs->f); + } /* * If memory migration starts over, we will meet a dirtied page * which may still exists in compression threads's ring, so we @@ -2556,6 +2566,9 @@ static int ram_find_and_save_block(RAMState *rs) break; } else if (res == PAGE_TRY_AGAIN) { continue; + } else if (res < 0) { + pages = res; + break; } } } @@ -3232,6 +3245,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque) return ret; } + if (!migrate_multifd_sync_after_each_section()) { + qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_SYNC); + } + qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); @@ -3419,6 +3436,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque) return ret; } + if (!migrate_multifd_sync_after_each_section()) { + qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_SYNC); + } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); @@ -4087,7 +4107,9 @@ int ram_load_postcopy(QEMUFile *f, int channel) } decompress_data_with_multi_threads(f, page_buffer, len); break; - + case RAM_SAVE_FLAG_MULTIFD_SYNC: + multifd_recv_sync_main(); + break; case RAM_SAVE_FLAG_EOS: /* normal exit */ if (migrate_multifd_sync_after_each_section()) { @@ -4367,6 +4389,9 @@ static int ram_load_precopy(QEMUFile *f) break; } break; + case RAM_SAVE_FLAG_MULTIFD_SYNC: + multifd_recv_sync_main(); + break; case RAM_SAVE_FLAG_EOS: /* normal exit */ if (migrate_multifd_sync_after_each_section()) { From patchwork Thu Jul 28 11:59:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1661618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FvwzO7hv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Ltq5f0DYbz9sGC for ; Thu, 28 Jul 2022 22:02:30 +1000 (AEST) Received: from localhost ([::1]:46176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH2Dj-0001aI-Qi for incoming@patchwork.ozlabs.org; Thu, 28 Jul 2022 08:02:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Bd-0001Wq-V4 for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oH2Bc-0001xI-Bl for qemu-devel@nongnu.org; Thu, 28 Jul 2022 08:00:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659009615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UXb1utX6d/dWs0SXVyXsGugRaFi8XCeLP+OgLPZtVpQ=; b=FvwzO7hvmmn7Xl/wbOsUYhoeNCyr2DtC5FqQjdcW/HQ9eSmN7fKLD6jsREGuZuC83j3znl vNX2vJ6GLoL3iepDTkhV1RitipM8CW2UOouDNsC39pW6IhEA1yFcrvi/rcG/Zn7w/fne9p Wq5FSaS/kEsonDrbzVA9ws2p9FUFQV8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-241-66PMlBp4N4aTkDvXi2qKmw-1; Thu, 28 Jul 2022 08:00:12 -0400 X-MC-Unique: 66PMlBp4N4aTkDvXi2qKmw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 187EC8032F1; Thu, 28 Jul 2022 12:00:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE33F18EB5; Thu, 28 Jul 2022 12:00:10 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Juan Quintela , "Dr. David Alan Gilbert" , Eduardo Habkost , Yanan Wang Subject: [PATCH v2 6/6] ram: Document migration ram flags Date: Thu, 28 Jul 2022 13:59:57 +0200 Message-Id: <20220728115957.5554-7-quintela@redhat.com> In-Reply-To: <20220728115957.5554-1-quintela@redhat.com> References: <20220728115957.5554-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 0x80 is RAM_SAVE_FLAG_HOOK, it is in qemu-file now. Bigger usable flag is 0x200, noticing that. We can reuse RAM_SAVe_FLAG_FULL. Signed-off-by: Juan Quintela --- migration/ram.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 234603ee4f..83a48e3889 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -73,16 +73,19 @@ * RAM_SSAVE_FLAG_COMPRESS_PAGE just rename it. */ -#define RAM_SAVE_FLAG_FULL 0x01 /* Obsolete, not used anymore */ +/* RAM_SAVE_FLAG_FULL has been obsoleted since at least 2009, we can + * reuse it */ +#define RAM_SAVE_FLAG_FULL 0x01 #define RAM_SAVE_FLAG_ZERO 0x02 #define RAM_SAVE_FLAG_MEM_SIZE 0x04 #define RAM_SAVE_FLAG_PAGE 0x08 #define RAM_SAVE_FLAG_EOS 0x10 #define RAM_SAVE_FLAG_CONTINUE 0x20 #define RAM_SAVE_FLAG_XBZRLE 0x40 -/* 0x80 is reserved in migration.h start with 0x100 next */ +/* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 #define RAM_SAVE_FLAG_MULTIFD_SYNC 0x200 +/* We can't use any flag that is bigger that 0x200 */ XBZRLECacheStats xbzrle_counters;