From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 47390C77B61 for ; Tue, 25 Apr 2023 16:32:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prLa5-0005x8-4i; Tue, 25 Apr 2023 12:31:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prLZk-0005gY-Lo for qemu-devel@nongnu.org; Tue, 25 Apr 2023 12:31:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prLZd-0007d8-G6 for qemu-devel@nongnu.org; Tue, 25 Apr 2023 12:31:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682440284; 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=Nyuxbv02fnRDCj3GWYLVmlzioJpa5mLFSzC/Mx81SHM=; b=ewGR78uzLbi4IRqvflK3DpQT4rnyFkiwaf52M6iEWw9w4xogFbHhyXpMc97IpD+yRY6PHg 70qObKkzBxPtaWBR5b2XQvpN40i0Mf5/6LvzmZGCqa6VJJDuP5mqlidfADpSr17NV4GqLb q1MdJ86/WakC4kQJVKQ20dMmV5hse8s= 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-531-3YF8iTgjNo6uAGvSEDpFFA-1; Tue, 25 Apr 2023 12:31:21 -0400 X-MC-Unique: 3YF8iTgjNo6uAGvSEDpFFA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 705473C117B6; Tue, 25 Apr 2023 16:31:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE9EB40C2064; Tue, 25 Apr 2023 16:31:18 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Yanan Wang , Marcel Apfelbaum , Juan Quintela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , Eduardo Habkost , Leonardo Bras , "Dr . David Alan Gilbert" Subject: [PATCH v8 2/3] multifd: Protect multifd_send_sync_main() calls Date: Tue, 25 Apr 2023 18:31:13 +0200 Message-Id: <20230425163114.2609-3-quintela@redhat.com> In-Reply-To: <20230425163114.2609-1-quintela@redhat.com> References: <20230425163114.2609-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Signed-off-by: Juan Quintela --- 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 229714045a..93ff9988e3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3395,9 +3395,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->pss[RAM_CHANNEL_PRECOPY].pss_channel); - if (ret < 0) { - return ret; + if (migrate_multifd_flush_after_each_section()) { + ret = multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_channel); + if (ret < 0) { + return ret; + } } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); @@ -4154,7 +4156,9 @@ int ram_load_postcopy(QEMUFile *f, int channel) case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_flush_after_each_section()) { + multifd_recv_sync_main(); + } break; default: error_report("Unknown combination of migration flags: 0x%x" @@ -4425,7 +4429,9 @@ static int ram_load_precopy(QEMUFile *f) break; case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_flush_after_each_section()) { + multifd_recv_sync_main(); + } break; default: if (flags & RAM_SAVE_FLAG_HOOK) { -- 2.40.0