aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-12-20migration: fix qemu_get_fd for BufferedFilePaolo Bonzini1-1/+1
Not really used, but nice to have it correct. :) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: refactor ram_save_block() return valueJuan Quintela1-10/+15
It could only return 0 if we only found dirty xbzrle pages that hadn't changed (i.e. they were written with the same content). We don't care about that case, it is the same than nothing dirty. So now the return of the function is how much have it written, nothing else. Adjust callers. And we also made ram_save_iterate() return the number of transferred bytes, not the number of transferred pages. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: account the amount of transferred ram betterJuan Quintela1-14/+20
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: optimize migration bitmap walkingJuan Quintela1-19/+26
Instead of testing each page individually, we search what is the next dirty page with a bitmap operation. We have to reorganize the code to move from a "for" loop, to a while(dirty) loop. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: Use memory_region_test_and_clear_dirtyJuan Quintela1-4/+3
This avoids having to do two walks over the dirty bitmap, once reading the dirty bits, and anthoer cleaning them. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20memory: introduce memory_region_test_and_clear_dirtyJuan Quintela2-0/+32
This function avoids having to do two calls, one to test the dirty bit, and other to reset it. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: Add last_sent_blockJuan Quintela1-1/+5
This is the last block from where we have sent data. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20ram: rename last_block to last_seen_blockJuan Quintela1-6/+10
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration notifierJuan Quintela1-2/+1
At this point, it is waranteed that state is ACTIVE. Old position didn't assured hat. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: Inline qemu_fopen_ops_buffered into migrate_fd_connectJuan Quintela2-10/+3
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration_fd_put_ready()Juan Quintela2-66/+65
Put it near its use and un-export it. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: add XFER_LIMIT_RATIOJuan Quintela1-4/+6
The "magic" divisions by 10 are there because of the value of BUFFER_DELAY. Introduce a constant to explain them better. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move buffered_file.c code into migration.cJuan Quintela5-282/+235
This only moves the code (also from buffered_file.h to migration.h). Fix whitespace until checkpatch is happy. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20savevm: New save live migration method: pendingJuan Quintela8-84/+83
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 knows that remaining memory to sent takes less than max downtime. But this means that we could end spending 2x max_downtime, one downtime in qemu_savevm_iterate, and the other in qemu_savevm_state_complete. Changed code to: pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size >= max_size) { ret = qemu_savevm_state_iterate(s->file); } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); } So what we do is: at current network speed, we calculate the maximum number of bytes we can sent: max_size. Then we ask every save_live section how much they have pending. If they are less than max_size, we move to complete phase, otherwise we do an iterate one. This makes things much simpler, because now individual sections don't have to caluclate the bandwidth (it was implossible to do right from there). Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20buffered_file: unfold buffered_append in buffered_put_bufferJuan Quintela1-19/+14
It was the only user, and now buffered_put_buffer just do the append Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20buffered_file: don't flush on put bufferJuan Quintela1-6/+0
We call buffered_put_buffer with iothread held, and buffered_flush() does synchronous writes. We only want to do the synchronous writes outside. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20buffered_file: Unfold the trick to restart generating migration dataJuan Quintela1-9/+10
This was needed before due to the way that the callbacks worked. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20migration: just lock migrate_fd_put_readyJuan Quintela2-2/+5
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: remove unfreeze logicJuan Quintela3-47/+1
Now that we have a thread, and blocking writes, we don't need it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-20migration: make writes blockingJuan Quintela7-29/+2
Move all the writes to the migration_thread, and make writings blocking. Notice that are still using the iothread for everything that we do. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: move migration thread init code to migrate_fd_put_readyJuan Quintela2-12/+18
This way everything related with migration is run on the migration thread and no locking is needed. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: make qemu_fopen_ops_buffered() return voidJuan Quintela4-9/+9
We want the file assignment to happen before the thread is created to avoid locking, so we just do it before creating the thread. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-12-20buffered_file: Move from using a timer to use a threadJuan Quintela1-22/+36
We still protect everything except the wait with the iothread lock. But we moved from a timer to a thread. Steps one by one. We also need to detect when we have finished with a variable "complete". Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20protect the ramlist with a separate mutexUmesh Deshpande3-3/+44
Add the new mutex that protects shared state between ram_save_live and the iothread. If the iothread mutex has to be taken together with the ramlist mutex, the iothread shall always be _outside_. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-12-20add a version number to ram_listUmesh Deshpande3-1/+11
This will be used to detect if last_block might have become invalid across different calls to ram_save_live. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-12-20exec: sort the memory from biggest to smallestPaolo Bonzini2-32/+12
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20exec: change RAM list to a TAILQPaolo Bonzini6-38/+38
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20exec: change ramlist from MRU order to a 1-item cachePaolo Bonzini3-21/+30
Most of the time, only 2 items will be active (from/to for a string operation, or code/data). But TCG guests likely won't have gigabytes of memory, so this actually goes down to 1 item. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration-fd: remove duplicate includeJuan Quintela1-1/+0
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: include qemu-file.hJuan Quintela4-4/+4
They don't use/know anything about buffered-file. Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: remove double call to migrate_fd_closePaolo Bonzini1-1/+1
The call in buffered_close is enough, because buffered_close is called already by migrate_fd_cleanup. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20buffered_file: do not send more than s->bytes_xfer bytes per tickPaolo Bonzini1-2/+2
Sending more was possible if the buffer was large. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-20migration: fix migration_bitmap leakPaolo Bonzini1-6/+7
Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-12-19Merge remote-tracking branch 'bonzini/header-dirs' into stagingAnthony Liguori1124-3428/+3155
* bonzini/header-dirs: (45 commits) janitor: move remaining public headers to include/ hw: move executable format header files to hw/ fpu: move public header file to include/fpu softmmu: move remaining include files to include/ subdirectories softmmu: move include files to include/sysemu/ misc: move include files to include/qemu/ qom: move include files to include/qom/ migration: move include files to include/migration/ monitor: move include files to include/monitor/ exec: move include files to include/exec/ block: move include files to include/block/ qapi: move include files to include/qobject/ janitor: add guards to headers qapi: make struct Visitor opaque qapi: remove qapi/qapi-types-core.h qapi: move inclusions of qemu-common.h from headers to .c files ui: move files to ui/ and include/ui/ qemu-ga: move qemu-ga files to qga/ net: reorganize headers net: move net.c to net/ ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-19janitor: move remaining public headers to include/Paolo Bonzini4-0/+0
Headers in the root directory are now used only from within that directory. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19hw: move executable format header files to hw/Paolo Bonzini2-430/+0
Or delete a.out.h which is unused. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19fpu: move public header file to include/fpuPaolo Bonzini26-27/+25
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini61-61/+61
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini296-421/+421
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini496-673/+673
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qom: move include files to include/qom/Paolo Bonzini27-28/+28
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19migration: move include files to include/migration/Paolo Bonzini32-33/+33
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini84-87/+87
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19exec: move include files to include/exec/Paolo Bonzini277-456/+456
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19block: move include files to include/block/Paolo Bonzini109-134/+134
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move include files to include/qobject/Paolo Bonzini119-241/+241
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19janitor: add guards to headersPaolo Bonzini50-0/+219
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: make struct Visitor opaquePaolo Bonzini2-40/+40
Move its definition from qapi-visit-core.h to qapi-visit-impl.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: remove qapi/qapi-types-core.hPaolo Bonzini10-22/+10
The file is only including error.h and qerror.h. Prefer explicit inclusion of whatever files are needed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move inclusions of qemu-common.h from headers to .c filesPaolo Bonzini13-1/+14
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>