From nobody Tue Feb 10 13:01:38 2026 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; dkim=fail; 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=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533562878991740.4914461054685; Mon, 6 Aug 2018 06:41:18 -0700 (PDT) Received: from localhost ([::1]:34178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmfl2-0004ep-PN for importer@patchew.org; Mon, 06 Aug 2018 09:41:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmfaE-0003Ou-7X for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:30:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmfaD-0008Ip-8m for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:30:02 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:33943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmfaD-0008IY-2t for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:30:01 -0400 Received: by mail-pg1-x52a.google.com with SMTP id y5-v6so6251425pgv.1 for ; Mon, 06 Aug 2018 06:30:00 -0700 (PDT) Received: from VM_120_46_centos.localdomain ([119.28.87.64]) by smtp.gmail.com with ESMTPSA id f11-v6sm11756302pfa.131.2018.08.06.06.29.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 06:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mbB7jKMgu1mG/LYryAL3c2j/fz/WLPMVJBJA6CzcPqo=; b=E7OEjXXeJxtIbtD/92mqjQF/LVidRto4mCaWPu9bws7C5uEQcmaq2/HEwA1GqU30aB k6MxNGr+CK9NCAA+lDbgbLw634xqPOMF99TKRYLwtaEVKRGL/M5pX6+ZHutNGRjRiVWl OFBTY/8H/sbFB7XmXvVf94cYh2BqVfFDOO3KP7Ts77vYW6biqs6cbHo4AscdsQ0HJAME 2fcM9Y8Rz+x+LMS3QhfBUBqkVft4hJ6eYeAfVLhpSBYx6dI7iPuoz41YEfC4RJXiCyaS tXhV8CjobGFDQLzRmWB2P9cqDgo4SmaUyM/JHShoMVPzdjr7y6MUXpsOMq5YFICCXhlZ qVbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mbB7jKMgu1mG/LYryAL3c2j/fz/WLPMVJBJA6CzcPqo=; b=OrUFvTzSIZefXFLgfc9PvbfxbbvPmdgbIDLLsQKGajTxe5j3LQ2vyYtiFcdGJy7SQp MqGOm1yLQeOIObr4PRDsLQ51HuWn3UEFacXuG3uGi7Oe8CKcHVzKBUj9zrc++32kjMD3 OThTbaYYpwQTbpSf1cdjdHkuI4PlsUN7NAXfKNRXnQEEobiU5XTgDN8MAobF9eEiganl 9wuhELbQMqL0Z17rMLYLVZaVwAqQIaGb6si339Ztp/pMkr5ooqfyqrfdZeteDKxfKx8U gO/zF7CbT9kCrbetxrikKIq6MMGgLeqrljONWnnutLj/F1deAvkQJCzuvAYFTFKG/N1/ YaEw== X-Gm-Message-State: AOUpUlEOCL06Z/8z8hoCle9II1Ud3a9MLfD2Zcb/v1D+cbnkPy4ybDdl 24tv6ZJLoZKDlQ0PR+43gFo= X-Google-Smtp-Source: AAOMgpdJC3hw7HmJaYrWqpfjhqJ0+g5JVHRmMnGOAoMLBTkBle1zkSDhW/NysRicfgH978I1/36eFA== X-Received: by 2002:a63:5542:: with SMTP id f2-v6mr14710114pgm.37.1533562200275; Mon, 06 Aug 2018 06:30:00 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com Date: Mon, 6 Aug 2018 21:29:35 +0800 Message-Id: <1533562177-16447-10-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533562177-16447-1-git-send-email-lidongchen@tencent.com> References: <1533562177-16447-1-git-send-email-lidongchen@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52a Subject: [Qemu-devel] [PATCH v6 09/11] 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: qemu-devel@nongnu.org, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: Dr. David Alan Gilbert --- 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 df0c2cf..f7d6e26 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -389,6 +389,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, @@ -418,7 +419,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; @@ -442,6 +442,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 1affc46..ae07515 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 1.8.3.1