qemu-file: Make a few functions non-static
The QEMUFile code will be moved to qemu-file.c. This will require makingthe following functions non-static because they are used by the savevm.ccode:
migration: Move QEMU_VM_* defines to migration/migration.h
The VMState code will be moved to vmstate.c and it uses some of theQEMU_VM_* constants, so move it to a header.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
vmstate: Add support for an array of ptimer_state *
Add support for defining a vmstate field which is an arrayof pointers to structures, and use this to define aVMSTATE_PTIMER_ARRAY() which allows an array of ptimer_state*to be used by devices.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
migration: add version supporting macros for struct pointer
This adds version supporting macros VMSTATE_STRUCT_POINTER_TEST_Vand VMSTATE_STRUCT_POINTER_V in addition to the already existingVMSTATE_STRUCT_POINTER and VMSTATE_STRUCT_POINTER_TEST macros....
migration: fix spice migration
Commit 29ae8a4133082e16970c9d4be09f4b6a15034617 ("rdma: introduceMIG_STATE_NONE and change MIG_STATE_SETUP state transition") changed thestate transitions during migration setup.
Spice used to be notified with MIG_STATE_ACTIVE and it detected this...
rdma: account for the time spent in MIG_STATE_SETUP through QMP
Using the previous patches, we're now able to timestamp the SETUPstate. Once we have this time, let the user know about it in theschema.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
rdma: core logic
Code that does need to be visible is keptwell contained inside this file and this is the onlynew additional file to the entire patch.
This file includes the entire protocol and interfacesrequired to perform RDMA migration.
Also, the configure and Makefile modifications to link...
rdma: introduce ram_handle_compressed()
This gives RDMA shared access to madvise() on the destination sidewhen an entire chunk is found to be zero.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>...
block-migration: efficiently encode zero blocks
this patch adds a efficient encoding for zero blocks byadding a new flag indicating a block is completely zero.
additionally bdrv_write_zeros() is used at the destinationto efficiently write these zeroes. depending on the implementation...
Add 'auto-converge' migration capability
The auto-converge migration capability allows the user to specify if theychoose live migration seqeunce to automatically detect and force convergence.
Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
linux-user: Fix compilation failure
Fix compilation failures for linux-user targets following recentmigration related commits bd2fa51fcd and 43487c67.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Message-id: 1372362818-4740-1-git-send-email-peter.maydell@linaro.org...
rdma: export throughput w/ MigrationStats QMP
This exposes throughput (in megabits/sec) through QMP.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Chegu Vinod <chegu_vinod@hp.com>Tested-by: Chegu Vinod <chegu_vinod@hp.com>...
rdma: introduce qemu_file_mode_is_not_valid()
QEMUFileRDMA also has read and write modes. This function is nowshared to reduce code duplication.
rdma: export qemu_fflush()
RDMA uses this to flush the control channel before sending itsown message to handle page registrations.
rdma: new QEMUFileOps hooks
These are the prototypes and implementation of new hooks thatRDMA takes advantage of to perform dynamic page registration.
An optional hook is also introduced for a custom functionto be able to override the default save_page function....
rdma: introduce capability x-rdma-pin-all
This capability allows you to disable dynamic chunk registrationfor better throughput on high-performance links.
For example, using an 8GB RAM virtual machine with all 8GB of memory inactive use and the VM itself is completely idle using a 40 gbps infiniband link:...
rdma: introduce qemu_update_position()
RDMA writes happen asynchronously, and thus the performance accountingalso needs to be able to occur asynchronously. This allows anybodyto call into savevm.c to update both f->pos as well as into arch_init.cto update the acct_info structure with up-to-date values when...
savevm: Implement block_writev_buffer()
Instead of breaking up RAM state into many small chunks, pass the iovecto the block layer for better performance.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
vmstate: Add support for two dimensional arrays
Add support for migrating two dimensional arrays, by defininga set of new macros VMSTATE_*_2DARRAY paralleling the existingVMSTATE_*_ARRAY macros. 2D arrays are handled the same for actualstate serialization; the only difference is that the type check...
vmstate.h: introduce VMSTATE_BUFFER_POINTER_UNSAFE macro
Macro could be used to migrate a dynamically allocated buffer of known size.
Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Message-id: 1362923278-4080-2-git-send-email-i.mitsyanko@gmail.com...
migration: do not sent zero pages in bulk stage
during bulk stage of ram migration if a page is azero page do not send it at all.the memory at the destination reads as zero anyway.
even if there is an madvise with QEMU_MADV_DONTNEEDat the target upon receipt of a zero page I have observed...
Add QemuFileWritevBuffer QemuFileOps
This will allow us to write an iovec
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
Add qemu_put_buffer_async
This allows us to add a buffer to the iovec to send without copying itinto the static buffer, the buffer will be sent later when qemu_fflush is called.
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
savevm: Add VMSTATE_UINTTL_EQUAL helper
This adds an _EQUAL VMSTATE helper for target_ulongs, defined in terms ofVMSTATE_UINT32_EQUAL or VMSTATE_UINT64_EQUAL as appropriate.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>Signed-off-by: Juan Quintela <quintela@redhat.com>
savevm: Add VMSTATE_FLOAT64 helpers
The current savevm code includes VMSTATE helpers for a number of commonlyused data types, but not for the float64 type used by the internal floatingpoint emulation code. This patch fixes the deficiency.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
savevm: Add VMSTATE_STRUCT_VARRAY_POINTER_UINT32
Currently the savevm code contains a VMSTATE_STRUCT_VARRAY_POINTER_INT32helper (a variably sized array with the number of elements in an int32_t),but not VMSTATE_STRUCT_VARRAY_POINTER_UINT32 (... with the number of...
savevm: Fix bugs in the VMSTATE_VBUFFER_MULTIPLY definition
The VMSTATE_BUFFER_MULTIPLY macro is misnamed - it actually specifiesa variably sized buffer with VMS_VBUFFER, so should be namedVMSTATE_VBUFFER_MULTIPLY. This patch fixes this (the macro had no current...
savevm: Add VMSTATE_UINT64_EQUAL helpers
The savevm code already includes a number of *_EQUAL helpers which act assanity checks verifying that the configuration of the saved state matchesthat of the machine we're loading into to work. Variants already exist...
vmstate: Make vmstate_register() static inline
This avoids adding a duplicate stub for CONFIG_USER_ONLY.
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>...
stubs: Add a vmstate_dummy struct for CONFIG_USER_ONLY
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
migration: eliminate s->migration_file
The indirection is useless now. Backends can open s->file directly.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
page_cache: dup memory on insert
The page cache frees all data on finish, on resize andif there is collision on insert. So it should be the cachesresponsibility to dup the data that is stored in the cache.
Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Orit Wasserman <owasserm@redhat.com>...
migration: yay, buffering is gone
Buffering was needed because blocking writes could take a long timeand starve other threads seeking to grab the big QEMU mutex.
Now that all writes (except within _complete callbacks) are doneoutside the big QEMU mutex, we do not need buffering at all....
qemu-file: make qemu_fflush and qemu_file_set_error private again
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: merge qemu_popen_cmd with qemu_popen
There is no reason for outgoing exec migration to do popen manuallyanymore (the reason used to be that we needed the FILE* to make itnon-blocking). Use qemu_popen_cmd.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
qemu-file: add writable socket QEMUFile
migration: use QEMUFile for migration channel lifetime
As a start, use QEMUFile to store the destination and close it.qemu_get_fd gets a file descriptor that will be used by the writecallbacks.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>...
migration: use QEMUFile for writing outgoing migration data
Second, drop the file descriptor indirection, and write directly to theQEMUFile.
migration: move rate limiting to QEMUFile
Rate limiting is now simply a byte counter; client callqemu_file_rate_limit() manually to determine if they have to exit.So it is possible and simple to move the functionality to QEMUFile.
This makes the remaining functionality of s->file redundant;...
qemu-file: temporarily expose qemu_file_set_error and qemu_fflush
Right now, migration cannot entirely rely on QEMUFile's automaticdrop of I/O after an error, because it does its "real" I/O outsidethe put_buffer callback. To fix this until buffering is gone, expose...
migration: simplify error handling
Always use qemu_file_get_error to detect errors, since that is howQEMUFile itself drops I/O after an error occurs. There is no needto propagate and check return values all the time.
Also remove the "complete" member, since we know that it is set (via...
migration: cleanup migration (including thread) in the iothread
Perform final cleanup in a bottom half, and add joining the thread tothe series of cleanup actions.
migrate_fd_error remains for connection error, but it doesn't needto cleanup anything anymore....
migration: reorder SaveVMHandlers members
This groups together the callbacks that later will have similarlocking rules.
migration: run pending/iterate callbacks out of big lock
This makes it possible to do blocking writes directly to the socket,with no buffer in the middle. For RAM, only the migration_bitmap_sync()call needs the iothread lock. For block migration, it is needed by...
migration: run setup callbacks out of big lock
Only the migration_bitmap_sync() call needs the iothread lock.
hw: move fifo.[ch] to libqemuutil
fifo.c is generic code that can be easily unit tested. So itbelongs in libqemuutil.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration: calculate expected_downtime
We removed the calculation in commit e4ed1541ac9413eac494a03532e34beaf8a7d1c5
Now we add it back. We need to create dirty_bytes_rate because wecan't include cpu-all.h from migration.c, and there is no other way to...
migration: make qemu_ftell() public and support writable files
Migration .save_live_iterate() functions return the number of bytestransferred. The easiest way of doing this is by calling qemu_ftell(f)at the beginning and end of the function to calculate the difference....
migration: move beginning stage to the migration thread
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
migration: make function static
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
migration: merge QEMUFileBuffered into MigrationState
Avoid splitting the state of outgoing migration, more or less arbitrarily,between two data structures. QEMUFileBuffered anyway is used only duringmigration.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
migration: move migration_fd_put_ready()
Put it near its use and un-export it.
migration: Inline qemu_fopen_ops_buffered into migrate_fd_connect
migration: move buffered_file.c code into migration.c
This only moves the code (also from buffered_file.h to migration.h).Fix whitespace until checkpatch is happy.
migration: make qemu_fopen_ops_buffered() return void
We want the file assignment to happen before the thread is created toavoid locking, so we just do it before creating the thread.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
migration: move migration thread init code to migrate_fd_put_ready
This way everything related with migration is run on the migrationthread and no locking is needed.
migration: make writes blocking
Move all the writes to the migration_thread, and make writingsblocking. Notice that are still using the iothread for everythingthat we do.
migration: remove unfreeze logic
Now that we have a thread, and blocking writes, we don't need it.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
savevm: New save live migration method: pending
Code just now does (simplified for clarity)
if (qemu_savevm_state_iterate(s->file) == 1) { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); }
Problem here is that qemu_savevm_state_iterate() returns 1 when it...
misc: move include files to include/qemu/
migration: move include files to include/migration/