public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH v3 00/25] migration: Cleanup early connection code
@ 2026-01-09 12:40 Fabiano Rosas
  2026-01-09 12:40 ` [PATCH v3 01/25] migration: Remove redundant state change Fabiano Rosas
                   ` (24 more replies)
  0 siblings, 25 replies; 58+ messages in thread
From: Fabiano Rosas @ 2026-01-09 12:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: peterx, berrange

Changes in v3:

- patch 13: documented the return value of migration_incoming_setup
- patch 14: used &error_abort for rdma
- patch 15: defined MigChannelType
- patch 24: add more info to the commit message about the Error change
- patch 25: about rdma & yank: yes, it won't be registered
            about rdma & tls: big can of worms, see
            https://lore.kernel.org/r/87y0m7df46.fsf@suse.de

CI run: https://gitlab.com/farosas/qemu/-/pipelines/2252568391

v2:
https://lore.kernel.org/r/20260105190644.14072-1-farosas@suse.de

Removed some extra changes that were not adding much to the series,
left multifd_recv_setup() call where it was; stopped merging the
connection code at the end of the series.

Added further cleanup to CPR code in qmp_migrate and moved it to
cpr-transfer.c.

v1 (rfc):
https://lore.kernel.org/r/20251226211930.27565-1-farosas@suse.de

Address some of the issues that make the early connection code a bit
too idiosyncratic. By "early connection" I mean from
qmp_migrate[_incoming] until the start of the migration
thread|coroutine.

(IOW, the whole dance of going into socket code, starting an async
routine, calling back to migration code, checking TLS, going back
again, coming back once more, etc. All while passing an error_in and
hostname string that eventually gets (maybe) ignored in tls code,
along with some is_resume checks along the way)

This series is mostly inspired by the work Markus and Peter did
recently in organizing some of the error handling code. The new
migration_connect_error_propagate() function seems like a good place
to centralize the error handling and call migration_cleanup() during
this early connection phase when everything is still fairly
linear. (apologies if I'm dirtying your design =)

Aside from the initial patches that are a bit disruptive, most of the
series is just refactoring to make the code easier to navigate, names
more consistent and some general cleanups.

- patches 1-8:

General cleanups, could be applied standalone, although they are
prerequisites for the rest of the series.

- patches 9-12:

Changes to allow calling migration_cleanup() from
migration_connect_error_propagate().

The idea here is to make sure error propagation and cleanup happen
when the error is detected, without calling into non-error-path
functions.

This is the more risky change because it will cause cleanup to run in
places where it didn't before.

- patch 13 & 19:

The main change of this series, simplifying the
qmp-migrate --> migration_connect path. Stops calling the connection
functions when an error happens in the transport code, adds
clarification around which paths have asynchronous completion and
makes the synchronous path return to their caller to start the
migration instead of initiating it themselves.

- patches 14-18, 20-22:

Moves code out of migration.c and into channel.c. Now that the code is
more compartmentalized, move it to a more appropriate source file.

- patches 23-25:

BONUS CONTENT, wrap the uri/channels parsing and move it to channel.c
as well.

- future work?

I think we could move all QMP command functions to a QAPI-specific
file, but I don't see any standardization in the tree, there's
block/qapi.c, various instances of foo-qmp-cmds.c and many more just
laying along with the rest of the code. So I left this for another
moment.

CI run: https://gitlab.com/farosas/qemu/-/pipelines/2233810778

Fabiano Rosas (25):
  migration: Remove redundant state change
  migration: Fix state change at migration_channel_process_incoming
  migration/tls: Remove unused parameter
  migration: Cleanup TLS handshake hostname passing
  migration: Move postcopy_try_recover into migration_incoming_process
  migration: Use migrate_mode() to query for cpr-transfer
  migration: Free the error earlier in the resume case
  migration: Move error reporting out of migration_cleanup
  migration: Expand migration_connect_error_propagate to cover
    cancelling
  migration: yank: Move register instance earlier
  migration: Fold migration_cleanup() into
    migration_connect_error_propagate()
  migration: Handle error in the early async paths
  migration: Move setting of QEMUFile into
    migration_outgoing|incoming_setup
  migration/rdma: Use common connection paths
  migration: Start incoming from channel.c
  migration/channel: Rename migration_channel_connect
  migration: Rename instances of start
  migration: Move channel code to channel.c
  migration: Move transport connection code into channel.c
  migration: Move channel parsing to channel.c
  migration: Move URI parsing to channel.c
  migration: Free cpr-transfer MigrationAddress along with gsource
  migration: Move CPR HUP watch to cpr-transfer.c
  migration: Remove qmp_migrate_finish
  migration/channel: Centralize calling
    migration_channel_connect_outgoing

 include/migration/cpr.h  |   5 +
 migration/channel.c      | 370 ++++++++++++++++++++++----
 migration/channel.h      |  27 +-
 migration/cpr-exec.c     |   2 +-
 migration/cpr-transfer.c |  23 ++
 migration/exec.c         |  11 +-
 migration/exec.h         |   8 +-
 migration/fd.c           |  15 +-
 migration/fd.h           |   9 +-
 migration/file.c         |  20 +-
 migration/file.h         |   7 +-
 migration/migration.c    | 559 ++++++++++-----------------------------
 migration/migration.h    |  15 +-
 migration/multifd.c      |  17 +-
 migration/multifd.h      |   2 +-
 migration/options.c      |   5 +
 migration/postcopy-ram.c |   2 +-
 migration/rdma.c         |  46 ++--
 migration/rdma.h         |   6 +-
 migration/socket.c       |  30 +--
 migration/socket.h       |   6 +-
 migration/tls.c          |  33 +--
 migration/tls.h          |   9 +-
 migration/trace-events   |  20 +-
 24 files changed, 639 insertions(+), 608 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2026-01-20 18:19 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 12:40 [PATCH v3 00/25] migration: Cleanup early connection code Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 01/25] migration: Remove redundant state change Fabiano Rosas
2026-01-13 12:33   ` Prasad Pandit
2026-01-13 13:25     ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 02/25] migration: Fix state change at migration_channel_process_incoming Fabiano Rosas
2026-01-13 12:39   ` Prasad Pandit
2026-01-13 13:27     ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 03/25] migration/tls: Remove unused parameter Fabiano Rosas
2026-01-19 12:37   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 04/25] migration: Cleanup TLS handshake hostname passing Fabiano Rosas
2026-01-20 11:02   ` Prasad Pandit
2026-01-20 11:11     ` Daniel P. Berrangé
2026-01-20 11:37       ` Prasad Pandit
2026-01-20 14:51         ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 05/25] migration: Move postcopy_try_recover into migration_incoming_process Fabiano Rosas
2026-01-19 11:38   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 06/25] migration: Use migrate_mode() to query for cpr-transfer Fabiano Rosas
2026-01-19 12:06   ` Prasad Pandit
2026-01-20 17:52     ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 07/25] migration: Free the error earlier in the resume case Fabiano Rosas
2026-01-15 11:54   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 08/25] migration: Move error reporting out of migration_cleanup Fabiano Rosas
2026-01-19 12:32   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 09/25] migration: Expand migration_connect_error_propagate to cover cancelling Fabiano Rosas
2026-01-20  9:15   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 10/25] migration: yank: Move register instance earlier Fabiano Rosas
2026-01-20  9:01   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 11/25] migration: Fold migration_cleanup() into migration_connect_error_propagate() Fabiano Rosas
2026-01-16 12:25   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 12/25] migration: Handle error in the early async paths Fabiano Rosas
2026-01-16 11:17   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 13/25] migration: Move setting of QEMUFile into migration_outgoing|incoming_setup Fabiano Rosas
2026-01-19 12:22   ` Prasad Pandit
2026-01-20 18:01     ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 14/25] migration/rdma: Use common connection paths Fabiano Rosas
2026-01-19 12:27   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 15/25] migration: Start incoming from channel.c Fabiano Rosas
2026-01-19 12:24   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 16/25] migration/channel: Rename migration_channel_connect Fabiano Rosas
2026-01-20 11:10   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 17/25] migration: Rename instances of start Fabiano Rosas
2026-01-20 11:21   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 18/25] migration: Move channel code to channel.c Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 19/25] migration: Move transport connection code into channel.c Fabiano Rosas
2026-01-20  9:40   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 20/25] migration: Move channel parsing to channel.c Fabiano Rosas
2026-01-20 10:15   ` Prasad Pandit
2026-01-20 18:18     ` Fabiano Rosas
2026-01-09 12:40 ` [PATCH v3 21/25] migration: Move URI " Fabiano Rosas
2026-01-20 10:20   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 22/25] migration: Free cpr-transfer MigrationAddress along with gsource Fabiano Rosas
2026-01-20 11:17   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 23/25] migration: Move CPR HUP watch to cpr-transfer.c Fabiano Rosas
2026-01-20 11:24   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 24/25] migration: Remove qmp_migrate_finish Fabiano Rosas
2026-01-20 11:07   ` Prasad Pandit
2026-01-09 12:40 ` [PATCH v3 25/25] migration/channel: Centralize calling migration_channel_connect_outgoing Fabiano Rosas
2026-01-19 11:28   ` Prasad Pandit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox