From nobody Mon Nov 25 05:12:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1717503360; cv=none; d=zohomail.com; s=zohoarc; b=irvx2VoF7V2qBd+D03mo9Bd5u9xtjBhjXQIUMorfBDKbJ0kZkcyVWwrUMoIYRY4AHjk60fA7DLl9l8w9lPhE6SkLZqPnrInJUC7LLSIviqADANau6JudTEwAodNnzoqBojzn/DBpR4z4lwE+vDFkTiQICfzIE3awoPtkF6JSnaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717503360; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=Xj84flbXsIyrK7BKdUlvipoc3sqIVn91HxeFGfOP4Ig=; b=YB8IRDBQSgM0MjQk2Z1hPcbDXsxywUe1Vya1wVhNoNTpaM0ybUYghZlfn5zGiGK0BpQBYjxpRPY8tXMSv9d3SOVsr16SYWVzMHhUHJ5AClS1xCnlzCTyDRLaMyXzXcA0KgaDV9XImhII0wVjnDEj8XQZlKCYF1WF0rzOsIAdYQY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717503360581586.565269908597; Tue, 4 Jun 2024 05:16:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sET3r-0003jU-I1; Tue, 04 Jun 2024 08:14:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sET3l-0003gl-Rv for qemu-devel@nongnu.org; Tue, 04 Jun 2024 08:14:37 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sET3i-0006xV-92 for qemu-devel@nongnu.org; Tue, 04 Jun 2024 08:14:37 -0400 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VtqDg1ybZz355fS; Tue, 4 Jun 2024 20:10:43 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id A0ED81A0188; Tue, 4 Jun 2024 20:14:23 +0800 (CST) Received: from DESKTOP-8LI8G6S.china.huawei.com (10.173.124.235) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 4 Jun 2024 20:14:22 +0800 To: CC: , , , , , , , , , , , , , , , Jialin Wang Subject: [PATCH 6/6] migration/rdma: support multifd for RDMA migration Date: Tue, 4 Jun 2024 20:14:12 +0800 Message-ID: <1717503252-51884-7-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.8.2.windows.1 In-Reply-To: <1717503252-51884-1-git-send-email-arei.gonglei@huawei.com> References: <1717503252-51884-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.124.235] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf200006.china.huawei.com (7.185.36.61) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.191; envelope-from=arei.gonglei@huawei.com; helo=szxga05-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Gonglei From: Gonglei via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1717503363541100010 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jialin Wang Signed-off-by: Jialin Wang Signed-off-by: Gonglei --- migration/multifd.c | 10 ++++++++++ migration/rdma.c | 27 +++++++++++++++++++++++++++ migration/rdma.h | 6 ++++++ 3 files changed, 43 insertions(+) diff --git a/migration/multifd.c b/migration/multifd.c index f317bff077..cee9858ad1 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -32,6 +32,7 @@ #include "io/channel-file.h" #include "io/channel-socket.h" #include "yank_functions.h" +#include "rdma.h" =20 /* Multiple fd's */ =20 @@ -793,6 +794,9 @@ static bool multifd_send_cleanup_channel(MultiFDSendPar= ams *p, Error **errp) static void multifd_send_cleanup_state(void) { file_cleanup_outgoing_migration(); +#ifdef CONFIG_RDMA + rdma_cleanup_outgoing_migration(); +#endif socket_cleanup_outgoing_migration(); qemu_sem_destroy(&multifd_send_state->channels_created); qemu_sem_destroy(&multifd_send_state->channels_ready); @@ -1139,6 +1143,12 @@ static bool multifd_new_send_channel_create(gpointer= opaque, Error **errp) return file_send_channel_create(opaque, errp); } =20 +#ifdef CONFIG_RDMA + if (rdma_send_channel_create(multifd_new_send_channel_async, opaque)) { + return true; + } +#endif + socket_send_channel_create(multifd_new_send_channel_async, opaque); return true; } diff --git a/migration/rdma.c b/migration/rdma.c index 09a4de7f59..af4d2b5a5a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -19,6 +19,7 @@ #include "qapi/qapi-visit-sockets.h" #include "channel.h" #include "migration.h" +#include "options.h" #include "rdma.h" #include "trace.h" #include @@ -27,6 +28,28 @@ static struct RDMAOutgoingArgs { InetSocketAddress *addr; } outgoing_args; =20 +bool rdma_send_channel_create(QIOTaskFunc f, void *data) +{ + QIOChannelRDMA *rioc; + + if (!outgoing_args.addr) { + return false; + } + + rioc =3D qio_channel_rdma_new(); + qio_channel_rdma_connect_async(rioc, outgoing_args.addr, f, data, NULL, + NULL); + return true; +} + +void rdma_cleanup_outgoing_migration(void) +{ + if (outgoing_args.addr) { + qapi_free_InetSocketAddress(outgoing_args.addr); + outgoing_args.addr =3D NULL; + } +} + static void rdma_outgoing_migration(QIOTask *task, gpointer opaque) { MigrationState *s =3D opaque; @@ -74,6 +97,10 @@ void rdma_start_incoming_migration(InetSocketAddress *ad= dr, Error **errp) =20 qio_channel_set_name(QIO_CHANNEL(rioc), "migration-rdma-listener"); =20 + if (migrate_multifd()) { + num =3D migrate_multifd_channels(); + } + if (qio_channel_rdma_listen_sync(rioc, addr, num, errp) < 0) { object_unref(OBJECT(rioc)); return; diff --git a/migration/rdma.h b/migration/rdma.h index 4c3eb9a972..cefccac61c 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -16,6 +16,12 @@ =20 #include "qemu/sockets.h" =20 +#include + +bool rdma_send_channel_create(QIOTaskFunc f, void *data); + +void rdma_cleanup_outgoing_migration(void); + void rdma_start_outgoing_migration(MigrationState *s, InetSocketAddress *a= ddr, Error **errp); =20 --=20 2.43.0