From nobody Wed Nov 5 16:47:45 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 153493942289124.398359234624877; Wed, 22 Aug 2018 05:03:42 -0700 (PDT) Received: from localhost ([::1]:58651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRrR-000824-PC for importer@patchew.org; Wed, 22 Aug 2018 08:03:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRpI-0006oU-Ro for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsRpH-00008A-TD for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46198 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 1fsRpH-00007w-NB for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:27 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 61D9C26346; Wed, 22 Aug 2018 12:01:27 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0668A9E69; Wed, 22 Aug 2018 12:01:25 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 22 Aug 2018 14:00:44 +0200 Message-Id: <20180822120050.12694-15-quintela@redhat.com> In-Reply-To: <20180822120050.12694-1-quintela@redhat.com> References: <20180822120050.12694-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 22 Aug 2018 12:01:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 22 Aug 2018 12:01:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 14/20] migration: poll the cm event for destination qemu 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: lvivier@redhat.com, Lidong Chen , dgilbert@redhat.com, peterx@redhat.com, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lidong Chen The destination qemu only poll the comp_channel->fd in qemu_rdma_wait_comp_channel. But when source qemu disconnnect the rdma connection, the destination qemu should be notified. Signed-off-by: Lidong Chen Reviewed-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/migration.c | 3 ++- migration/rdma.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 6f2b506335..4d76bee0da 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -390,6 +390,7 @@ static void process_incoming_migration_co(void *opaque) int ret; =20 assert(mis->from_src_file); + mis->migration_incoming_co =3D qemu_coroutine_self(); mis->largest_page_size =3D qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, @@ -419,7 +420,6 @@ static void process_incoming_migration_co(void *opaque) =20 /* we get COLO info, and know if we are in COLO mode */ if (!ret && migration_incoming_enable_colo()) { - mis->migration_incoming_co =3D qemu_coroutine_self(); qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); mis->have_colo_incoming_thread =3D true; @@ -443,6 +443,7 @@ static void process_incoming_migration_co(void *opaque) } mis->bh =3D qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); + mis->migration_incoming_co =3D NULL; } =20 static void migration_incoming_setup(QEMUFile *f) diff --git a/migration/rdma.c b/migration/rdma.c index 1affc46937..ae07515e83 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3226,6 +3226,35 @@ err: =20 static void rdma_accept_incoming_migration(void *opaque); =20 +static void rdma_cm_poll_handler(void *opaque) +{ + RDMAContext *rdma =3D opaque; + int ret; + struct rdma_cm_event *cm_event; + MigrationIncomingState *mis =3D migration_incoming_get_current(); + + ret =3D rdma_get_cm_event(rdma->channel, &cm_event); + if (ret) { + error_report("get_cm_event failed %d", errno); + return; + } + rdma_ack_cm_event(cm_event); + + if (cm_event->event =3D=3D RDMA_CM_EVENT_DISCONNECTED || + cm_event->event =3D=3D RDMA_CM_EVENT_DEVICE_REMOVAL) { + error_report("receive cm event, cm event is %d", cm_event->event); + rdma->error_state =3D -EPIPE; + if (rdma->return_path) { + rdma->return_path->error_state =3D -EPIPE; + } + + if (mis->migration_incoming_co) { + qemu_coroutine_enter(mis->migration_incoming_co); + } + return; + } +} + static int qemu_rdma_accept(RDMAContext *rdma) { RDMACapabilities cap; @@ -3326,7 +3355,8 @@ static int qemu_rdma_accept(RDMAContext *rdma) NULL, (void *)(intptr_t)rdma->return_path); } else { - qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL); + qemu_set_fd_handler(rdma->channel->fd, rdma_cm_poll_handler, + NULL, rdma); } =20 ret =3D rdma_accept(rdma->cm_id, &conn_param); --=20 2.17.1