[RFC PATCH 00/11] Add support for fixed ram offsets during migration

Nikolay Borisov posted 11 patches 1 year, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221004123733.2745519-1-nborisov@suse.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, "Daniel P. Berrangé" <berrange@redhat.com>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>
There is a newer version of this series
include/exec/ramblock.h             |   7 +
include/io/channel-file.h           |  10 +
include/io/channel.h                |   1 +
include/migration/qemu-file-types.h |   2 +
io/channel-file.c                   |  55 +++++
migration/file.c                    |  38 ++++
migration/file.h                    |  10 +
migration/meson.build               |   1 +
migration/migration.c               |  61 +++++-
migration/migration.h               |   6 +
migration/qemu-file.c               |  82 +++++++
migration/qemu-file.h               |   4 +
migration/ram.c                     | 322 +++++++++++++++++++++-------
migration/savevm.c                  |  39 ++--
qapi/migration.json                 |   2 +-
scripts/analyze-migration.py        |  49 ++++-
16 files changed, 587 insertions(+), 102 deletions(-)
create mode 100644 migration/file.c
create mode 100644 migration/file.h
[RFC PATCH 00/11] Add support for fixed ram offsets during migration
Posted by Nikolay Borisov 1 year, 6 months ago
This series implements what I call "fixed-ram" capability (I'm happy to change
the name if people deem it necessary). The idea is that while performing ram
migration each dirty page will have a specific offset in the resulting file.
The main benefit this has is that now when migrating to a file it will have an
upper limit to its size since a page that has been dirtied multiple times won't be
saved multiple times in the stream. More details about the actual stream changes
necessary to accommodate this can be found in patch 8.

Furthermore I intend on using this code as a foundation for implementing DIO-based
save directly from qemu. The current iteration also introduces the "file:" URI to
perform the save/restore to a file, however in the past there was a discussion that
instead of a file an externally passed FD can be used.

What's missing/pending improvements:

 - No tests, I've yet to spend some time with qtest to introduce some tests,
 will work on this based on the interest the series garners

 - I feel the restore is somewhat suboptimal, namely that each and every page is
 read individually, probably there are some effects of read-ahead caching from
 linux that we are gaining but I feel it'd be more efficient if it'll be possible
 to read multiple pages provided they are sequential ( I have to check what support
 is in there in the bitmap ops to scan for contiguous ranges of sets bits)

 - Finish support in analyze-migration.py

 - Possibly implement the "external fd" support for "fixed-ram" capability.

All feedback is welcome.

Nikolay Borisov (11):
  migration: support file: uri for source migration
  migration: Add support for 'file:' uri for incoming migration
  migration: Make migration json writer part of MigrationState struct
  io: add pwritev support to QIOChannelFile
  io: Add support for seekable channels
  io: Add preadv support to QIOChannelFile
  migration: add qemu_get_buffer_at
  migration/ram: Introduce 'fixed-ram' migration stream capability
  migration: Refactor precopy ram loading code
  migration: Add support for 'fixed-ram' migration restore
  analyze-migration.py: add initial support for fixed ram streams

 include/exec/ramblock.h             |   7 +
 include/io/channel-file.h           |  10 +
 include/io/channel.h                |   1 +
 include/migration/qemu-file-types.h |   2 +
 io/channel-file.c                   |  55 +++++
 migration/file.c                    |  38 ++++
 migration/file.h                    |  10 +
 migration/meson.build               |   1 +
 migration/migration.c               |  61 +++++-
 migration/migration.h               |   6 +
 migration/qemu-file.c               |  82 +++++++
 migration/qemu-file.h               |   4 +
 migration/ram.c                     | 322 +++++++++++++++++++++-------
 migration/savevm.c                  |  39 ++--
 qapi/migration.json                 |   2 +-
 scripts/analyze-migration.py        |  49 ++++-
 16 files changed, 587 insertions(+), 102 deletions(-)
 create mode 100644 migration/file.c
 create mode 100644 migration/file.h

--
2.34.1