Add the parameter 'order' to qemu_register_reset and sort callbacks on
registration. On system reset, callbacks with lower order will be
invoked before those with higher order. Update all existing users to the
standard order 0.
Note: At least for x86, the existing users seem to assume that handlers
are called in their registration order. Therefore, the patch preserves
this property. If someone feels bored, (s)he could try to identify this
dependency and express it properly on callback registration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
kvm_physical_sync_dirty_bitmap() takes the end address as second
argument, not the region size. Moverover, the kvm API should not be used
directly here, but cpu_physical_sync_dirty_bitmap().
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch adds the missing hooks to allow live migration in KVM mode.
It adds proper synchronization before/after saving/restoring the VCPU
states (note: PPC is untested), hooks into
cpu_physical_memory_set_dirty_tracking() to enable dirty memory logging
at KVM level, and synchronizes that drity log into QEMU's view before
running ram_live_save().
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Extend kvm_physical_sync_dirty_bitmap() so that is can sync across
multiple slots. Useful for updating the whole dirty log during
migration. Moreover, properly pass down errors the whole call chain.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
The buffer passed to KVM_GET_DIRTY_LOG requires one bit per page. Fix
the size calculation in kvm_physical_sync_dirty_bitmap accordingly,
avoiding allocation of extremly oversized buffers.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Introduce a global dirty logging flag that enforces logging for all
slots. This can be used by the live migration code to enable/disable
global logging withouth destroying the per-slot setting.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Only apply the workaround for broken slot joining in KVM when the
capability was not found that signals the corresponding fix existence.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add an option to specify the cluster size of a newly created qcow2 image.
Default is 4k which is the same value that was hard-coded before.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This is part two of the qemu-img conversion. This really works the same as the
previous conversion of qemu-img create: It introduces a new -o option for the
generic approach and adds the old-style options to this option set.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch changes qemu-img to actually use the new bdrv_create interface. It
translates the old-style qemu-img options which have been bdrv_create2
parameters or flags so far to option structures. As the generic approach, it
introduces an -o option which accepts any parameter the driver knows.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Now we can make use of the newly introduced option structures. Instead of
having bdrv_create carry more and more parameters (which are format specific in
most cases), just pass a option structure as defined by the driver itself.
bdrv_create2() contains an emulation of the old interface to simplify the
transition.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch creates a new header file and the corresponding implementation file
for parsing of parameter strings for options (like used in -drive). Part of
this is code moved from vl.c (so qemu-img can use it later).
The idea is to have a data structure describing all accepted parameters. When
parsing a parameter string, the structure is copied and filled with the
parameter values.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch allow us to call migrate_set_speed on running
migrations. This should allow mgmt tools to increase the allocated
bandwidth of a running migration if there is no progress, and they
really want the migration to succeed.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch converts the current callers of qemu_fopen_ops().
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This patch augments info migrate output with status about:
* ram bytes remaining
* ram bytes transferred
* ram bytes total
This should be enough for management tools to realize
whether or not there is progress in migration. We can
add more information later on, if the need arrives
[v2: fixes bytes_transferred type]
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
From Paul Brook:
"the fdc is tied to the ISA DMA engine. We don't currently have a target
independent method of handling inter-device data transfer."
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This reverts commit ec6bd8dea7.
This broke any target that uses virtio. Virtio devices live in libhw and
without whole-archive, the constructors will never be called for virtio.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
f80f9ec changed the order that machines are registered which had the effect of
changing the default machine. This changeset introduces a new is_default field
so that machine types can declare that they are the default for an architecture.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
My previous commit, f92f8afebe, broke -vnc (spotted by Glauber Costa). This
is because it's necessary to tell when the no special display parameters have
been passed and default to SDL or VNC appropriately.
This refactors the display selection logic to be less complicated which has
the effect of fixing the regression mentioned above.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
--disable-gfx-check predates VNC server support. It made sense back then
because the only thing you could do without SDL was use -nographic mode or
similar tricks. Since this is a very advanced mode of operation, gfx-check
provided a good safety net for casual users.
A casual user is very likely to use VNC to interact with a guest. In fact, it's
often frustrating to install QEMU on a server and have to specify
disable-gfx-check when you only want to use VNC.
This patch eliminates disable-gfx-check and makes SDL behave like every other
optional dependency. If SDL is not available, instead of failing ungracefully
if no special options are specified, we default to -vnc localhost:0,to=99.
When we do default to VNC, we also print a message to tell the user that we've
done this include which port we're currently listening on.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
When qemu is run under valgrind, valgrind shows the following output
on exit:
==3648== 1 errors in context 2 of 2:
==3648== Syscall param timer_create(evp) points to uninitialised byte(s)
==3648== at 0x54E936A: timer_create (in /lib/librt-2.9.so)
==3648== by 0x405DCF: dynticks_start_timer (vl.c:1549)
==3648== by 0x40A966: main (vl.c:1726)
==3648== Address 0x7fefffb34 is on thread 1's stack
==3648== Uninitialised value was created by a stack allocation
==3648== at 0x405D60: dynticks_start_timer (vl.c:1534)
This patch is a simple fix to remove this potential problem.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
This fixes a SIGSEGV error on qemu exit.
Here is the valgrind output related to this error
==3648== Process terminating with default action of signal 11 (SIGSEGV)
==3648== Access not within mapped region at address 0x8
==3648== at 0x40636B: host_alarm_handler (vl.c:1345)
==3648== by 0x52D807F: (within /lib/libpthread-2.9.so)
==3648== by 0x5C0A12E: tcsetattr (in /lib/libc-2.9.so)
==3648== by 0x4DD601: term_exit (qemu-char.c:700)
==3648== by 0x5B636EC: exit (in /lib/libc-2.9.so)
==3648== by 0x5B4B5AC: (below main) (in /lib/libc-2.9.so)
This simple fix check for a valid pointer as host_alarm_handler is
also called after alarm_timer is released in the exit path.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
initrd must be kept on the memory area below 4g. By not doing this,
we're seeing guests break while using -initrd and values of -mem
superior to 4096.
Signed-off-by: Glauber Costa <glommer@redhat.com>
The migration code is non-blocking, designed for live migration.
Practically migrate_fd_put_buffer busy-loops trying to write, as
on many machines EWOULDBLOCK==EAGAIN (look in include/asm-generic/errno.h).
Signed-off-by: Uri Lublin <uril@redhat.com>
KVM_GET_SUPPORTED_CPUID has been known to fail to return -E2BIG
when it runs out of entries. Detect this by always trying again
with a bigger table if the ioctl() fills the table.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This text is no longer accurate. After the patch is applied, the
generated version at http://www.nongnu.org/qemu/qemu-doc.html should be
regenerated.
This patch is also a candidate for the stable branch. (The URL above is
probably generated from the stable branch anyways, so maybe it goes
without saying.)
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
The only target dependency for most hardware is sizeof(target_phys_addr_t).
Build these files into a convenience library, and use that instead of
building for every target.
Remove and poison various target specific macros to avoid bogus target
dependencies creeping back in.
Big/Little endian is not handled because devices should not know or care
about this to start with.
Signed-off-by: Paul Brook <paul@codesourcery.com>
If the target only has a 32-bit physical address space then
the code to map >4G ram breaks horribly, and causes compiler warnings.
Signed-off-by: Paul Brook <paul@codesourcery.com>