All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/46] Postcopy implementation
@ 2014-07-04 17:41 Dr. David Alan Gilbert (git)
  2014-07-04 17:41 ` [Qemu-devel] [PATCH 01/46] qemu_ram_foreach_block: pass up error value, and down the ramblock name Dr. David Alan Gilbert (git)
                   ` (46 more replies)
  0 siblings, 47 replies; 83+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2014-07-04 17:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: aarcange, yamahata, lilei, quintela

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Hi,
  This is the 1st cut of my version of postcopy; it is designed for use with
the Linux kernel additions recently posted by Andrea Arcangeli here:

   http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg00525.html

The current status is:
  1) It works - I've done testing on large/busy VMs using
     google-stress app test, and it completes cleanly even over a 1Gbps
     link.

  2) It's still rather rough around the corner cases and exit code,
     so it's probably not ready for review yet, but I thought I'd put
     it out for people working in the area and for people to see the
     general shape.

I've taken some ideas from Isaku Yamahata's work, but the code is
structured a bit differently, however I'm greatful for the understanding
I got from Isaku's code of the problems postcopy has to deal with.

Note, the last patch in the series is a chunk of documentation,
which it's probably useful to read for detail.

Some points:
   a) I've tried to keep the pieces I've added general rather than postcopy
      specific.

   b) Precopy is done using the main precopy code (with very few modifications)
      and it automatically switches to postcopy after a timeout.

   c) A 'command' section type is added that controls the progress of postcopy
      and can be used for anything else people need to control that's not actually
      guest state.

   d) There is a 'return path' mechanism for sending data from the destination
      back to the source, postcopy uses this for the page requests, but I think
      it's also useful for things like the failover implementations, and can
      be used to signal failure from the destination to the source.

   e) I've added a 'migration_set_parameter' command as somewhere to put integer
      parameters associated with migration.
      e.1) And I use that initially for the length of precopy to try.

   f) I've added a 'MigrationIncomingState' where postcopy keeps it's data,
      it seems a good idea to move other incoming state there as well.

c & d together provide a 'reqack' that's basically a ping, quite useful
for debugging

Current TODO:
   1) It's not bisectable yet
   2) There are no testsuite additions (although I have a virt-test modification
      I've been using).
   3) End-of-migration cleanup is unfinished, as is some of the error handling.
   4) Not all the code is there for systems with hostpagesize!=qemupagesize
   5) xbzrle needs disabling once in postcopy
   6) RDMA needs some rework
   7) I moved QEMUFile into a public header, it's a bad idea and I'll undo that.
   8) My latency measurements on page requests are generally pretty good, but I'm
      seeing a few high spikes, I need to investigate.
   9) Andrea has suggestions on ways to avoid some of the huge-page splitting
      that occurs during the discard phase after precopy.
  10) I'd like to format the data on the return path in a more structured way
      (i.e. maybe using stuff from my BER world).

I'm hoping to get that lot cleared up by 2.2

How to use:
   migrate_set_capability x-postcopy-ram on
   migrate_set_parameter x-postcopy-start-time 500            <--- that's in ms
   migrate -d tcp:whereever:port

Other ideas:
  I think the returnpath+command could be used to send qmp commands to
  the destination to allow the src/destination to coordinate a hotplug
  or to set up the destination state.

Dave
Dr. David Alan Gilbert (46):
  qemu_ram_foreach_block: pass up error value, and down the ramblock
    name
  Move QEMUFile structure to qemu-file.h
  QEMUSizedBuffer/QEMUFile
  improve DPRINTF macros, add to savevm
  Add qemu_get_counted_string to read a string prefixed by a count byte
  Create MigrationIncomingState
  Return path: Open a return path on QEMUFile for sockets
  Return path: socket_writev_buffer: Block even on non-blocking fd's
  Migration commands
  Return path: Control commands
  Return path: Send responses from destination to source
  Return path: Source handling of return path
  qemu_loadvm debug
  ram_debug_dump_bitmap: Dump a migration bitmap as text
  Rework loadvm path for subloops
  Add migration-capability boolean for postcopy-ram.
  Add wrappers and handlers for sending/receiving the postcopy-ram
    migration messages.
  QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream
  migrate_init: Call from savevm
  Allow savevm handlers to state whether they could go into postcopy
  postcopy: OS support test
  Migration parameters: Add qmp/hmp commands for setting/viewing
  MIG_STATE_POSTCOPY_ACTIVE: Add new migration state
  qemu_savevm_state_complete: Postcopy changes
  Postcopy: Maintain sentmap during postcopy pre phase
  Postcopy page-map-incoming (PMI) structure
  postcopy: Add incoming_init/cleanup functions
  postcopy: Incoming initialisation
  postcopy: ram_enable_notify to switch on userfault
  Postcopy: postcopy_start
  Postcopy: Rework migration thread for postcopy mode
  mig fd_connect: open return path
  Postcopy: Create a fault handler thread before marking the ram as
    userfault
  Page request:  Add MIG_RPCOMM_REQPAGES reverse command
  Page request: Process incoming page request
  Page request: Consume pages off the post-copy queue
  Add assertion to check migration_dirty_pages doesn't go -ve; have seen
    it happen once but not sure why
  postcopy_ram.c: place_page and helpers
  Postcopy: Use helpers to map pages during migration
  qemu_ram_block_from_host
  Handle userfault requests (although userfaultfd not done yet)
  Start up a postcopy/listener thread ready for incoming page data
  postcopy: Wire up loadvm_postcopy_ram_handle_{run,end} commands
  postcopy: Use userfaultfd
  End of migration for postcopy
  Start documenting how postcopy works.

 Makefile.objs                    |   2 +-
 arch_init.c                      | 477 ++++++++++++++++++++--
 docs/migration.txt               | 148 +++++++
 exec.c                           |  60 ++-
 hmp-commands.hx                  |  17 +
 hmp.c                            |  54 +++
 hmp.h                            |   4 +
 include/exec/cpu-common.h        |   7 +-
 include/migration/migration.h    | 115 ++++++
 include/migration/postcopy-ram.h |  83 ++++
 include/migration/qemu-file.h    |  62 +++
 include/migration/vmstate.h      |   2 +-
 include/qemu/typedefs.h          |   8 +-
 include/sysemu/sysemu.h          |  41 +-
 migration-rdma.c                 |   4 +-
 migration.c                      | 695 ++++++++++++++++++++++++++++++--
 monitor.c                        |  25 ++
 postcopy-ram.c                   | 833 +++++++++++++++++++++++++++++++++++++++
 qapi-schema.json                 |  56 ++-
 qemu-file.c                      | 578 +++++++++++++++++++++++++--
 qmp-commands.hx                  |  23 ++
 savevm.c                         | 822 +++++++++++++++++++++++++++++++++++---
 22 files changed, 3933 insertions(+), 183 deletions(-)
 create mode 100644 include/migration/postcopy-ram.h
 create mode 100644 postcopy-ram.c

-- 
1.9.3

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

end of thread, other threads:[~2014-08-28 11:24 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 17:41 [Qemu-devel] [PATCH 00/46] Postcopy implementation Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 01/46] qemu_ram_foreach_block: pass up error value, and down the ramblock name Dr. David Alan Gilbert (git)
2014-07-07 15:46   ` Eric Blake
2014-07-07 15:48     ` Dr. David Alan Gilbert
2014-07-04 17:41 ` [Qemu-devel] [PATCH 02/46] Move QEMUFile structure to qemu-file.h Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 03/46] QEMUSizedBuffer/QEMUFile Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 04/46] improve DPRINTF macros, add to savevm Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 05/46] Add qemu_get_counted_string to read a string prefixed by a count byte Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 06/46] Create MigrationIncomingState Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 07/46] Return path: Open a return path on QEMUFile for sockets Dr. David Alan Gilbert (git)
2014-07-05 10:06   ` Paolo Bonzini
2014-07-16  9:37     ` Dr. David Alan Gilbert
2014-07-16  9:50       ` Paolo Bonzini
2014-07-16 11:52         ` Dr. David Alan Gilbert
2014-07-16 12:31           ` Paolo Bonzini
2014-07-16 17:10             ` Dr. David Alan Gilbert
2014-07-17  6:25               ` Paolo Bonzini
2014-07-04 17:41 ` [Qemu-devel] [PATCH 08/46] Return path: socket_writev_buffer: Block even on non-blocking fd's Dr. David Alan Gilbert (git)
2014-07-05 10:07   ` Paolo Bonzini
2014-07-04 17:41 ` [Qemu-devel] [PATCH 09/46] Migration commands Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 10/46] Return path: Control commands Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 11/46] Return path: Send responses from destination to source Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 12/46] Return path: Source handling of return path Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 13/46] qemu_loadvm debug Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 14/46] ram_debug_dump_bitmap: Dump a migration bitmap as text Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 15/46] Rework loadvm path for subloops Dr. David Alan Gilbert (git)
2014-07-05 10:26   ` Paolo Bonzini
2014-07-07 14:35     ` Dr. David Alan Gilbert
2014-07-07 14:53       ` Paolo Bonzini
2014-07-07 15:04         ` Dr. David Alan Gilbert
2014-07-16  9:25         ` Dr. David Alan Gilbert
2014-07-04 17:41 ` [Qemu-devel] [PATCH 16/46] Add migration-capability boolean for postcopy-ram Dr. David Alan Gilbert (git)
2014-07-07 19:41   ` Eric Blake
2014-07-07 20:23     ` Dr. David Alan Gilbert
2014-07-10 16:17       ` Paolo Bonzini
2014-07-10 19:02         ` Dr. David Alan Gilbert
2014-07-04 17:41 ` [Qemu-devel] [PATCH 17/46] Add wrappers and handlers for sending/receiving the postcopy-ram migration messages Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 18/46] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 19/46] migrate_init: Call from savevm Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 20/46] Allow savevm handlers to state whether they could go into postcopy Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 21/46] postcopy: OS support test Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 22/46] Migration parameters: Add qmp/hmp commands for setting/viewing Dr. David Alan Gilbert (git)
2014-07-07 19:50   ` Eric Blake
2014-07-04 17:41 ` [Qemu-devel] [PATCH 23/46] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 24/46] qemu_savevm_state_complete: Postcopy changes Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 25/46] Postcopy: Maintain sentmap during postcopy pre phase Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 26/46] Postcopy page-map-incoming (PMI) structure Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 27/46] postcopy: Add incoming_init/cleanup functions Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 28/46] postcopy: Incoming initialisation Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 29/46] postcopy: ram_enable_notify to switch on userfault Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 30/46] Postcopy: postcopy_start Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 31/46] Postcopy: Rework migration thread for postcopy mode Dr. David Alan Gilbert (git)
2014-07-05 10:19   ` Paolo Bonzini
2014-08-28 11:04     ` Dr. David Alan Gilbert
2014-08-28 11:23       ` Paolo Bonzini
2014-07-04 17:41 ` [Qemu-devel] [PATCH 32/46] mig fd_connect: open return path Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 33/46] Postcopy: Create a fault handler thread before marking the ram as userfault Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 34/46] Page request: Add MIG_RPCOMM_REQPAGES reverse command Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 35/46] Page request: Process incoming page request Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 36/46] Page request: Consume pages off the post-copy queue Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 37/46] Add assertion to check migration_dirty_pages doesn't go -ve; have seen it happen once but not sure why Dr. David Alan Gilbert (git)
2014-07-11 15:20   ` Eric Blake
2014-07-11 15:41     ` Dr. David Alan Gilbert
2014-07-04 17:41 ` [Qemu-devel] [PATCH 38/46] postcopy_ram.c: place_page and helpers Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 39/46] Postcopy: Use helpers to map pages during migration Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 40/46] qemu_ram_block_from_host Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 41/46] Handle userfault requests (although userfaultfd not done yet) Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 42/46] Start up a postcopy/listener thread ready for incoming page data Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 43/46] postcopy: Wire up loadvm_postcopy_ram_handle_{run, end} commands Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 44/46] postcopy: Use userfaultfd Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 45/46] End of migration for postcopy Dr. David Alan Gilbert (git)
2014-07-04 17:41 ` [Qemu-devel] [PATCH 46/46] Start documenting how postcopy works Dr. David Alan Gilbert (git)
2014-07-05 10:28 ` [Qemu-devel] [PATCH 00/46] Postcopy implementation Paolo Bonzini
2014-07-07 14:02   ` Dr. David Alan Gilbert
2014-07-07 14:35     ` Paolo Bonzini
2014-07-07 14:58       ` Dr. David Alan Gilbert
2014-07-10 11:29       ` Dr. David Alan Gilbert
2014-07-10 12:48         ` Eric Blake
2014-07-10 13:37           ` Dr. David Alan Gilbert
2014-07-10 15:33             ` Andrea Arcangeli
2014-07-10 15:49               ` Dr. David Alan Gilbert
2014-07-11  4:05                 ` Sanidhya Kashyap
2014-08-11 15:31           ` Dr. David Alan Gilbert

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.