summaryrefslogtreecommitdiffstats
path: root/savevm.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* ivshmem: use migration blockers to prevent live migration in peer mode (v2)Anthony Liguori2011-11-211-25/+0
| | | | | | | | | | Now when you try to migrate with ivshmem, you get a proper QMP error: (qemu) migrate tcp:localhost:1025 Migration is disabled when using feature 'peer mode' in device 'ivshmem' (qemu) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* savevm: qemu_fille_buffer() used to return one error for reads of size 0.Juan Quintela2011-11-011-0/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-timer: move more stuff out of qemu-timer.cPaolo Bonzini2011-10-211-0/+25
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge remote-tracking branch 'quintela/migration-pull' into stagingAnthony Liguori2011-10-201-83/+139
|\
| * migration: make *save_live return errorsJuan Quintela2011-10-201-3/+11
| | | | | | | | | | | | | | Make *save_live() return negative values when there is one error, and updates all callers to check for the error. Signed-off-by: Juan Quintela <quintela@redhat.com>
| * migration: use qemu_file_get_error() return value when possibleJuan Quintela2011-10-201-2/+2
| | | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
| * savevm: Rename has_error to last_error fieldJuan Quintela2011-10-201-8/+8
| | | | | | | | | | | | | | Now the field contains the last error name, so rename acordingly. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
| * migration: rename qemu_file_has_error to qemu_file_get_errorJuan Quintela2011-10-201-6/+7
| | | | | | | | | | | | | | Now the function returned errno, so it is better the new name. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
| * migration: return real error codeJuan Quintela2011-10-201-18/+21
| | | | | | | | | | | | | | make functions propagate errno, instead of just using -EIO. Add a comment about what are the return value of qemu_savevm_state_iterate(). Signed-off-by: Juan Quintela <quintela@redhat.com>
| * migration: change has_error to contain errno valuesJuan Quintela2011-10-201-4/+4
| | | | | | | | | | | | We normally already have an errno value. When not, abuse EIO. Signed-off-by: Juan Quintela <quintela@redhat.com>
| * Revert "savevm: fix corruption in vmstate_subsection_load()."Juan Quintela2011-10-201-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit eb60260de0b050a5e8ab725e84d377d0b44c43ae. Conflicts: savevm.c We changed qemu_peek_byte() prototype, just fixed the rejects. Signed-off-by: Juan Quintela<quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
| * savevm: improve subsections detection on loadJuan Quintela2011-10-201-35/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We add qemu_peek_buffer, that is identical to qemu_get_buffer, just that it don't update f->buf_index. We add a paramenter to qemu_peek_byte() to be able to peek more than one byte. Once this is done, to see if we have a subsection we look: - 1st byte is QEMU_VM_SUBSECTION - 2nd byte is a length, and is bigger than section name - 3rd element is a string that starts with section_name So, we shouldn't have false positives (yes, content could still get us wrong but probabilities are really low). v2: - Alex Williamsom found that we could get negative values on index. - Rework code to fix that part. - Rewrite qemu_get_buffer() using qemu_peek_buffer() v3: - return "done" on error case v4: - fix qemu_file_skip() off by one. Signed-off-by: Juan Quintela <quintela@redhat.com>
| * savevm: define qemu_get_byte() using qemu_peek_byte()Juan Quintela2011-10-201-9/+6
| | | | | | | | Signed-off-by: Juan Quintela<quintela@redhat.com>
| * savevm: some coding style cleanupsJuan Quintela2011-10-201-7/+14
| | | | | | | | | | | | | | | | This patch will make moving code on next patches and having checkpatch happy easier. Signed-off-by: Juan Quintela<quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
| * savevm: teach qemu_fill_buffer to do partial refillsJuan Quintela2011-10-201-3/+11
| | | | | | | | | | | | | | | | | | We will need on next patch to be able to lookahead on next patch v2: rename "used" to "pending" (Alex Williams) Signed-off-by: Juan Quintela<quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* | savevm: qemu_savevm_state(): Drop stop VM logicLuiz Capitulino2011-10-191-7/+0
|/ | | | | | | | | | | | | qemu_savevm_state() has some logic to stop the VM and to (or not to) resume it. But this seems to be a big noop, as qemu_savevm_state() is only called by do_savevm() when the VM is already stopped. So, let's drop qemu_savevm_state()'s stop VM logic. Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* RunState: Rename enum values as generated by the QAPILuiz Capitulino2011-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Next commit will convert the query-status command to use the RunState type as generated by the QAPI. In order to "transparently" replace the current enum by the QAPI one, we have to make some changes to some enum values. As the changes are simple renames, I'll do them in one shot. The changes are: - Rename the prefix from RSTATE_ to RUN_STATE_ - RUN_STATE_SAVEVM to RUN_STATE_SAVE_VM - RUN_STATE_IN_MIGRATE to RUN_STATE_INMIGRATE - RUN_STATE_PANICKED to RUN_STATE_INTERNAL_ERROR - RUN_STATE_POST_MIGRATE to RUN_STATE_POSTMIGRATE - RUN_STATE_PRE_LAUNCH to RUN_STATE_PRELAUNCH - RUN_STATE_PRE_MIGRATE to RUN_STATE_PREMIGRATE - RUN_STATE_RESTORE to RUN_STATE_RESTORE_VM - RUN_STATE_PRE_MIGRATE to RUN_STATE_FINISH_MIGRATE Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Drop the vm_running global variableLuiz Capitulino2011-09-151-2/+2
| | | | | | Use runstate_is_running() instead, which is introduced by this commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Replace the VMSTOP macros with a proper state typeLuiz Capitulino2011-09-151-2/+2
| | | | | | | | | | | | | | | Today, when notifying a VM state change with vm_state_notify(), we pass a VMSTOP macro as the 'reason' argument. This is not ideal because the VMSTOP macros tell why qemu stopped and not exactly what the current VM state is. One example to demonstrate this problem is that vm_start() calls vm_state_notify() with reason=0, which turns out to be VMSTOP_USER. This commit fixes that by replacing the VMSTOP macros with a proper state type called RunState. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* savevm: Include writable devices with removable mediaMarkus Armbruster2011-09-061-2/+2
| | | | | | | | | | | | | | | | | | savevm and loadvm silently ignore block devices with removable media, such as floppies and SD cards. Rolling back a VM to a previous checkpoint will *not* roll back writes to block devices with removable media. Moreover, bdrv_is_removable() is a confused mess, and wrong in at least one case: it considers "-drive if=xen,media=cdrom -M xenpv" removable. It'll be cleaned up later in this series. Read-only block devices are also ignored, but that's okay. Fix by ignoring only read-only block devices and empty block devices. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-29/+29
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'kraxel/migration.2' into stagingAnthony Liguori2011-07-291-0/+1
|\
| * vmstate: add no_migrate flag to VMStateDescriptionGerd Hoffmann2011-07-201-0/+1
| | | | | | | | | | | | | | | | This allows to easily tag devices as non-migratable, so any attempt to migrate a virtual machine with the device in question active will make migration fail. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | Wrap recv to avoid warningsBlue Swirl2011-07-251-1/+1
|/ | | | | | | | | | | | | Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o /src/qemu/slirp/ip_icmp.c: In function 'icmp_receive': /src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror] /usr/local/lib/gcc/i686-mingw32msvc/4.6.0/../../../../i686-mingw32msvc/include/winsock2.h:547:32: note: expected 'char *' but argument is of type 'struct icmp *' Remove also casts used to avoid warnings. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Reset system before loadvmJan Kiszka2011-06-161-0/+1
| | | | | | | | | | | | | | | In case we load the vmstate during incoming migration, we start from a clean, default machine state as we went through system reset before. But if we load from a snapshot, the machine can be in any state. That can cause troubles if loading an older image which does not carry all state information the executing QEMU requires. Hardly any device takes care of this scenario. However, fixing this is trivial. We just need to issue a system reset during loadvm as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond2011-06-081-1/+0
| | | | | | | | This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Fix some typos in comments and documentationStefan Weil2011-04-161-1/+1
| | | | | | | | | | | helpfull -> helpful usefull -> useful cotrol -> control and a grammar fix. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud