Skip to content

migration: File based migration with multifd and mapped-ram

Fabiano Rosas qemu-devel 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest23 patches 17 repliesIn review
  2. v523 patches 16 repliesSuperseded
  3. v434 patches 44 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 RFC30 patches64 repliesSuperseded
v229 patches98 repliesSuperseded
v1 RFC26 patches38 repliesSuperseded

v5 from the cover letter

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23migration/multifd: Cleanup multifd_recv_sync_mainmigration/multifd.c migration/trace-events+14 -50 replies
2/23io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel fileinclude/io/channel.h io/channel-file.c+9 -00 replies
3/23io: Add generic pwritev/preadv interfaceinclude/io/channel.h io/channel.c+140 -00 replies
4/23io: implement io_pwritev/preadv for QIOChannelFileio/channel-file.c+56 -00 replies
5/23io: fsync before closing a file channelio/channel-file.c+5 -00 replies
6/23migration/qemu-file: add utility methods for working with seekable channelsinclude/migration/qemu-file-types.h migration/qemu-file.c migration/qemu-file.h+114 -00 replies
7/23migration/ram: Introduce 'mapped-ram' migration capabilitydocs/devel/migration/features.rst docs/devel/migration/mapped-ram.rst migration/migration.c +4 more+187 -10 replies
8/23migration: Add mapped-ram URI compatibility checkmigration/migration.c+29 -00 replies
9/23migration/ram: Add outgoing 'mapped-ram' migrationinclude/exec/ramblock.h migration/ram.c+135 -90 replies
10/23migration/ram: Add incoming 'mapped-ram' migrationmigration/ram.c+141 -20 replies
11/23tests/qtest/migration: Add tests for mapped-ram file-based migrationtests/qtest/migration-test.c+59 -00 replies
12/23migration/multifd: Rename MultiFDSend|RecvParams::data to compress_datamigration/multifd-zlib.c migration/multifd-zstd.c migration/multifd.h+22 -220 replies
13/23migration/multifd: Decouple recv method from pagesmigration/multifd-zlib.c migration/multifd-zstd.c migration/multifd.c +1 more+16 -130 replies
14/23migration/multifd: Allow multifd without packetsmigration/multifd.c+114 -610 replies
15/23migration/multifd: Allow receiving pages without packetsmigration/file.c migration/multifd.c migration/multifd.h+138 -70 replies
16/23migration/multifd: Add a wrapper for channels_createdmigration/multifd.c migration/multifd.h+7 -10 replies
17/23migration/multifd: Add outgoing QIOChannelFile supportmigration/file.c migration/file.h migration/multifd.c +1 more+57 -31 reply
18/23migration/multifd: Add incoming QIOChannelFile supportmigration/file.c migration/migration.c migration/multifd.c+30 -110 replies
19/23migration/multifd: Prepare multifd sync for mapped-ram migrationmigration/ram.c+31 -71 reply
20/23migration/multifd: Support outgoing mapped-ram stream formatinclude/qemu/bitops.h migration/file.c migration/file.h +5 more+125 -160 replies
21/23migration/multifd: Support incoming mapped-ram stream formatmigration/file.c migration/file.h migration/multifd.c +2 more+73 -60 replies
22/23migration/multifd: Add mapped-ram support to fd: URImigration/fd.c migration/fd.h migration/file.c +2 more+63 -51 reply
23/23tests/qtest/migration: Add a multifd + mapped-ram migration testtests/qtest/migration-test.c+68 -00 replies

Reviews trailers per patch

All 23 patches have a Reviewed-by or Acked-by.

PatchDaniel P. BerrangéPeter XuMarkus Armbruster
1/23R-b
2/23R-b R-b
3/23R-b R-b
4/23R-b R-b
5/23R-b A-b
6/23R-b
7/23R-b A-b
8/23R-b R-b
9/23R-b
10/23R-b
11/23R-b
12/23R-b
13/23R-b
14/23R-b
15/23R-b
16/23R-b
17/23R-b
18/23R-b
19/23R-b
20/23R-b
21/23R-b
22/23R-b
23/23R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/23] migration: File based migration with multifd and mapped-ram

Based-on: 74aa0fb297 (migration: options incompatible with cpr) # peterx/migration-next

Hi,

In this v6:

- Minor fixes to 17/23 and 19/23

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

Series structure
================

This series enables mapped-ram in steps:

0) Cleanups                           [1]
1) QIOChannel interfaces              [2-6]
2) Mapped-ram format for precopy      [7-11]

3) Multifd adaptation without packets [12-15]
4) Mapped-ram format for multifd [16-23]

* below will be sent separately *
5) Direct-io generic support [TODO]
6) Direct-io for mapped-ram multifd with file: URI [TODO]
7) Fdset interface for mapped-ram multifd [TODO]

About mapped-ram
================

Mapped-ram is a new stream format for the RAM section designed to supplement the existing ``file:`` migration and make it compatible with ``multifd``. This enables parallel migration of a guest's RAM to a file.

The core of the feature is to map RAM pages to migration file offsets. This enables the ``multifd`` threads to write exclusively to those offsets even if the guest is constantly dirtying pages (i.e. live migration).

Another benefit is that the resulting file will have a bounded size, since pages which are dirtied multiple times will always go to a fixed location in the file, rather than constantly being added to a sequential stream.

Having the pages at fixed offsets also allows the usage of O_DIRECT for save/restore of the migration stream as the pages are ensured to be written respecting O_DIRECT alignment restrictions.

Latest numbers (unchanged from v4)
==============

=> guest: 128 GB RAM - 120 GB dirty - 1 vcpu in tight loop dirtying memory => host: 128 CPU AMD EPYC 7543 - 2 NVMe disks in RAID0 (8586 MiB/s) - xfs => pinned vcpus w/ NUMA shortest distances - average of 3 runs - results
from query-migrate

non-live | time (ms) pages/s mb/s MB/s
-------------------+-----------------------------------

file               |    110512    256258   9549   1193
  + bg-snapshot    |    245660    119581   4303    537
-------------------+-----------------------------------
mapped-ram         |    157975    216877   6672    834
  + multifd 8 ch.  |     95922    292178  10982   1372
     + direct-io   |     23268   1936897  45330   5666

-------------------------------------------------------

live | time (ms) pages/s mb/s MB/s
-------------------+-----------------------------------
file | - - - - (file grew 4x the VM size)
+ bg-snapshot | 357635 141747 2974 371
-------------------+-----------------------------------

mapped-ram         |         -         -      -      - (no convergence in 5 min)
  + multifd 8 ch.  |    230812    497551  14900   1862
     + direct-io   |     27475   1788025  46736   5842

-------------------------------------------------------

v5:
https://lore.kernel.org/r/[email protected]
v4:
https://lore.kernel.org/r/[email protected]
v3:
https://lore.kernel.org/r/[email protected]
v2:
https://lore.kernel.org/r/[email protected]
v1:
https://lore.kernel.org/r/[email protected]

Fabiano Rosas (20):
migration/multifd: Cleanup multifd_recv_sync_main
io: fsync before closing a file channel migration/qemu-file: add utility methods for working with seekable
channels
migration/ram: Introduce 'mapped-ram' migration capability
migration: Add mapped-ram URI compatibility check migration/ram: Add outgoing 'mapped-ram' migration migration/ram: Add incoming 'mapped-ram' migration tests/qtest/migration: Add tests for mapped-ram file-based migration migration/multifd: Rename MultiFDSend|RecvParams::data to
compress_data
migration/multifd: Decouple recv method from pages migration/multifd: Allow multifd without packets migration/multifd: Allow receiving pages without packets migration/multifd: Add a wrapper for channels_created migration/multifd: Add outgoing QIOChannelFile support migration/multifd: Add incoming QIOChannelFile support migration/multifd: Prepare multifd sync for mapped-ram migration migration/multifd: Support outgoing mapped-ram stream format migration/multifd: Support incoming mapped-ram stream format migration/multifd: Add mapped-ram support to fd: URI tests/qtest/migration: Add a multifd + mapped-ram migration test

Nikolay Borisov (3):
io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file
io: Add generic pwritev/preadv interface
io: implement io_pwritev/preadv for QIOChannelFile

 docs/devel/migration/features.rst   |   1 +
 docs/devel/migration/mapped-ram.rst | 138 ++++++++++
 include/exec/ramblock.h             |  13 +
 include/io/channel.h                |  83 ++++++
 include/migration/qemu-file-types.h |   2 +
 include/qemu/bitops.h               |  13 +
 io/channel-file.c                   |  69 +++++
 io/channel.c                        |  58 ++++
 migration/fd.c                      |  44 +++
 migration/fd.h                      |   2 +
 migration/file.c                    | 149 +++++++++-
 migration/file.h                    |   8 +
 migration/migration.c               |  56 +++-
 migration/multifd-zlib.c            |  26 +-
 migration/multifd-zstd.c            |  26 +-
 migration/multifd.c                 | 405 ++++++++++++++++++++++------
 migration/multifd.h                 |  27 +-
 migration/options.c                 |  35 +++
 migration/options.h                 |   1 +
 migration/qemu-file.c               | 106 ++++++++
 migration/qemu-file.h               |   6 +
 migration/ram.c                     | 345 ++++++++++++++++++++++--
 migration/ram.h                     |   1 +
 migration/savevm.c                  |   1 +
 migration/trace-events              |   2 +-
 qapi/migration.json                 |   6 +-
 tests/qtest/migration-test.c        | 127 +++++++++
 27 files changed, 1607 insertions(+), 143 deletions(-)
 create mode 100644 docs/devel/migration/mapped-ram.rst
Signature · 1 line
2.35.3