From nobody Tue Nov 4 15:25:24 2025 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530096914336918.9836455580056; Wed, 27 Jun 2018 03:55:14 -0700 (PDT) Received: from localhost ([::1]:58032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY86T-0008Ss-G3 for importer@patchew.org; Wed, 27 Jun 2018 06:55:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY830-00068z-NP for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fY82z-00032U-HX for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40488 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fY82z-00031n-B9 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B433F77888 for ; Wed, 27 Jun 2018 10:51:36 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-57.pek2.redhat.com [10.72.12.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C10821117658; Wed, 27 Jun 2018 10:51:32 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 18:51:12 +0800 Message-Id: <20180627105112.31401-6-peterx@redhat.com> In-Reply-To: <20180627105112.31401-1-peterx@redhat.com> References: <20180627105112.31401-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 10:51:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 10:51:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 5/5] migration: unify incoming processing 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" This is the 2nd patch to unbreak postcopy recovery. Let's unify the migration_incoming_process() call at a single place rather than calling it in connection setup codes. This fixes a problem that we will go into incoming migration procedure even if we are trying to recovery from a paused postcopy migration. Fixes: 36c2f8be2c ("migration: Delay start of migration main routines") Signed-off-by: Peter Xu --- migration/exec.c | 3 --- migration/fd.c | 3 --- migration/migration.c | 18 ++++++++++++++++-- migration/socket.c | 5 ----- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/migration/exec.c b/migration/exec.c index 0bbeb63c97..375d2e1b54 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -49,9 +49,6 @@ static gboolean exec_accept_incoming_migration(QIOChannel= *ioc, { migration_channel_process_incoming(ioc); object_unref(OBJECT(ioc)); - if (!migrate_use_multifd()) { - migration_incoming_process(); - } return G_SOURCE_REMOVE; } =20 diff --git a/migration/fd.c b/migration/fd.c index fee34ffdc0..a7c13df4ad 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -49,9 +49,6 @@ static gboolean fd_accept_incoming_migration(QIOChannel *= ioc, { migration_channel_process_incoming(ioc); object_unref(OBJECT(ioc)); - if (!migrate_use_multifd()) { - migration_incoming_process(); - } return G_SOURCE_REMOVE; } =20 diff --git a/migration/migration.c b/migration/migration.c index 5e13b529fd..d6a18c85d7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -501,17 +501,31 @@ static bool postcopy_try_recover(QEMUFile *f) void migration_ioc_process_incoming(QIOChannel *ioc) { MigrationIncomingState *mis =3D migration_incoming_get_current(); + bool start_migration; =20 if (!mis->from_src_file) { + /* The first connection (multifd may have multiple) */ QEMUFile *f =3D qemu_fopen_channel_input(ioc); + + /* If it's a recovery, we're done */ if (postcopy_try_recover(f)) { return; } + migration_incoming_setup(f); - return; + + /* + * Common migration only needs one channel, so we can start + * right now. Multifd needs more than one channel, we wait. + */ + start_migration =3D !migrate_use_multifd(); + } else { + /* Multiple connections */ + assert(migrate_use_multifd()); + start_migration =3D multifd_recv_new_channel(ioc); } =20 - if (multifd_recv_new_channel(ioc)) { + if (start_migration) { migration_incoming_process(); } } diff --git a/migration/socket.c b/migration/socket.c index 3456eb76e9..f4c8174400 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -168,12 +168,7 @@ static void socket_accept_incoming_migration(QIONetLis= tener *listener, if (migration_has_all_channels()) { /* Close listening socket as its no longer needed */ qio_net_listener_disconnect(listener); - object_unref(OBJECT(listener)); - - if (!migrate_use_multifd()) { - migration_incoming_process(); - } } } =20 --=20 2.17.1