All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, berrange@redhat.com,
	Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH v2 14/25] migration/rdma: Use common connection paths
Date: Mon, 5 Jan 2026 14:37:46 -0500	[thread overview]
Message-ID: <aVwTCieTljUaG9el@x1.local> (raw)
In-Reply-To: <20260105190644.14072-15-farosas@suse.de>

On Mon, Jan 05, 2026 at 04:06:31PM -0300, Fabiano Rosas wrote:
> 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 <farosas@suse.de>

Reviewed-by: Peter Xu <peterx@redhat.com>

One nitpick inline.

> ---
>  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 @@
>  
>  #include "io/channel.h"
>  
> +/* Migration channel types */
> +enum {
> +    CH_MAIN,
> +    CH_MULTIFD,
> +    CH_POSTCOPY
> +};
> +
>  void migration_channel_process_incoming(QIOChannel *ioc);
>  
>  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
>  };
>  
> -/* 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);
>  }
>  
> -void migration_fd_process_incoming(QEMUFile *f)
> -{
> -    MigrationIncomingState *mis = migration_incoming_get_current();
> -
> -    assert(!mis->from_src_file);
> -    mis->from_src_file = f;
> -    qemu_file_set_blocking(f, false, &error_abort);
> -    migration_incoming_process();

This is removed very soon here..  That's OK.

> -}
> -
>  static bool migration_has_main_and_multifd_channels(void)
>  {
>      MigrationIncomingState *mis = 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);
>  
> -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 **errp);
> 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 @@
>   */
>  
>  #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 */
>  };
>  
> @@ -3836,32 +3836,30 @@ static void qio_channel_rdma_register_types(void)
>  
>  type_init(qio_channel_rdma_register_types);
>  
> -static QEMUFile *rdma_new_input(RDMAContext *rdma)
> +static QIOChannel *rdma_new_input(RDMAContext *rdma)
>  {
>      QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA));
>  
> -    rioc->file = qemu_file_new_input(QIO_CHANNEL(rioc));
>      rioc->rdmain = rdma;
>      rioc->rdmaout = rdma->return_path;
>  
> -    return rioc->file;
> +    return QIO_CHANNEL(rioc);
>  }
>  
> -static QEMUFile *rdma_new_output(RDMAContext *rdma)
> +static QIOChannel *rdma_new_output(RDMAContext *rdma)
>  {
>      QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA));
>  
> -    rioc->file = qemu_file_new_output(QIO_CHANNEL(rioc));
>      rioc->rdmaout = rdma;
>      rioc->rdmain = rdma->return_path;
>  
> -    return rioc->file;
> +    return QIO_CHANNEL(rioc);
>  }
>  
>  static void rdma_accept_incoming_migration(void *opaque)
>  {
>      RDMAContext *rdma = opaque;
> -    QEMUFile *f;
> +    QIOChannel *ioc;
>  
>      trace_qemu_rdma_accept_incoming_migration();
>      if (qemu_rdma_accept(rdma) < 0) {
> @@ -3875,15 +3873,16 @@ static void rdma_accept_incoming_migration(void *opaque)
>          return;
>      }
>  
> -    f = rdma_new_input(rdma);
> -    if (f == NULL) {
> +    ioc = rdma_new_input(rdma);
> +    if (ioc == NULL) {
>          error_report("RDMA ERROR: could not open RDMA for input");
>          qemu_rdma_cleanup(rdma);
>          return;
>      }
>  
>      rdma->migration_started_on_destination = 1;
> -    migration_fd_process_incoming(f);
> +    migration_incoming_setup(ioc, CH_MAIN, NULL);

Maybe error_abort?

> +    migration_incoming_process();
>  }
>  
>  void rdma_start_incoming_migration(InetSocketAddress *host_port,
> @@ -3995,8 +3994,8 @@ void rdma_start_outgoing_migration(void *opaque,
>  
>      trace_rdma_start_outgoing_migration_after_rdma_connect();
>  
> -    s->to_dst_file = rdma_new_output(rdma);
>      s->rdma_migration = true;
> +    migration_outgoing_setup(rdma_new_output(rdma));
>      migration_connect(s);
>      return;
>  return_path_err:
> -- 
> 2.51.0
> 

-- 
Peter Xu



  reply	other threads:[~2026-01-05 19:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 19:06 [PATCH v2 00/25] migration: Cleanup early connection code Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 01/25] migration: Remove redundant state change Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 02/25] migration: Fix state change at migration_channel_process_incoming Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 03/25] migration/tls: Remove unused parameter Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 04/25] migration: Cleanup TLS handshake hostname passing Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 05/25] migration: Move postcopy_try_recover into migration_incoming_process Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 06/25] migration: Use migrate_mode() to query for cpr-transfer Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 07/25] migration: Free the error earlier in the resume case Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 08/25] migration: Move error reporting out of migration_cleanup Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 09/25] migration: Expand migration_connect_error_propagate to cover cancelling Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 10/25] migration: yank: Move register instance earlier Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 11/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 12/25] migration: Handle error in the early async paths Fabiano Rosas
2026-01-05 19:06 ` [PATCH v2 13/25] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Fabiano Rosas
2026-01-05 19:30   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 14/25] migration/rdma: Use common connection paths Fabiano Rosas
2026-01-05 19:37   ` Peter Xu [this message]
2026-01-05 19:06 ` [PATCH v2 15/25] migration: Start incoming from channel.c Fabiano Rosas
2026-01-05 19:41   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 16/25] migration/channel: Rename migration_channel_connect Fabiano Rosas
2026-01-05 19:44   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 17/25] migration: Rename instances of start Fabiano Rosas
2026-01-05 19:46   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 18/25] migration: Move channel code to channel.c Fabiano Rosas
2026-01-05 19:47   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 19/25] migration: Move transport connection code into channel.c Fabiano Rosas
2026-01-05 19:49   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 20/25] migration: Move channel parsing to channel.c Fabiano Rosas
2026-01-05 21:00   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 21/25] migration: Move URI " Fabiano Rosas
2026-01-05 21:01   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 22/25] migration: Free cpr-transfer MigrationAddress along with gsource Fabiano Rosas
2026-01-05 21:03   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 23/25] migration: Move CPR HUP watch to cpr-transfer.c Fabiano Rosas
2026-01-05 21:05   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 24/25] migration: Remove qmp_migrate_finish Fabiano Rosas
2026-01-05 21:18   ` Peter Xu
2026-01-05 19:06 ` [PATCH v2 25/25] migration/channel: Centralize calling migration_channel_connect_outgoing Fabiano Rosas
2026-01-05 21:32   ` Peter Xu
2026-01-06 13:55     ` Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aVwTCieTljUaG9el@x1.local \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=lizhijian@fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.