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 1530096912543743.9302921578786; Wed, 27 Jun 2018 03:55:12 -0700 (PDT) Received: from localhost ([::1]:58031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY86R-0008Rg-TB for importer@patchew.org; Wed, 27 Jun 2018 06:55:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY82o-00060I-L0 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fY82n-0002qZ-Ld for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40480 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 1fY82n-0002q1-Gw for qemu-devel@nongnu.org; Wed, 27 Jun 2018 06:51:25 -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 0ADFC77888 for ; Wed, 27 Jun 2018 10:51:25 +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 86E98111DD1D; Wed, 27 Jun 2018 10:51:22 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 18:51:09 +0800 Message-Id: <20180627105112.31401-3-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:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 10:51:25 +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 2/5] migration: move income process out of multifd 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" Move the call to migration_incoming_process() out of multifd code. It's a bit strange that we can migration generic calls in multifd code. Instead, let multifd_recv_new_channel() return a boolean showing whether it's ready to continue the incoming migration. Signed-off-by: Peter Xu --- migration/ram.h | 2 +- migration/migration.c | 5 ++++- migration/ram.c | 11 +++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index d386f4d641..457bf54b8c 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -46,7 +46,7 @@ int multifd_save_cleanup(Error **errp); int multifd_load_setup(void); int multifd_load_cleanup(Error **errp); bool multifd_recv_all_channels_created(void); -void multifd_recv_new_channel(QIOChannel *ioc); +bool multifd_recv_new_channel(QIOChannel *ioc); =20 uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t = len); diff --git a/migration/migration.c b/migration/migration.c index e1eaa97df4..6ecea2de30 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -507,7 +507,10 @@ void migration_ioc_process_incoming(QIOChannel *ioc) migration_incoming_setup(f); return; } - multifd_recv_new_channel(ioc); + + if (multifd_recv_new_channel(ioc)) { + migration_incoming_process(); + } } =20 /** diff --git a/migration/ram.c b/migration/ram.c index cd5f55117d..52167d5142 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -873,7 +873,8 @@ bool multifd_recv_all_channels_created(void) return thread_count =3D=3D atomic_read(&multifd_recv_state->count); } =20 -void multifd_recv_new_channel(QIOChannel *ioc) +/* Return true if multifd is ready for the migration, otherwise false */ +bool multifd_recv_new_channel(QIOChannel *ioc) { MultiFDRecvParams *p; Error *local_err =3D NULL; @@ -882,7 +883,7 @@ void multifd_recv_new_channel(QIOChannel *ioc) id =3D multifd_recv_initial_packet(ioc, &local_err); if (id < 0) { multifd_recv_terminate_threads(local_err); - return; + return false; } =20 p =3D &multifd_recv_state->params[id]; @@ -890,7 +891,7 @@ void multifd_recv_new_channel(QIOChannel *ioc) error_setg(&local_err, "multifd: received id '%d' already setup'", id); multifd_recv_terminate_threads(local_err); - return; + return false; } p->c =3D ioc; object_ref(OBJECT(ioc)); @@ -899,9 +900,7 @@ void multifd_recv_new_channel(QIOChannel *ioc) qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p, QEMU_THREAD_JOINABLE); atomic_inc(&multifd_recv_state->count); - if (multifd_recv_state->count =3D=3D migrate_multifd_channels()) { - migration_incoming_process(); - } + return multifd_recv_state->count =3D=3D migrate_multifd_channels(); } =20 /** --=20 2.17.1