History | View | Annotate | Download (18.8 kB)
migration: Fix compiler warning ('caps' may be used uninitialized)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>Reviewed-by: Stefan Weil <sw@weilnetz.de>
migration: Fix debug print type
The printf args are uint64_t and with -Werr QEMU doesn't compile withmigration debugging turned on unless this is fixed. Fix it.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>Signed-off-by: Juan Quintela <quintela@redhat.com>
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.
Switch the entire code base to using the new timer API.
Note this patch may introduce some line length issues.
Signed-off-by: Alex Bligh <alex@alex.org.uk>...
aio / timers: Untangle include files
include/qemu/timer.h has no need to include main-loop.h anddoing so causes an issue for the next patch. Unfortunatelyvarious files assume including timers.h will pull in main-loop.h.Untangle this mess.
migration: send total time in QMP at "completed" stage
The "completed" stage sets total_time but not has_total_time andthus it is not sent via QMP reply (but sent via HMP nevertheless)
Signed-off-by: Pawit Pornkitprasan <p.pawit@gmail.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
migration: don't use uninitialized variables
The qmp_migrate method uses the 'blk' and 'inc' parameter withoutchecking if they're valid or not (they may be uninitialized ifcommand is received via QMP)
Signed-off-by: Pawit Pornkitprasan <p.pawit@gmail.com>...
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...
migration: notify migration state before starting thread
The migration thread runs outside the QEMU global mutex when possible.Therefore we must notify migration state change before starting themigration thread.
This allows registered listeners to act before live migration iterations...
rdma: introduce MIG_STATE_NONE and change MIG_STATE_SETUP state transition
As described in the previous patch, until now, the MIG_STATE_SETUPstate was not really a 'formal' state. It has been used as a 'zero' state(what we're calling 'NONE' here) and QEMU has been unconditionally transitioning...
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: allow state transitions between other states besides ACTIVE
This patch is in preparation for the next ones: Until now the MIG_STATE_SETUPstate was not really a 'formal' state. It has been used as a 'zero' stateand QEMU has been unconditionally transitioning into this state when...
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...
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...
Merge remote-tracking branch 'quintela/migration.next' into staging
Message-id: 1373664508-5404-1-git-send-email-quintela@redhat.com...
migration: Fail migration on bdrv_flush_all() error
If bdrv_flush_all() returns an error, there is an inconsistency in theview of an image file between the source and the destination host.Completing the migration would lead to corruption. Better abortmigration in this case....
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>...
add a header file for atomic operations
We're already using them in several places, but __sync builtins are justtoo ugly to type, and do not provide seqcst load/store operations.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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 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:...
migration: Remove duplicate bandwidth_limit set
bandwidth_limit is double set in migrate_init(), remove one.
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Revert "migration: don't account sleep time for calculating bandwidth"
This reverts commit 7161082c8d8cf167c508976887a0a63f4db92b51.
Reverting this patch fixes a divide-by-zero error in qemu that can befairly reliably triggered by doing block migration. In this case, the...
migration: reflect incoming failure to shell
Management apps like libvirt don't know to pay attention tostderr unless there is a non-zero exit status.
Signed-off-by: Eric Blake <eblake@redhat.com>...
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.Rename to qemu_set_nonblock() just like qemu_set_cloexec().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.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...
migration: move contents of migration_close to migrate_fd_cleanup
With this patch, the migration_file is not needed anymore.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
migration: eliminate s->migration_file
The indirection is useless now. Backends can open s->file directly.
migration: inline migrate_fd_close
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: 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....
Rename buffered_ to migration_
This is consistent once that we have moved everything to migration.c
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: eliminate last_round
We will go around the loop exactly once after setting last_round.Eliminate the variable altogether.
migration: detect error before sleeping
migration: remove useless qemu_file_get_error check
migration_put_buffer is never called if there has been an error.
migration: use qemu_file_rate_limit consistently
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: use qemu_ftell to compute bandwidth
Prepare for when s->bytes_xfer will be removed.
migration: small changes around rate-limiting
This patch extracts a few small changes from the next patch, whichare unrelated to adding generic rate-limiting functionality toQEMUFile. Make migration_set_rate_limit a simple accessor, anduse qemu_file_set_rate_limit consistently. Also fix a typo where...
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;...
migration: flush all data to fd when buffered_flush is called
Including data that resided in the QEMUFile's own buffer.
migration: use qemu_file_set_error
Remove the return value of buffered_flush, pass it via the error codeof s->file. Once this is done, the error can be retrieved simplyvia migrate_fd_close's call to qemu_fclose.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
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: do not nest flushing of device data
Completion of migration is currently done with a "nested" loop thatinvokes buffered_flush: migrate_fd_completed is called bybuffered_file_thread, which calls migrate_fd_cleanup, which callsbuffered_close (via qemu_fclose), which flushes the buffer....
migration: add migrate_set_state tracepoint
Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: prepare to access s->state outside critical sections
Accessing s->state outside the big QEMU lock will simplify a bit thelocking/unlocking of the iothread lock.
We need to keep the lock in migrate_fd_error and migrate_fd_completed,however, because they call migrate_fd_cleanup....
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: 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.
migration: simplify while loop
Unify the goto around the loop, with the exit condition at the end of it.Both can be expressed as "while (ret >= 0)".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: always use vm_stop_force_state
vm_stop_force_state does:
if (runstate_is_running()) { vm_stop(state); } else { runstate_set(state); }
migration.c does:
if (runstate_is_running()) { vm_stop(state); } else {...
migration: move more error handling to migrate_fd_cleanup
The next patch will add more cases where qemu_savevm_state_cancelneeds to be called; prepare for that already, the function can becalled twice with no ill effect.
migration: change initial value of expected_downtime
0 is a very bad initial value, what we are trying to get ismax_downtime, so that is a much better estimation.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
migration: calculate end time after we have sent the data
migration: don't account sleep time for calculating bandwidth
While we are sleeping we are not sending, so we should not use thattime to estimate our bandwidth.
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: restrict scope of incoming fd read handler
The incoming migration is processed in a coroutine and uses an fd readhandler to enter the yielded coroutine when data becomes available.
The read handler was set too broadly, so that spurious coroutine entries...
error: Strip trailing '\n' from error string arguments (again)
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep comingback. Tracked down with this Coccinelle semantic patch:
r expression err, eno, cls, fmt; position p; @@ (...
r
migration: Add buffered_flush error handling
Now that we have error handling we can do proper handling ofbuffered_flush().
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
migration: move exit condition to migration thread
migration: unfold rest of migrate_fd_put_ready() into thread
This will allow us finer control in next patches.
migration: Only go to the iterate stage if there is anything to send
Signed-off-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
migration: remove argument to qemu_savevm_state_cancel
migration: move beginning stage to the migration thread
migration: make function static
Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
migration: remove double call to migrate_fd_close
The call in buffered_close is enough, because buffered_close is calledalready by migrate_fd_cleanup.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>...
migration: fix off-by-one in buffered_rate_limit
use XFER_LIMIT_RATIO consistently
commit 5b4e1eb769eee892b44d3f6b2369b05196442f59
missed this use.
migration: fix qemu_get_fd for BufferedFile
Not really used, but nice to have it correct. :)
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: add XFER_LIMIT_RATIO
The "magic" divisions by 10 are there because of the value of BUFFER_DELAY.Introduce a constant to explain them better.
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 migration notifier
At this point, it is waranteed that state is ACTIVE. Old positiondidn't assured hat.
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.
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>
migration: just lock migrate_fd_put_ready
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...
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
migration: move include files to include/migration/
block: move include files to include/block/
migration: move process_incoming_migration to a coroutine
The final part of incoming migration, which now consists ofprocess_incoming_migration for all protocols, is thus made non-blocking.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration: use migrate_fd_close in migrate_fd_cleanup
migrate_fd_cleanup will usually close the file descriptor viabuffered_file_close's call to migrate_fd_close. However, in the caseof s->file == NULL it is "inlining" migrate_fd_close (almost: there is a...
migration: move qemu_fclose to process_incoming_migration
The common suffix is now just process_incoming_migration.
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
migration: go to paused state after finishing incoming migration with -S
At the end of migration the machine has started already, and cannot bedestroyed without losing the guest's data. Hence, prelaunch is thewrong state. Go to the paused state instead. QEMU would reach that...
migration: centralize call to migrate_fd_error()
The call to migrate_fd_error() was missing for non-socket backends, socentralize it in qmp_migrate().
Before:
(qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate...
migration: use qemu-sockets to establish Unix sockets
This makes migration-unix.c again a cut-and-paste job from migration-tcp.c,exactly as it was in the beginning. :)
migration (outgoing): add error propagation for all protocols
Error propagation is already there for socket backends. Add it to otherprotocols, simplifying code that tests for errors that will never happen.With all protocols understanding Error, the code can be simplified...
migration (incoming): add error propagation to fd and exec protocols
And remove the superfluous integer return value.
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration: avoid using error_is_set and thus relying on errp != NULL
The migration code is using errp to detect "internal" errors, this meansthat it relies on errp being non-NULL.
No impact so far because our only QMP clients (the QMP marshaller and HMP)...
savevm: make qemu_file_put_notify() return errors
buffered_file: unfold migrate_fd_wait_for_unfreeze
We only used it once, just remove the callback indirection.
buffered_file: unfold migrate_fd_close
buffered_file: We can access directly to bandwidth_limit
migration: make migrate_fd_wait_for_unfreeze() return errors
Adjust all callers