summaryrefslogtreecommitdiffstats
path: root/savevm.c
Commit message (Collapse)AuthorAgeFilesLines
* migration: handle EAGAIN while reading QEMUFilePaolo Bonzini2012-11-021-6/+24
| | | | | | | | | | | | | This will never happen right now (the assertion would fail). The next patch will set the socket or pipe in non-blocking mode, thus enabling this part of the code. Coroutines can just stop whenever they want with qemu_coroutine_yield. As soon as select tells the main loop that the migration stream is readable, the coroutine is re-entered directly in qemu_get_buffer, where it will read more data and pass it to the loading routines. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: close socket QEMUFile from socket_closePaolo Bonzini2012-11-021-0/+1
| | | | | | | The common suffix now is process_incoming_migration+qemu_fclose. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: replace qemu_stdio_fd with qemu_get_fdPaolo Bonzini2012-11-021-11/+0
| | | | | Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: add qemu_get_fdPaolo Bonzini2012-11-021-0/+27
| | | | | Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: consolidate QEMUFile methods in a single QEMUFileOps structPaolo Bonzini2012-11-021-48/+60
| | | | | Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: unify stdio-based QEMUFile operationsPaolo Bonzini2012-11-021-17/+2
| | | | | | | | | | Now that qemu_fseek does not exist anymore, there is no reason to do an fseek before fread/fwrite when operating on an stdio file. Thus, unify the get/put_buffer callbacks used by qemu_fopen with those used for pipes. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vmstate: Add support for saving/loading bitmapsPeter Maydell2012-10-301-0/+41
| | | | | | | | Add support for saving/loading bitmap.h bitmaps in vmstate. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Igor Mitsyanko <i.mitsyanko@samsung.com> Reviewed-by: Juan Quintela <quintela@redhat.com>
* savevm: make qemu_file_put_notify() return errorsJuan Quintela2012-10-171-2/+2
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: un-export qemu_file_set_error()Juan Quintela2012-10-171-1/+1
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: Only qemu_fflush() can generate errorsJuan Quintela2012-10-171-17/+18
| | | | | | | | | Move the error check to the beggining of the callers. Once this is fixed qemu_file_set_if_error() is not used anymore, so remove it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: make qemu_fill_buffer() be consistentJuan Quintela2012-10-171-1/+1
| | | | | | | | It was setting last_error directly once, and with the helper the other time. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: unexport qemu_ftell()Juan Quintela2012-10-171-1/+1
| | | | | | It was unused out of savevm.c. Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: unfold qemu_fclose_internal()Juan Quintela2012-10-171-20/+6
| | | | | | | | | It was used only one, and was only one if. It makes error handling saner. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: make qemu_fflush() return an error codeJuan Quintela2012-10-171-16/+23
| | | | | | | | | Adjust all the callers. We moved the set of last_error from inside qemu_fflush() to all the callers. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: Remove qemu_fseek()Juan Quintela2012-10-171-21/+0
| | | | | | | | It has no users, and is only half implemented. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* savevm: unexport qemu_fflushJuan Quintela2012-10-171-1/+1
| | | | | | | | It is not used outside of savevm.c Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* cleanup useless return sentenceAmos Kong2012-10-051-1/+0
| | | | | | | | This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* Merge remote-tracking branch 'agraf/ppc-for-upstream' into stagingAnthony Liguori2012-08-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agraf/ppc-for-upstream: (24 commits) openpic: Added BRR1 register pseries: Update SLOF firmware image pseries dma: DMA window params added to PHB and DT population changed pseries: Add PCI MSI/MSI-X support pseries: Add trace event for PCI irqs pseries: Export find_phb() utility function for PCI code pseries: added allocator for a block of IRQs pseries: Separate PCI RTAS setup from common from emulation specific PCI setup pseries: Rework irq assignment to avoid carrying qemu_irqs around pseries: Remove extraneous prints pseries: Update SLOF PPC: spapr: Remove global variable PPC: spapr: Rework VGA select logic xbzrle: fix compilation on ppc32 spapr: Add support for -vga option Add one new file vga-pci.h and cleanup on all platforms Revert "PPC: e500: Use new MPIC dt format" ppc: Fix bug in handling of PAPR hypercall exits PPC: e500: add generic e500 platform PPC: e500: split mpc8544ds machine from generic e500 code ...
| * xbzrle: fix compilation on ppc32Alexander Graf2012-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When compiling the xbzrle code on my ppc32 user space, I hit the following gcc compiler warning (treated as an error): cc1: warnings being treated as errors savevm.c: In function ‘xbzrle_encode_buffer’: savevm.c:2476: error: overflow in implicit constant conversion Fix this by making the cast explicit, rather than implicit. Signed-off-by: Alexander Graf <agraf@suse.de>
* | block: Convert close calls to qemu_closeCorey Bryant2012-08-151-2/+2
|/ | | | | | | | This patch converts all block layer close calls, that correspond to qemu_open calls, to qemu_close. Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Add xbzrle_encode_buffer and xbzrle_decode_buffer functionsOrit Wasserman2012-08-081-0/+159
| | | | | | | | | | | | | | | | For performance we are encoding long word at a time. For nzrun we use long-word-at-a-time NULL-detection tricks from strcmp(): using ((lword - 0x0101010101010101) & (~lword) & 0x8080808080808080) test to find out if any byte in the long word is zero. Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* savevm: split save_live into stage2 and stage3Juan Quintela2012-07-201-5/+5
| | | | | | | | We split it into 2 functions, foo_live_iterate, and foo_live_complete. At this point, we only remove the bits that are for the other stage, functionally this is equivalent to previous code. Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: split save_live_setup from save_live_stateJuan Quintela2012-07-201-2/+2
| | | | | | | | This patch splits stage 1 to its own function for both save_live users, ram and block. It is just a copy of the function, removing the parts of the other stages. Optimizations would came later. Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: introduce is_active methodJuan Quintela2012-07-201-0/+15
| | | | | | | | | Enable the creation of a method to tell migration if that section is active and should be migrate. We use it for blk-migration, that is normally not active. We don't create the method for RAM, as setups without RAM are very strange O:-) Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: Refactor cancel operation in its own operationJuan Quintela2012-07-201-2/+2
| | | | | | Intead of abusing stage with value -1. Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: Live migration handlers register the struct directlyJuan Quintela2012-07-201-11/+7
| | | | | | | Notice that the live migration users never unregister, so no problem about freeing the ops structure. Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: Use a struct to pass all handlersJuan Quintela2012-07-201-29/+25
| | | | | | This would make easier to add more operations in the next patches. Signed-off-by: Juan Quintela <quintela@redhat.com>
* No need to iterate if we already are over the limitJuan Quintela2012-06-291-0/+3
| | | | | | If buffers are full, don't iterate, just exit. Signed-off-by: Juan Quintela <quintela@redhat.com>
* Add tracepoints for savevm section start/endJuan Quintela2012-06-291-0/+8
| | | | | | | | | | | | | | | | | | | This allows to know how long each section takes to save. An awk script like this tells us sections that takes more that 10ms $1 ~ /savevm_state_iterate_end/ { /* Print savevm_section_end line when > 10ms duration */ if ($2 > 10000) { printf("%s times_missing=%u\n", $0, times_missing++); } } Signed-off-by: Juan Quintela <quintela@redhat.com> fix ws tracepoints Signed-off-by: Juan Quintela <quintela@redhat.com>
* Add MigrationParams structureIsaku Yamahata2012-06-291-4/+9
| | | | Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
* Merge remote-tracking branch 'afaerber-or/qom-next-2' into stagingAnthony Liguori2012-06-181-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * afaerber-or/qom-next-2: (22 commits) qom: Push error reporting to object_property_find() qdev: Remove qdev_prop_exists() qbus: Initialize in standard way qbus: Make child devices links qdev: Connect busses with their parent devices qdev: Convert busses to QEMU Object Model qdev: Move SysBus initialization to sysbus.c qdev: Use wrapper for qdev_get_path qdev: Remove qdev_prop_set_defaults qdev: Clean up global properties qdev: Move bus properties to abstract superclasses qdev: Move bus properties to a separate global qdev: Push "type" property up to Object arm_l2x0: Rename "type" property to "cache-type" m48t59: Rename "type" property to "model" qom: Assert that public types have a non-NULL parent field qom: Drop type_register_static_alias() macro qom: Make Object a type qom: Add class_base_init qom: Add object_child_foreach() ...
| * qdev: Use wrapper for qdev_get_pathAnthony Liguori2012-06-181-6/+6
| | | | | | | | | | | | | | | | | | This makes it easier to remove it from BusInfo. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()] Signed-off-by: Andreas Färber <afaerber@suse.de>
* | savevm: flush after saving vm statePaolo Bonzini2012-06-151-1/+1
|/ | | | | | | | | Writing vm state uses bdrv_pwrite, so it will automatically get flushes in writethrough mode. But doing a flush at the end in writeback mode is probably a good idea anyway. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* w64: Fix time conversion for some versions of MinGW-w64Stefan Weil2012-04-151-1/+2
| | | | | | | | | tb.time is a time value, but not necessarily of the same size as time_t: while time_t is 64 bit for w64, tb.time still is 32 bit only. Therefore we need en explicit conversion. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Merge remote-tracking branch 'sstabellini/saverestore-8' into stagingAnthony Liguori2012-03-191-0/+71
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sstabellini/saverestore-8: xen: do not allocate RAM during INMIGRATE runstate xen mapcache: check if memory region has moved. xen: record physmap changes to xenstore Set runstate to INMIGRATE earlier Introduce "xen-save-devices-state" cirrus_vga: do not reset videoram Conflicts: qapi-schema.json Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * Introduce "xen-save-devices-state"Stefano Stabellini2012-03-191-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add an "is_ram" flag to SaveStateEntry; - register_savevm_live sets is_ram for live_savevm devices; - introduce a "xen-save-devices-state" QAPI command that can be used to save the state of all devices, but not the RAM or the block devices of the VM. Changes in v8: - rename save-devices-state to xen-save-devices-state. Changes in v7: - rename save_devices to save-devices-state. Changes in v6: - remove the is_ram parameter from register_savevm_live and sets is_ram if the device is a live_savevm device; - introduce save_devices as a QAPI command, write a better description for it; - fix CODING_STYLE; - introduce a new doc to explain the save format used by save_devices. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
* | Merge remote-tracking branch 'qemu-kvm/memory/urgent' into stagingAnthony Liguori2012-03-191-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qemu-kvm/memory/urgent: (42 commits) memory: check for watchpoints when getting code ram_addr exec: fix write tlb entry misused as iotlb Sparc: avoid AREG0 wrappers for memory access helpers Sparc: avoid AREG0 for memory access helpers TCG: add 5 arg helpers to def-helper.h softmmu templates: optionally pass CPUState to memory access functions i386: Remove REGPARM sparc64: implement PCI and ISA irqs sparc: reset CPU state on reset apb: use normal PCI device header for PBM device w64: Fix data type of next_tb and tcg_qemu_tb_exec softfloat: fix for C99 vmstate: fix varrays with uint32_t indexes Fix large memory chunks allocation with tcg_malloc. hw/pxa2xx.c: Fix handling of pxa2xx_i2c variable offset within region hw/pxa2xx_lcd.c: drop target_phys_addr_t usage in device state hw/pxa2xx_dma.c: drop target_phys_addr_t usage in device state ARM: Remove unnecessary subpage workarounds malta: Fix display for LED array malta: Use symbolic hardware addresses ...
| * | vmstate: fix varrays with uint32_t indexesAmos Kong2012-03-171-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(), but we don't check this bit in vmstate_save_state(). Signed-off-by: Amos Kong <akong@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | qapi: Convert migrateLuiz Capitulino2012-03-151-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The migrate command is one of those commands where HMP and QMP completely mix up together. This made the conversion to the QAPI (which separates the command into QMP and HMP parts) a bit difficult. The first important change to be noticed is that this commit completes the removal of the Monitor object from migration code, started by the previous commit. Another important and tricky change is about supporting the non-detached mode. That is, if the user doesn't pass '-d' the migrate command will lock the monitor and will only release it when migration is finished. To support this in the new HMP command (hmp_migrate()), it is necessary to create a timer which runs every second and checks if the migration is still active. If it is, the timer callback will re-schedule itself to run one second in the future. If the migration has already finished, the monitor lock is released and the user can use it normally. All these changes should be transparent to the user. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* | Purge migration of (almost) everything to do with monitorsLuiz Capitulino2012-03-151-15/+14
|/ | | | | | | | | | | | | | | | | The Monitor object is passed back and forth within the migration/savevm code so that it can print errors and progress to the user. However, that approach assumes a HMP monitor, being completely invalid in QMP. This commit drops almost every single usage of the Monitor object, all monitor_printf() calls have been converted into DPRINTF() ones. There are a few remaining Monitor objects, those are going to be dropped by the next commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Fix vmstate_register_ram() for rom/device regionsAvi Kivity2012-01-081-1/+1
| | | | | | | | | rom/device regions have a ram_addr that is composed of both an I/O handler (low bits) and RAM region (high bits); but qemu_ram_set_idstr() expects just a RAM region. Mask the I/O handler to make it happy. Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Avi Kivity <avi@redhat.com>
* vmstate, memory: decouple vmstate from memory APIAvi Kivity2012-01-041-0/+17
| | | | | | | | | | | | | | Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
* qcow2: Allow >4 GB VM stateKevin Wolf2011-12-151-1/+1
| | | | | | | This is a compatible extension to the snapshot header format that allows saving a 64 bit VM state size. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* stdio_fclose: return -errno on errors (v2)Eduardo Habkost2011-12-121-2/+5
| | | | | | | | | | This is what qemu_fclose() expects. Changes v1 -> v2: - Add braces to if statement to match coding style Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* stdio_pclose: return -errno on error (v3)Eduardo Habkost2011-12-121-0/+3
| | | | | | | | | | | | | This is what qemu_fclose() expects. Changes v1 -> v2: - On success, keep returning pclose() return value, instead of always 0. Changes v2 -> v3: - Add braces on if statements to match coding style Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu_fclose: return last_error if set (v3)Eduardo Habkost2011-12-121-3/+48
| | | | | | | | | | | | | | | | | | | | | | | | | This will make sure no error will be missed as long as callers always check for qemu_fclose() return value. For reference, this is the complete list of qemu_fclose() callers: - exec_close(): already fixed to check for negative values, not -1 - migrate_fd_cleanup(): already fixed to consider only negative values as error, not any non-zero value - exec_accept_incoming_migration(): no return value check (yet) - fd_accept_incoming_migration(): no return value check (yet) - tcp_accept_incoming_migration(): no return value check (yet) - unix_accept_incoming_migration(): no return value check (yet) - do_savevm(): no return value check (yet) - load_vmstate(): no return value check (yet) Changes v1 -> v2: - Add small comment about the need to return previously-spotted errors Changes v2 -> v3: - Add braces to "if" statements to match coding style Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: use qemu_file_set_error() instead of setting last_error directlyEduardo Habkost2011-12-121-2/+2
| | | | | | | | Some code uses qemu_file_set_error() already, so use it everywhere when setting last_error, for consistency. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori2011-12-051-1/+1
|\
| * block: convert qemu_aio_flush() calls to bdrv_drain_all()Stefan Hajnoczi2011-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Many places in QEMU call qemu_aio_flush() to complete all pending asynchronous I/O. Most of these places actually want to drain all block requests but there is no block layer API to do so. This patch introduces the bdrv_drain_all() API to wait for requests across all BlockDriverStates to complete. As a bonus we perform checks after qemu_aio_wait() to ensure that requests really have finished. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | fix spelling in main directoryDong Xu Wang2011-12-021-1/+1
|/ | | | | Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud