qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/25] vhost-user-blk: live-backend local migration
@ 2025-10-16 11:40 Vladimir Sementsov-Ogievskiy
  2025-10-16 11:40 ` [PATCH v2 01/25] vhost: store busyloop_timeout into struct vhost_dev Vladimir Sementsov-Ogievskiy
                   ` (24 more replies)
  0 siblings, 25 replies; 55+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2025-10-16 11:40 UTC (permalink / raw)
  To: raphael, pbonzini, farosas
  Cc: mst, sgarzare, marcandre.lureau, kwolf, hreitz, berrange, eblake,
	armbru, qemu-devel, qemu-block, steven.sistare, vsementsov,
	yc-core, d-tatianin, jasowang

Hi all!

v2: extremely simplified API: instead of 

- separate capability for migrating chardevs
- separate capability for migrating vhost-user-blk
- "support-local-migration" and "local-incoming" chardev options
- "local-incoming" option for vhost-user-blke

instead of all of this, v2 API is only one capability to
enable the whole feature.

Still, final look of this capability is not clear yet, the
discussion is in context of
"[PATCH v8 00/19] virtio-net: live-TAP local migration", here:
https://lore.kernel.org/qemu-devel/29aa1d66-9fa7-4e44-b0e3-2ca26e77accf@yandex-team.ru/

This series comes with temporary API in commit
"RFC qapi: add local-vhost-user-blk migration capability"

v2 is based on:
[PATCH v4 0/7] chardev: postpone connect
  (which in turn is based on [PATCH 0/2] remove deprecated 'reconnect' options)
[PATCH v3 00/23] vhost refactoring and fixes
and one commit from v8 of live-tap series:
[PATCH v8 14/19] migration: introduce .pre_incoming() vmsd handler

Based-on: <20250924133309.334631-1-vsementsov@yandex-team.ru>
Based-on: <20251015212051.1156334-1-vsementsov@yandex-team.ru>
Based-on: <20251015145808.1112843-1-vsementsov@yandex-team.ru>
Based-on: <20251015132136.1083972-15-vsementsov@yandex-team.ru>

The code is also may be found in my gitlab account, tag
up-vhost-user-blk-fd-migration-v2 :
https://gitlab.com/vsementsov/qemu/-/tree/up-vhost-user-blk-fd-migration-v2

-

Local migration of vhost-user-blk requires non-trivial actions
from management layer, it should provide a new connection for new
QEMU process and handle disk operation movement from one connection
to another.

Such switching, including reinitialization of vhost-user connection,
draining disk requests, etc, adds significant value to local migration
downtime.

This all leads to an idea: why not to just pass all we need from
old QEMU process to the new one (including open file descriptors),
and don't touch the backend at all? This way, the vhost user backend
server will not even know, that QEMU process is changed, as live
vhost-user connection is migrated.

So this series realize the idea. No requests are done to backend
during migration, instead all backend-related state and all related
file descriptors (vhost-user connection, guest/host notifiers,
inflight region) are passed to new process. Of course, migration
should go through unix socket.

Why not CPR-transfer?

1. In the new mode of local migration we need to pass not only
file descriptors, but additional parts of backend-related state,
which we don't want (or even can't) reinitialize in target process.
And it's a lot simpler to add new fields to common migration stream.
And why not to pass fds in the same stream?

2. No benefit of vhost-user connection fd passed to target in early
stage before device creation: we can't use it together with source
QEMU process anyway. So, we need a moment, when source qemu stops using
the fd, and target start doing it. And native place for this moment is
usual save/load of the device in migration process. And yes, we have to
deeply update initialization/starting of the device to not reinitialize
the backend, but just continue to work with it in a new QEMU process.

3. So, if we can't actually use fd, passed early before device creation,
no reason to care about:
- non-working QMP connection on target until "migrate" command on source
- additional migration channel
- implementing code to pass additional non-fd fields together with fds in CPR

However, the series doesn't conflict with CPR-transfer, as it's actually
a usual migration with some additional capabilities. The only
requirement is that main migration channel should be a unix socket.

Vladimir Sementsov-Ogievskiy (25):
  vhost: store busyloop_timeout into struct vhost_dev
  vhost: reorder logic in vhost_dev_init()
  vhost: rework vhost_virtqueue_init()
  vhost: add connect parameter to vhost_dev_init()
  vhost: split vhost_dev_connect() out of vhost_dev_init()
  vhost-user: support connect api
  vhost-user-blk: vhost_user_blk_connect() move connected check to
    caller
  vhost-user-blk: vhost_user_blk_connect(): call vhost_dev_connect()
  vhost-user-blk: rename vhost_user_blk_connect to vhost_user_blk_init
  vhost-user-blk: split vhost_user_blk_init()
  vhost-user-blk: move initial reconnect loop to separate function
  vhost-user-blk: move first vhost_user_blk_init() to _realize()
  vhost-user-blk: postpone connect to pre-incoming
  virtio: introduce .skip_vhost_migration_log() handler
  migration: introduce vmstate_event_notifier
  chardev: add .chr_get_client() handler
  vhost: add inflight region backend-transfer vmstate
  chardev: introduce backend-transfer vmstate for chardev
  vhost: support backend-transfer migration
  vhost-user: add vmstate
  virtio: support vhost backend migration
  virtio: support .needed for virtio vmsd
  RFC qapi: add local-vhost-user-blk migration capability
  vhost-user-blk: support vhost backend migration
  tests/functional: add test_x86_64_vhost_user_blk_fd_migration.py

 backends/cryptodev-vhost.c                    |   2 +-
 backends/vhost-user.c                         |   2 +-
 chardev/char-backend-transfer.c               |  52 +++
 chardev/char-socket.c                         |   7 +
 chardev/char.c                                |   6 +
 chardev/meson.build                           |   1 +
 hw/block/trace-events                         |   2 +
 hw/block/vhost-user-blk.c                     | 255 +++++++++++----
 hw/net/vhost_net.c                            |   2 +-
 hw/scsi/vhost-scsi.c                          |   2 +-
 hw/scsi/vhost-user-scsi.c                     |   2 +-
 hw/virtio/vdpa-dev.c                          |   3 +-
 hw/virtio/vhost-user-base.c                   |   2 +-
 hw/virtio/vhost-user-fs.c                     |   2 +-
 hw/virtio/vhost-user-scmi.c                   |   2 +-
 hw/virtio/vhost-user-vsock.c                  |   2 +-
 hw/virtio/vhost-user.c                        | 127 +++++++-
 hw/virtio/vhost-vsock.c                       |   2 +-
 hw/virtio/vhost.c                             | 266 +++++++++++----
 hw/virtio/virtio-bus.c                        |   2 +-
 hw/virtio/virtio.c                            |  77 ++++-
 include/chardev/char-backend-transfer.h       |  17 +
 include/chardev/char.h                        |   4 +
 include/hw/virtio/vhost-backend.h             |   2 +
 include/hw/virtio/vhost-user-blk.h            |   2 +
 include/hw/virtio/vhost-user.h                |   4 +
 include/hw/virtio/vhost.h                     |  19 +-
 include/hw/virtio/virtio.h                    |   4 +
 include/migration/vmstate.h                   |   7 +
 migration/meson.build                         |   1 +
 migration/options.c                           |   7 +
 migration/options.h                           |   1 +
 migration/vmstate-event-notifier.c            |  54 +++
 qapi/migration.json                           |  11 +-
 ...test_x86_64_vhost_user_blk_fd_migration.py | 307 ++++++++++++++++++
 35 files changed, 1115 insertions(+), 143 deletions(-)
 create mode 100644 chardev/char-backend-transfer.c
 create mode 100644 include/chardev/char-backend-transfer.h
 create mode 100644 migration/vmstate-event-notifier.c
 create mode 100644 tests/functional/test_x86_64_vhost_user_blk_fd_migration.py

-- 
2.48.1



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

end of thread, other threads:[~2025-10-22  5:46 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 11:40 [PATCH v2 00/25] vhost-user-blk: live-backend local migration Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 01/25] vhost: store busyloop_timeout into struct vhost_dev Vladimir Sementsov-Ogievskiy
2025-10-20 23:14   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 02/25] vhost: reorder logic in vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:16   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 03/25] vhost: rework vhost_virtqueue_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:18   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 04/25] vhost: add connect parameter to vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:20   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 05/25] vhost: split vhost_dev_connect() out of vhost_dev_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:21   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 06/25] vhost-user: support connect api Vladimir Sementsov-Ogievskiy
2025-10-20 23:21   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 07/25] vhost-user-blk: vhost_user_blk_connect() move connected check to caller Vladimir Sementsov-Ogievskiy
2025-10-20 23:23   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 08/25] vhost-user-blk: vhost_user_blk_connect(): call vhost_dev_connect() Vladimir Sementsov-Ogievskiy
2025-10-20 23:24   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 09/25] vhost-user-blk: rename vhost_user_blk_connect to vhost_user_blk_init Vladimir Sementsov-Ogievskiy
2025-10-20 23:25   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 10/25] vhost-user-blk: split vhost_user_blk_init() Vladimir Sementsov-Ogievskiy
2025-10-20 23:28   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 11/25] vhost-user-blk: move initial reconnect loop to separate function Vladimir Sementsov-Ogievskiy
2025-10-20 23:28   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 12/25] vhost-user-blk: move first vhost_user_blk_init() to _realize() Vladimir Sementsov-Ogievskiy
2025-10-20 23:35   ` Raphael Norwitz
2025-10-21 16:29     ` Vladimir Sementsov-Ogievskiy
2025-10-21 18:06       ` Raphael Norwitz
2025-10-22  5:45         ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 13/25] vhost-user-blk: postpone connect to pre-incoming Vladimir Sementsov-Ogievskiy
2025-10-20 23:36   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 14/25] virtio: introduce .skip_vhost_migration_log() handler Vladimir Sementsov-Ogievskiy
2025-10-20 23:37   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 15/25] migration: introduce vmstate_event_notifier Vladimir Sementsov-Ogievskiy
2025-10-16 18:59   ` Peter Xu
2025-10-16 19:09     ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 16/25] chardev: add .chr_get_client() handler Vladimir Sementsov-Ogievskiy
2025-10-16 11:51   ` Daniel P. Berrangé
2025-10-16 11:40 ` [PATCH v2 17/25] vhost: add inflight region backend-transfer vmstate Vladimir Sementsov-Ogievskiy
2025-10-20 23:39   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 18/25] chardev: introduce backend-transfer vmstate for chardev Vladimir Sementsov-Ogievskiy
2025-10-16 11:55   ` Daniel P. Berrangé
2025-10-16 12:01     ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 19/25] vhost: support backend-transfer migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:50   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 20/25] vhost-user: add vmstate Vladimir Sementsov-Ogievskiy
2025-10-20 23:51   ` Raphael Norwitz
2025-10-21 16:34     ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:40 ` [PATCH v2 21/25] virtio: support vhost backend migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:52   ` Raphael Norwitz
2025-10-16 11:40 ` [PATCH v2 22/25] virtio: support .needed for virtio vmsd Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 23/25] RFC qapi: add local-vhost-user-blk migration capability Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 24/25] vhost-user-blk: support vhost backend migration Vladimir Sementsov-Ogievskiy
2025-10-20 23:53   ` Raphael Norwitz
2025-10-21 16:38     ` Vladimir Sementsov-Ogievskiy
2025-10-16 11:41 ` [PATCH v2 25/25] tests/functional: add test_x86_64_vhost_user_blk_fd_migration.py Vladimir Sementsov-Ogievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).