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_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/