From patchwork Fri Aug 3 09:13:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 953138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ETbNHjT5"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41hhLL5WCWz9s2g for ; Fri, 3 Aug 2018 19:18:50 +1000 (AEST) Received: from localhost ([::1]:49757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flWES-0004y9-Ct for incoming@patchwork.ozlabs.org; Fri, 03 Aug 2018 05:18:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flWA5-0001Yd-R2 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1flWA4-0001lZ-Ne for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:17 -0400 Received: from mail-pl0-x231.google.com ([2607:f8b0:400e:c01::231]:45562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1flWA4-0001jy-Gu for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:16 -0400 Received: by mail-pl0-x231.google.com with SMTP id j8-v6so2292912pll.12 for ; Fri, 03 Aug 2018 02:14:16 -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=tmaMPgA/4D3Vt0rma7Rf6cf1XnX0c3yLSjIs9mPFLn8=; b=ETbNHjT5QnxDAAQycXz/kyJ2qIUj5yYcU3lgeRp2SLb8ZKyDr3Qv+WJdX5O+yW+lPu 7Pn2aat9CMRRkOnS+Ht3QuK9PFh+tyXTnqhVeCdfCr6vtsopZOGSQ4xzQjYIpFJ8AL8P qH4HzlPCSAEBSNk/6lsNNxPWAY1hkSfKOyRgpb/nB80IQX5ZYCXEFNX5RttELj39gcFQ GF7COtYJ9pbSyvml4fuDca6x0FV4LD/N38KVq5epeRJm7aIXvZa+Lyn12THgA/g6YrTC gLsDsPIYDtwFcR0Ap1+woPMTgJTjFaZ6XQyIpSHcItIscYoydHRUHb2wH3RVwjwaGLdS bsqQ== 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=tmaMPgA/4D3Vt0rma7Rf6cf1XnX0c3yLSjIs9mPFLn8=; b=iFubsy98GsvxbgW/kSooUlpEfE4t+VUDyehAuWhJiCcmfugFgsHBFIxWCIG7RVDI3f QcAPBTmUT/Ti0ccaCcqQVX/UM3KJfZe/FDVBKBZvzUfGe0h44n+LRT7OFuxosbGl4Ctg r5Fsk/ZiHOvQTMyS3EBhe5mg+1kaixvdPc2yxQNfjYdPCysaUv2HvBD4vCobDRs8j4iS +lWdFzaphxCx67FyemJK+/n9B8PawuN5wHKLjIo4G3t2dCPp333zFXKLopKMep1yopy5 zJ2XJccCzNHz4S/iktAjQLG0DTxivunf+SXbe+djhln0oqh4b6lWcwxou5GT3nyhZ0LZ f+qQ== X-Gm-Message-State: AOUpUlGuklsIDlXHs9gqgzP0+uO+49xuj32MPBSGBHWcUxn3gC3F0gqN UpzKYzFiDXq5n1pgG8CFrRw= X-Google-Smtp-Source: AAOMgpeR82VFRCs2qWiL5bxge6ZUbpprXqx7dsw7xa3dlWYLHY6C06If3LY/1q3xK6acGpcg9lF4iQ== X-Received: by 2002:a17:902:8b86:: with SMTP id ay6-v6mr2690224plb.25.1533287655772; Fri, 03 Aug 2018 02:14:15 -0700 (PDT) Received: from VM_120_46_centos.localdomain ([119.28.87.64]) by smtp.gmail.com with ESMTPSA id e21-v6sm7991352pfl.187.2018.08.03.02.14.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 02:14:15 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com Date: Fri, 3 Aug 2018 17:13:48 +0800 Message-Id: <1533287630-4221-11-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533287630-4221-1-git-send-email-lidongchen@tencent.com> References: <1533287630-4221-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:400e:c01::231 Subject: [Qemu-devel] [PATCH v6 10/12] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- migration/migration.c | 3 ++- migration/rdma.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f190964..360ee94 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -389,6 +389,7 @@ static void process_incoming_migration_co(void *opaque) int ret; assert(mis->from_src_file); + mis->migration_incoming_co = qemu_coroutine_self(); mis->largest_page_size = 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) /* we get COLO info, and know if we are in COLO mode */ if (!ret && migration_incoming_enable_colo()) { - mis->migration_incoming_co = 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 = true; @@ -442,6 +442,7 @@ static void process_incoming_migration_co(void *opaque) } mis->bh = qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); + mis->migration_incoming_co = NULL; } static void migration_incoming_setup(QEMUFile *f) diff --git a/migration/rdma.c b/migration/rdma.c index 1affc46..62de2ec 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3226,6 +3226,34 @@ err: static void rdma_accept_incoming_migration(void *opaque); +static void rdma_cm_poll_handler(void *opaque) +{ + RDMAContext *rdma = opaque; + int ret; + struct rdma_cm_event *cm_event; + MigrationIncomingState *mis = migration_incoming_get_current(); + + ret = rdma_get_cm_event(rdma->channel, &cm_event); + if (ret) { + return; + } + + if (cm_event->event == RDMA_CM_EVENT_DISCONNECTED || + cm_event->event == RDMA_CM_EVENT_DEVICE_REMOVAL) { + rdma_ack_cm_event(cm_event); + error_report("receive cm event, cm event is %d", cm_event->event); + rdma->error_state = -EPIPE; + if (rdma->return_path) { + rdma->return_path->error_state = -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 +3354,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); } ret = rdma_accept(rdma->cm_id, &conn_param);