qemu/migration
Peter Xu c01b16edf6 migration: Postcopy preemption enablement
This patch enables postcopy-preempt feature.

It contains two major changes to the migration logic:

(1) Postcopy requests are now sent via a different socket from precopy
    background migration stream, so as to be isolated from very high page
    request delays.

(2) For huge page enabled hosts: when there's postcopy requests, they can now
    intercept a partial sending of huge host pages on src QEMU.

After this patch, we'll live migrate a VM with two channels for postcopy: (1)
PRECOPY channel, which is the default channel that transfers background pages;
and (2) POSTCOPY channel, which only transfers requested pages.

There's no strict rule of which channel to use, e.g., if a requested page is
already being transferred on precopy channel, then we will keep using the same
precopy channel to transfer the page even if it's explicitly requested.  In 99%
of the cases we'll prioritize the channels so we send requested page via the
postcopy channel as long as possible.

On the source QEMU, when we found a postcopy request, we'll interrupt the
PRECOPY channel sending process and quickly switch to the POSTCOPY channel.
After we serviced all the high priority postcopy pages, we'll switch back to
PRECOPY channel so that we'll continue to send the interrupted huge page again.
There's no new thread introduced on src QEMU.

On the destination QEMU, one new thread is introduced to receive page data from
the postcopy specific socket (done in the preparation patch).

This patch has a side effect: after sending postcopy pages, previously we'll
assume the guest will access follow up pages so we'll keep sending from there.
Now it's changed.  Instead of going on with a postcopy requested page, we'll go
back and continue sending the precopy huge page (which can be intercepted by a
postcopy request so the huge page can be sent partially before).

Whether that's a problem is debatable, because "assuming the guest will
continue to access the next page" may not really suite when huge pages are
used, especially if the huge page is large (e.g. 1GB pages).  So that locality
hint is much meaningless if huge pages are used.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220707185504.27203-1-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2022-07-20 12:15:08 +01:00
..
block-dirty-bitmap.c migration: block-dirty-bitmap: add missing qemu_mutex_lock_iothread 2021-10-05 13:10:29 +02:00
block.c block: Change blk_{pread,pwrite}() param order 2022-07-12 12:14:56 +02:00
block.h migration: disable auto-converge during bulk block migration 2017-09-27 11:27:14 +01:00
channel-block.c migration: introduce a QIOChannel impl for BlockDriverState VMState 2022-06-22 19:33:43 +01:00
channel-block.h migration: introduce a QIOChannel impl for BlockDriverState VMState 2022-06-22 19:33:43 +01:00
channel.c migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
channel.h migration: Route errors down through migration_channel_connect 2018-02-06 10:55:12 +00:00
colo-failover.c qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
colo.c migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
dirtyrate.c migration/dirtyrate: Refactor dirty page rate calculation 2022-07-20 12:15:08 +01:00
dirtyrate.h migration/dirtyrate: Refactor dirty page rate calculation 2022-07-20 12:15:08 +01:00
exec.c migration: unify incoming processing 2018-07-10 12:48:53 +01:00
exec.h migration: Export exec.c functions in its own file 2017-06-01 18:49:22 +02:00
fd.c monitor: Use getter/setter functions for cur_mon 2020-10-09 07:08:19 +02:00
fd.h migration: Fix fd protocol for incoming defer 2019-06-05 12:43:55 +02:00
global_state.c migration: Silence compiler warning in global_state_store_running() 2020-10-02 12:28:48 +01:00
meson.build migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
migration.c migration: Postcopy preemption enablement 2022-07-20 12:15:08 +01:00
migration.h migration: Postcopy preemption enablement 2022-07-20 12:15:08 +01:00
multifd-zlib.c multifd: Copy pages before compressing them with zlib 2022-07-20 12:15:08 +01:00
multifd-zstd.c multifd: recv side only needs the RAMBlock host address 2022-01-28 15:38:23 +01:00
multifd.c migration: rename qemu_file_update_transfer to qemu_file_acct_rate_limit 2022-06-22 19:33:43 +01:00
multifd.h multifd: Implement zero copy write in multifd migration (multifd-zero-copy) 2022-05-16 13:56:24 +01:00
page_cache.c migration: Fix cache_init()'s "Failed to allocate" error messages 2021-02-08 11:19:51 +00:00
page_cache.h migration: Clean up signed vs. unsigned XBZRLE cache-size 2021-02-08 11:19:51 +00:00
postcopy-ram.c migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
postcopy-ram.h migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
qemu-file.c migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
qemu-file.h migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
ram.c migration: Postcopy preemption enablement 2022-07-20 12:15:08 +01:00
ram.h migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
rdma.c migration: remove the QEMUFileOps abstraction 2022-06-23 10:18:13 +01:00
rdma.h migration: Export rdma.c functions in its own file 2017-06-01 18:49:23 +02:00
savevm.c migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
savevm.h migration: Add blocker information 2021-02-08 11:19:51 +00:00
socket.c migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
socket.h migration: Postcopy preemption preparation on channel creation 2022-07-20 12:15:08 +01:00
target.c migration: Move populate_vfio_info() into a separate file 2021-05-14 12:31:51 +02:00
tls.c migration: fix use of TLS PSK credentials with a UNIX socket 2022-04-21 19:36:46 +01:00
tls.h migration: Fix Lesser GPL version number 2020-11-15 16:43:28 +01:00
trace-events migration: Postcopy preemption enablement 2022-07-20 12:15:08 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vmstate-types.c Move CPU softfloat unions to cpu-float.h 2022-04-06 14:31:43 +02:00
vmstate.c migration: rename qemu_ftell to qemu_file_total_transferred 2022-06-22 19:33:36 +01:00
xbzrle.c migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
xbzrle.h migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
yank_functions.c migration: Move the yank unregister of channel_close out 2021-07-26 12:45:03 +01:00
yank_functions.h migration: Move the yank unregister of channel_close out 2021-07-26 12:45:03 +01:00