From nobody Sat Jan 10 00:48:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1767640335; cv=none; d=zohomail.com; s=zohoarc; b=QoaCEQYN/RBVDByLj4eMzzG7uhK/EjJ7W3g8WWeDxYYuoSZZ/qTnUIMBBX3YbML+IcXYCqAeFjsaECFkvwqnTuKjCOQnlg0n5511fIo3GDFTFRbYf5yhg85jg5HdfvWMxk/AT0QcohiTKQKD0Ky12K6HzXAJRUb46eIa8uWmsDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767640335; h=Content-Transfer-Encoding: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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=aw7YkPaYB1GnyiRl+DJRG5jchmfgulHEoSxIuoNld77JYH633S0NxZWVLoqEaxhzPMHOS/iibSmlLWxS6QrFHLirQUF2e/0VRarHV5TuiEOGtQZ6jDJTO2G5r+6Hb8f5YdnSmwua01HiCcfNEo+z9zdevx2lM396hrAXyqFhzH8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1767640335794312.3946525845944; Mon, 5 Jan 2026 11:12:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vcpwI-00006F-HA; Mon, 05 Jan 2026 14:08:30 -0500 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 1vcpvY-0007oy-Li for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:41 -0500 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vcpvV-0005OO-Tn for qemu-devel@nongnu.org; Mon, 05 Jan 2026 14:07:40 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 709F05BCD1; Mon, 5 Jan 2026 19:07:16 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DFF3213964; Mon, 5 Jan 2026 19:07:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ECCjJ+ILXGmSOgAAD6G6ig (envelope-from ); Mon, 05 Jan 2026 19:07:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=qm9hERnbwb9a85iNo/gJrRmZMUtDn9TOrj3cJSUCUBNSqlQc5aQUaIb5EiEIQp25YpEZZv MAWMn+V3z70NLn3LvEX3eO0RMSQ+N/KQBbrqkQa7oCYStzoQ4B+YdcAS1hUgjmGC9u6cMB DrKwM22+OdFXoEuOmMQbzaVsB/G34P8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=Cw41B6608FpWfUko4b3LEa6ACQy2jDmb0AyPvZBjHnXZin0sfHO9NNNFkUs3pOMNxLp2RP KUSCbg+lusaIYBBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1767640036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=qm9hERnbwb9a85iNo/gJrRmZMUtDn9TOrj3cJSUCUBNSqlQc5aQUaIb5EiEIQp25YpEZZv MAWMn+V3z70NLn3LvEX3eO0RMSQ+N/KQBbrqkQa7oCYStzoQ4B+YdcAS1hUgjmGC9u6cMB DrKwM22+OdFXoEuOmMQbzaVsB/G34P8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1767640036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mD/WZecDo3n/1KP43O1IwfCPnhGvXxxA64PGcTLBX94=; b=Cw41B6608FpWfUko4b3LEa6ACQy2jDmb0AyPvZBjHnXZin0sfHO9NNNFkUs3pOMNxLp2RP KUSCbg+lusaIYBBg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: peterx@redhat.com, berrange@redhat.com, Li Zhijian Subject: [PATCH v2 14/25] migration/rdma: Use common connection paths Date: Mon, 5 Jan 2026 16:06:31 -0300 Message-ID: <20260105190644.14072-15-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105190644.14072-1-farosas@suse.de> References: <20260105190644.14072-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.987]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 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 (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=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1767640338013158500 Content-Type: text/plain; charset="utf-8" Use the common connection paths for the incoming and outgoing sides of rdma migration. This removes one usage of QEMUFile from rdma.c. It also allows further unification of the connection code in next patches. Move the channels enum to channel.h so rdma.c can access it. The RDMA channel is considered a CH_MAIN channel. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/channel.h | 7 +++++++ migration/migration.c | 13 ------------- migration/migration.h | 1 - migration/rdma.c | 23 +++++++++++------------ 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/migration/channel.h b/migration/channel.h index ccfeaaef18..93dedbf52b 100644 --- a/migration/channel.h +++ b/migration/channel.h @@ -18,6 +18,13 @@ =20 #include "io/channel.h" =20 +/* Migration channel types */ +enum { + CH_MAIN, + CH_MULTIFD, + CH_POSTCOPY +}; + void migration_channel_process_incoming(QIOChannel *ioc); =20 void migration_channel_connect(MigrationState *s, QIOChannel *ioc); diff --git a/migration/migration.c b/migration/migration.c index dc8fe80cf8..906f0bdab3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -91,9 +91,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -/* Migration channel types */ -enum { CH_MAIN, CH_MULTIFD, CH_POSTCOPY }; - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -1021,16 +1018,6 @@ void migration_incoming_process(void) qemu_coroutine_enter(co); } =20 -void migration_fd_process_incoming(QEMUFile *f) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - - assert(!mis->from_src_file); - mis->from_src_file =3D f; - qemu_file_set_blocking(f, false, &error_abort); - migration_incoming_process(); -} - static bool migration_has_main_and_multifd_channels(void) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/migration.h b/migration/migration.h index 4dcf299719..cd6cfd62ba 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -527,7 +527,6 @@ struct MigrationState { void migrate_set_state(MigrationStatus *state, MigrationStatus old_state, MigrationStatus new_state); =20 -void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); void migration_incoming_process(void); bool migration_incoming_setup(QIOChannel *ioc, uint8_t channel, Error **er= rp); diff --git a/migration/rdma.c b/migration/rdma.c index 596a1aba0b..788ae183c1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "channel.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "exec/target_page.h" @@ -384,7 +385,6 @@ struct QIOChannelRDMA { QIOChannel parent; RDMAContext *rdmain; RDMAContext *rdmaout; - QEMUFile *file; bool blocking; /* XXX we don't actually honour this yet */ }; =20 @@ -3836,32 +3836,30 @@ static void qio_channel_rdma_register_types(void) =20 type_init(qio_channel_rdma_register_types); =20 -static QEMUFile *rdma_new_input(RDMAContext *rdma) +static QIOChannel *rdma_new_input(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain =3D rdma; rioc->rdmaout =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 -static QEMUFile *rdma_new_output(RDMAContext *rdma) +static QIOChannel *rdma_new_output(RDMAContext *rdma) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout =3D rdma; rioc->rdmain =3D rdma->return_path; =20 - return rioc->file; + return QIO_CHANNEL(rioc); } =20 static void rdma_accept_incoming_migration(void *opaque) { RDMAContext *rdma =3D opaque; - QEMUFile *f; + QIOChannel *ioc; =20 trace_qemu_rdma_accept_incoming_migration(); if (qemu_rdma_accept(rdma) < 0) { @@ -3875,15 +3873,16 @@ static void rdma_accept_incoming_migration(void *op= aque) return; } =20 - f =3D rdma_new_input(rdma); - if (f =3D=3D NULL) { + ioc =3D rdma_new_input(rdma); + if (ioc =3D=3D NULL) { error_report("RDMA ERROR: could not open RDMA for input"); qemu_rdma_cleanup(rdma); return; } =20 rdma->migration_started_on_destination =3D 1; - migration_fd_process_incoming(f); + migration_incoming_setup(ioc, CH_MAIN, NULL); + migration_incoming_process(); } =20 void rdma_start_incoming_migration(InetSocketAddress *host_port, @@ -3995,8 +3994,8 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 - s->to_dst_file =3D rdma_new_output(rdma); s->rdma_migration =3D true; + migration_outgoing_setup(rdma_new_output(rdma)); migration_connect(s); return; return_path_err: --=20 2.51.0