From nobody Tue Nov 4 16:07:12 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504083444481741.8375038189087; Wed, 30 Aug 2017 01:57:24 -0700 (PDT) Received: from localhost ([::1]:49128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmyoM-0003TX-93 for importer@patchew.org; Wed, 30 Aug 2017 04:57:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmyTS-00019n-Ak for qemu-devel@nongnu.org; Wed, 30 Aug 2017 04:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmyTR-0004eY-6f for qemu-devel@nongnu.org; Wed, 30 Aug 2017 04:35:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmyTQ-0004e4-TP for qemu-devel@nongnu.org; Wed, 30 Aug 2017 04:35:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0192806B4; Wed, 30 Aug 2017 08:35:43 +0000 (UTC) Received: from pxdev.xzpeter.org.com (dhcp-14-103.nay.redhat.com [10.66.14.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6C7284792; Wed, 30 Aug 2017 08:35:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E0192806B4 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=peterx@redhat.com From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 30 Aug 2017 16:32:28 +0800 Message-Id: <1504081950-2528-32-git-send-email-peterx@redhat.com> In-Reply-To: <1504081950-2528-1-git-send-email-peterx@redhat.com> References: <1504081950-2528-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 30 Aug 2017 08:35:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC v2 31/33] migration: store listen task tag 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: Laurent Vivier , Andrea Arcangeli , Juan Quintela , Alexey Perevalov , peterx@redhat.com, "Dr . David Alan Gilbert" 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" Store the task tag for migration types: tcp/unix/fd/exec in current MigrationIncomingState struct. For defered migration, no need to store task tag since there is no task running in the main loop at all. For RDMA, let's mark it as todo. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 22 ++++++++++++++++++---- migration/migration.h | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c9b7085..daf356b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -171,6 +171,7 @@ void migration_incoming_state_destroy(void) mis->from_src_file =3D NULL; } =20 + mis->listen_task_tag =3D 0; qemu_event_destroy(&mis->main_thread_load_event); } =20 @@ -265,25 +266,31 @@ int migrate_send_rp_req_pages(MigrationIncomingState = *mis, const char *rbname, void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; + guint task_tag =3D 0; + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 qapi_event_send_migration(MIGRATION_STATUS_SETUP, &error_abort); if (!strcmp(uri, "defer")) { deferred_incoming_migration(errp); } else if (strstart(uri, "tcp:", &p)) { - tcp_start_incoming_migration(p, errp); + task_tag =3D tcp_start_incoming_migration(p, errp); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { + /* TODO: store task tag for RDMA migrations */ rdma_start_incoming_migration(p, errp); #endif } else if (strstart(uri, "exec:", &p)) { - exec_start_incoming_migration(p, errp); + task_tag =3D exec_start_incoming_migration(p, errp); } else if (strstart(uri, "unix:", &p)) { - unix_start_incoming_migration(p, errp); + task_tag =3D unix_start_incoming_migration(p, errp); } else if (strstart(uri, "fd:", &p)) { - fd_start_incoming_migration(p, errp); + task_tag =3D fd_start_incoming_migration(p, errp); } else { error_setg(errp, "unknown migration protocol: %s", uri); + return; } + + mis->listen_task_tag =3D task_tag; } =20 static void process_incoming_migration_bh(void *opaque) @@ -422,6 +429,13 @@ void migration_fd_process_incoming(QEMUFile *f) co =3D qemu_coroutine_create(process_incoming_migration_co, f); qemu_coroutine_enter(co); } + + /* + * When reach here, we should not need the listening port any + * more. We'll detach the listening task soon, let's reset the + * listen task tag. + */ + mis->listen_task_tag =3D 0; } =20 /* diff --git a/migration/migration.h b/migration/migration.h index d041369..1f4faef 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -26,6 +26,8 @@ /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; + /* Task tag for incoming listen port. Valid when >0. */ + guint listen_task_tag; =20 /* * Free at the start of the main state load, set as the main thread fi= nishes --=20 2.7.4