qemu.git
8 years agoblock: Allow recursive "file"s
Max Reitz [Fri, 20 Dec 2013 18:28:13 +0000 (19:28 +0100)] 
block: Allow recursive "file"s

It should be possible to use a format as a driver for a file which in
turn requires another file, i.e., nesting file formats.

Allowing nested file formats results in e.g. qcow2 BlockDriverStates
never being directly passed to bdrv_open_common() from bdrv_file_open(),
but instead being handed through bdrv_open(). This changes the error
message when trying to give a filename to qcow2, i.e. trying to use it
as a driver for the protocol level. Therefore, change the reference
output of I/O test 051 accordingly.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Use bdrv_open_image() in bdrv_open()
Max Reitz [Fri, 20 Dec 2013 18:28:12 +0000 (19:28 +0100)] 
block: Use bdrv_open_image() in bdrv_open()

Using bdrv_open_image() instead of bdrv_file_open() directly in
bdrv_open() is easier.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Add bdrv_open_image()
Max Reitz [Fri, 20 Dec 2013 18:28:11 +0000 (19:28 +0100)] 
block: Add bdrv_open_image()

Add a common function for opening images to be used for block drivers
specified through BlockdevRefs in an option QDict. The difference from
bdrv_file_open() is that this function may invoke bdrv_open() instead,
allowing auto-detection of the driver to be used; and second, it
automatically extracts the BlockdevRef from the option QDict.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Allow block devices without files
Max Reitz [Fri, 20 Dec 2013 18:28:10 +0000 (19:28 +0100)] 
block: Allow block devices without files

blkdebug and blkverify will, in order to retain compatibility, not
support the field "file" implicitly through bdrv_open(). In order to be
able to use those drivers without giving a filename anyway, it is
necessary to be able to have block devices without files implicitly
opened by bdrv_open(). This is the case, if there was neither a file
name, a reference to an existing block device to use as a file nor
options specific to the file.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Pass reference to bdrv_file_open()
Max Reitz [Fri, 20 Dec 2013 18:28:09 +0000 (19:28 +0100)] 
block: Pass reference to bdrv_file_open()

With that now being possible, bdrv_open() should try to extract a block
device reference from the options and pass it to bdrv_file_open().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Allow reference for bdrv_file_open()
Max Reitz [Fri, 20 Dec 2013 18:28:08 +0000 (19:28 +0100)] 
block: Allow reference for bdrv_file_open()

Allow specifying a reference to an existing block device (by name) for
bdrv_file_open() instead of a filename and/or options.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkdebug: Use command-line in read_config()
Max Reitz [Fri, 20 Dec 2013 18:28:07 +0000 (19:28 +0100)] 
blkdebug: Use command-line in read_config()

Use qemu_config_parse_qdict() to parse the command-line options in
addition to the config file.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkdebug: Always call read_config()
Max Reitz [Fri, 20 Dec 2013 18:28:06 +0000 (19:28 +0100)] 
blkdebug: Always call read_config()

Move the check whether there actually is a config file into the
read_config() function.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-option: Add qemu_config_parse_qdict()
Max Reitz [Fri, 20 Dec 2013 18:28:05 +0000 (19:28 +0100)] 
qemu-option: Add qemu_config_parse_qdict()

This function basically parses command-line options given as a QDict
replacing a config file.

For instance, the QDict {"section.opt1": 42, "section.opt2": 23}
corresponds to the config file:

[section]
opt1 = 42
opt2 = 23

It is possible to specify multiple sections and also multiple sections
of the same type. On the command line, this looks like the following:

inject-error.0.event=reftable_load,\
inject-error.1.event=l2_load,\
set-state.event=l1_update

This would correspond to the following config file:

[inject-error "inject-error.0"]
event = reftable_load

[inject-error "inject-error.1"]
event = l2_load

[set-state]
event = l1_update

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqapi: extend qdict_flatten() for QLists
Max Reitz [Fri, 20 Dec 2013 18:28:04 +0000 (19:28 +0100)] 
qapi: extend qdict_flatten() for QLists

Reversing qdict_array_split(), qdict_flatten() should flatten QLists as
well by interpreting them as QDicts where every entry's key is its
index.

This allows bringing QDicts with QLists from QMP commands to the same
form as they would be given as command-line options, thereby allowing
them to be parsed the same way.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqdict: Add qdict_array_split()
Max Reitz [Fri, 20 Dec 2013 18:28:03 +0000 (19:28 +0100)] 
qdict: Add qdict_array_split()

This function splits a QDict consisting of entries prefixed by
incrementally enumerated indices into a QList of QDicts.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkdebug: Don't require sophisticated filename
Max Reitz [Fri, 20 Dec 2013 18:28:02 +0000 (19:28 +0100)] 
blkdebug: Don't require sophisticated filename

If the filename is not prefixed by "blkdebug:" in
blkdebug_parse_filename(), the blkdebug driver was not selected through
that protocol prefix, but by an explicit command line option
(file.driver=blkdebug or something similar). Contrary to the current
reaction, this is not a problem at all; we just need to store the
filename (in the x-image option) and can go on; the user just has to
manually specify the config option.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkdebug: Use errp for read_config()
Max Reitz [Fri, 20 Dec 2013 18:28:01 +0000 (19:28 +0100)] 
blkdebug: Use errp for read_config()

Use an Error variable in the read_config() function.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-io: add command completion
Stefan Hajnoczi [Thu, 14 Nov 2013 10:54:18 +0000 (11:54 +0100)] 
qemu-io: add command completion

Autocomplete qemu-io commands at the interactive prompt.

Note this only completes command names and not their options.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-io: use readline.c
Stefan Hajnoczi [Thu, 14 Nov 2013 10:54:17 +0000 (11:54 +0100)] 
qemu-io: use readline.c

Use readline.c for command-line history.  There was support for GNU
Readline and BSD Editline but it was never compiled in.  Since QEMU has
its own readline.c, just use that when qemu-io runs with stdin attached
to a terminal.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoosdep: add qemu_set_tty_echo()
Stefan Hajnoczi [Thu, 14 Nov 2013 10:54:16 +0000 (11:54 +0100)] 
osdep: add qemu_set_tty_echo()

Using stdin with readline.c requires disabling echo and line buffering.
Add a portable wrapper to set the terminal attributes under Linux and
Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoreadline: move readline to a generic location
Stefan Hajnoczi [Thu, 14 Nov 2013 10:54:15 +0000 (11:54 +0100)] 
readline: move readline to a generic location

Now that the monitor and readline are decoupled, readline.h no longer
belongs in include/monitor/.  Put the header into include/qemu/.

Move the source file into util/ so it can be linked as part of
libqemuutil.a.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoreadline: decouple readline from the monitor
Stefan Hajnoczi [Thu, 14 Nov 2013 10:54:14 +0000 (11:54 +0100)] 
readline: decouple readline from the monitor

Make the readline.c functionality reusable.  Instead of calling
monitor_printf() and monitor_flush() directly, invoke function pointers
provided by the user.

This way readline.c does not know about Monitor and other users will be
able to make use of readline.c.

Note that there is already an "opaque" argument to the ReadLineFunc
callback.  Consistently call it "readline_opaque" from now on to
distinguish from the ReadLinePrintfFunc/ReadLineFlushFunc "opaque"
argument.

I also dropped the printf macro trickery since it's now highly unlikely
that anyone modifying readline.c would call printf(3) directly.  We no
longer need this protection.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agovmdk: Fix big flat extent IO
Fam Zheng [Wed, 8 Jan 2014 01:42:07 +0000 (09:42 +0800)] 
vmdk: Fix big flat extent IO

Local variable "n" as int64_t avoids overflow with large sector number
calculation. See test case change for failure case.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agodocs: qcow2 compat=1.1 is now the default
Stefan Hajnoczi [Mon, 6 Jan 2014 04:39:01 +0000 (12:39 +0800)] 
docs: qcow2 compat=1.1 is now the default

Commit 9117b47717ad208b12786ce88eacb013f9b3dd1c ("qcow2: Change default
for new images to compat=1.1") changed the default qcow2 image format
version but forgot to update qemu-doc.texi and qemu-img.texi.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqtest: Fix the bug about disable vnc causes "make check" fail
Kewei Yu [Mon, 6 Jan 2014 06:05:24 +0000 (14:05 +0800)] 
qtest: Fix the bug about disable vnc causes "make check" fail

When we disable vnc from "./configure", QEMU can't use the vnc option.
So qtest can't use the "vnc -none ", otherwise "make check" fails.
If QEMU uses "-display none", "-vnc none" is excrescent, So we just need to drop it.

Signed-off-by: Kewei Yu <keweihk@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agosheepdog: fix clone operation by 'qemu-img create -b'
Liu Yuan [Fri, 3 Jan 2014 12:13:12 +0000 (20:13 +0800)] 
sheepdog: fix clone operation by 'qemu-img create -b'

We should pass base_inode->vdi_id to base_vdi_id of SheepdogVdiReq so that sheep
can create a clone instead a fresh volume.

This fixes following command:

qemu-create -b sheepdog:base sheepdog:clone

so users can boot sheepdog:clone as a normal volume.

Cc: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agogluster: Add support for creating zero-filled image
Bharata B Rao [Sat, 21 Dec 2013 09:21:26 +0000 (14:51 +0530)] 
gluster: Add support for creating zero-filled image

GlusterFS supports creation of zero-filled file on GlusterFS volume
by means of an API called glfs_zerofill(). Use this API from QEMU to
create an image that is filled with zeroes by using the preallocation
option of qemu-img.

qemu-img create gluster://server/volume/image -o preallocation=full 10G

The allowed values for preallocation are 'full' and 'off'. By default
preallocation is off and image is not zero-filled.

glfs_zerofill() offloads the writing of zeroes to the server and if
the storage supports SCSI WRITESAME, GlusterFS server can issue
BLKZEROOUT ioctl to achieve the zeroing.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agogluster: Implement .bdrv_co_write_zeroes for gluster
Bharata B Rao [Sat, 21 Dec 2013 09:21:25 +0000 (14:51 +0530)] 
gluster: Implement .bdrv_co_write_zeroes for gluster

Support .bdrv_co_write_zeroes() from gluster driver by using GlusterFS API
glfs_zerofill() that off-loads the writing of zeroes to GlusterFS server.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agogluster: Convert aio routines into coroutines
Bharata B Rao [Sat, 21 Dec 2013 09:21:24 +0000 (14:51 +0530)] 
gluster: Convert aio routines into coroutines

Convert the read, write, flush and discard implementations from aio-based
ones to coroutine based ones.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock/iscsi: return -ENOMEM if an async call fails immediately
Peter Lieven [Fri, 20 Dec 2013 09:02:47 +0000 (10:02 +0100)] 
block/iscsi: return -ENOMEM if an async call fails immediately

if an async libiscsi call fails directly it can only be due
to an out of memory condition. All other errors are returned
through the callback.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-iotests: Clean up all extents for vmdk
Fam Zheng [Tue, 26 Nov 2013 06:40:34 +0000 (14:40 +0800)] 
qemu-iotests: Clean up all extents for vmdk

This modifies _cleanup_test_img to remove all the extent files listed by
"qemu-img info"'s format specific information.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-iotests: Add _unsupported_imgopts for vmdk subformats
Fam Zheng [Tue, 26 Nov 2013 06:40:33 +0000 (14:40 +0800)] 
qemu-iotests: Add _unsupported_imgopts for vmdk subformats

Some cases are not applicable for vmdk subformats those don't support
certain features, e.g. backing file, and some others can't run on
mult-file image, e.g. monolithicFlat. This adds declaration in test
cases to skip them automatically, so that iotests on vmdk can go
more smoothly (without manually picking of cases for each subformat).

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-iotests: Introduce _unsupported_imgopts
Fam Zheng [Tue, 26 Nov 2013 06:40:32 +0000 (14:40 +0800)] 
qemu-iotests: Introduce _unsupported_imgopts

Introduce _unsupported_imgopts that causes _notrun for specific image
options.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agorbd: switch from pipe to QEMUBH completion notification
Stefan Hajnoczi [Thu, 5 Dec 2013 15:38:33 +0000 (16:38 +0100)] 
rbd: switch from pipe to QEMUBH completion notification

rbd callbacks are called from non-QEMU threads.  Up until now a pipe was
used to signal completion back to the QEMU iothread.

The pipe writer code handles EAGAIN using select(2).  The select(2) API
is not scalable since fd_set size is static.  FD_SET() can write beyond
the end of fd_set if the file descriptor number is too high.  (QEMU's
main loop uses poll(2) to avoid this issue with select(2).)

Since the pipe itself is quite clumsy to use and QEMUBH is now
thread-safe, just schedule a BH from the rbd callback function.  This
way we can simplify I/O completion in addition to eliminating the
potential FD_SET() crash when file descriptor numbers become too high.

Crash scenario: QEMU already has 1024 file descriptors open.  Hotplug an
rbd drive and get the pipe writer to take the select(2) code path.

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Tested-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoRevert "error: Don't use error_report() for assertion msgs."
Peter Crosthwaite [Wed, 15 Jan 2014 11:06:11 +0000 (03:06 -0800)] 
Revert "error: Don't use error_report() for assertion msgs."

This reverts commit d32934c84c72f57e78d430c22974677b7bcabe5d.

The original implementation before this patch makes abortive error
messages much more friendly. The underlying bug that required this
change is now fixed. Revert.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agotests: Add libqemustub to qom-interface-check
Peter Crosthwaite [Wed, 15 Jan 2014 11:05:36 +0000 (03:05 -0800)] 
tests: Add libqemustub to qom-interface-check

The recent addition of util/error.c's dependency on error_report()
causes this test to fail to link due to a number of missing monitor
related symbols. All these symbols are however defined by libqemustub.
Add this libary to the link.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoSPARC: Fix LEON3 power down instruction
Sebastian Huber [Wed, 27 Nov 2013 07:50:11 +0000 (08:50 +0100)] 
SPARC: Fix LEON3 power down instruction

Synchronize the program counter before the power down helper call
otherwise interrupts will return to the wrong context.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoerror: Don't use error_report() for assertion msgs.
Peter Crosthwaite [Wed, 15 Jan 2014 03:37:09 +0000 (19:37 -0800)] 
error: Don't use error_report() for assertion msgs.

Use fprintf(stderr instead. This removes dependency of libqemuutil.a
on the monitor.

We can further justify this change, in that this code path should only
trigger under a fatal error condition. fprintf-stderr is probably the
appropriate medium as under a fatal error conidition the monitor itself
may be down and out for the count. So assertion failure messages should
go lowest common denominator - straight to stderr.

Fixes the build as reported by Kevin Wolf. Issue debugged and change
suggested by Luiz Capitulino. Issue introduced by
5d24ee70bcbcf578614193526bcd5ed30a8eb16c.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoMerge remote branch 'luiz/queue/qmp' into qmpq
Edgar E. Iglesias [Tue, 14 Jan 2014 02:09:59 +0000 (12:09 +1000)] 
Merge remote branch 'luiz/queue/qmp' into qmpq

* luiz/queue/qmp:
  migration: qmp_migrate(): keep working after syntax error
  qerror: Remove assert_no_error()
  qemu-option: Remove qemu_opts_create_nofail
  target-i386: Remove assert_no_error usage
  hw: Remove assert_no_error usages
  qdev: Delete dead code
  error: Add error_abort
  monitor: add object-add (QMP) and object_add (HMP) command
  monitor: add object-del (QMP) and object_del (HMP) command
  qom: catch errors in object_property_add_child
  qom: fix leak for objects created with -object
  rng: initialize file descriptor to -1
  qemu-monitor: HMP cpu-add wrapper
  vl: add missing transition debug->finish_migrate

Message-Id: 1389045795-18706-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoMicroblaze: Convert Microblaze-pic handling to GPIOs
Alistair Francis [Mon, 13 Jan 2014 03:35:26 +0000 (13:35 +1000)] 
Microblaze: Convert Microblaze-pic handling to GPIOs

This patch uses inbound GPIO lines (IRQ and FIR) for
interrupts instead of using the old pic_cpu method,
which doesn't correspond to real hardware.

This creates the CPU's inbound IRQ and FIR GPIO lines and
updates the Microblaze boards to use this new method.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Suggested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reveiwed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agotarget-arm: Switch ARMCPUInfo arrays to use terminator entries
Peter Maydell [Mon, 13 Jan 2014 10:26:16 +0000 (10:26 +0000)] 
target-arm: Switch ARMCPUInfo arrays to use terminator entries

Switch the ARMCPUInfo arrays in cpu.c and cpu64.c to use a terminator
entry rather than looping based on ARRAY_SIZE. The latter causes
compile warnings on some versions of gcc if the configure options
happen to result in an empty array.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoMerge remote-tracking branch 'quintela/tags/migration/20140113' into staging
Anthony Liguori [Mon, 13 Jan 2014 21:20:49 +0000 (13:20 -0800)] 
Merge remote-tracking branch 'quintela/tags/migration/20140113' into staging

migration.next for 20140113

# gpg: Signature made Mon 13 Jan 2014 09:38:27 AM PST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* quintela/tags/migration/20140113: (49 commits)
  migration: synchronize memory bitmap 64bits at a time
  ram: split function that synchronizes a range
  memory: syncronize kvm bitmap using bitmaps operations
  memory: move bitmap synchronization to its own function
  kvm: refactor start address calculation
  kvm: use directly cpu_physical_memory_* api for tracking dirty pages
  memory: unfold memory_region_test_and_clear()
  memory: split cpu_physical_memory_* functions to its own include
  memory: cpu_physical_memory_set_dirty_tracking() should return void
  memory: make cpu_physical_memory_reset_dirty() take a length parameter
  memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
  memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
  memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
  memory: use find_next_bit() to find dirty bits
  memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
  memory: cpu_physical_memory_get_dirty() is used as returning a bool
  memory: make cpu_physical_memory_get_dirty() the main function
  memory: unfold cpu_physical_memory_set_dirty_flag()
  memory: unfold cpu_physical_memory_set_dirty() in its only user
  memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
  ...

Message-id: 1389634834-24181-1-git-send-email-quintela@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
8 years agomigration: synchronize memory bitmap 64bits at a time
Juan Quintela [Wed, 6 Nov 2013 10:33:05 +0000 (11:33 +0100)] 
migration: synchronize memory bitmap 64bits at a time

We use the old code if the bitmaps are not aligned

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agoram: split function that synchronizes a range
Juan Quintela [Tue, 5 Nov 2013 15:47:20 +0000 (16:47 +0100)] 
ram: split function that synchronizes a range

This function is the only bit where we care about speed.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: syncronize kvm bitmap using bitmaps operations
Juan Quintela [Tue, 5 Nov 2013 15:46:26 +0000 (16:46 +0100)] 
memory: syncronize kvm bitmap using bitmaps operations

If bitmaps are aligned properly, use bitmap operations.  If they are
not, just use old bit at a time code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: move bitmap synchronization to its own function
Juan Quintela [Tue, 5 Nov 2013 14:52:54 +0000 (15:52 +0100)] 
memory: move bitmap synchronization to its own function

We want to have all the functions that handle directly the dirty
bitmap near.  We will change it later.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agokvm: refactor start address calculation
Juan Quintela [Tue, 5 Nov 2013 14:45:46 +0000 (15:45 +0100)] 
kvm: refactor start address calculation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agokvm: use directly cpu_physical_memory_* api for tracking dirty pages
Juan Quintela [Mon, 4 Nov 2013 11:59:02 +0000 (12:59 +0100)] 
kvm: use directly cpu_physical_memory_* api for tracking dirty pages

Performance is important in this function, and we want to optimize even further.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: unfold memory_region_test_and_clear()
Juan Quintela [Mon, 14 Oct 2013 15:14:47 +0000 (17:14 +0200)] 
memory: unfold memory_region_test_and_clear()

We are going to update the bitmap directly

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: split cpu_physical_memory_* functions to its own include
Juan Quintela [Mon, 14 Oct 2013 15:13:59 +0000 (17:13 +0200)] 
memory: split cpu_physical_memory_* functions to its own include

All the functions that use ram_addr_t should be here.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_set_dirty_tracking() should return void
Juan Quintela [Thu, 10 Oct 2013 09:54:09 +0000 (11:54 +0200)] 
memory: cpu_physical_memory_set_dirty_tracking() should return void

Result was always 0, and not used anywhere.  Once there, use bool type
for the parameter.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: make cpu_physical_memory_reset_dirty() take a length parameter
Juan Quintela [Thu, 10 Oct 2013 09:49:53 +0000 (11:49 +0200)] 
memory: make cpu_physical_memory_reset_dirty() take a length parameter

We have an end parameter in all the callers, and this make it coherent
with the rest of cpu_physical_memory_* functions, that also take a
length parameter.

Once here, move the start/end calculation to
tlb_reset_dirty_range_all() as we don't need it here anymore.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
Juan Quintela [Thu, 10 Oct 2013 09:20:22 +0000 (11:20 +0200)] 
memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()

All uses except one really want the other meaning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
Juan Quintela [Wed, 9 Oct 2013 10:30:35 +0000 (12:30 +0200)] 
memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations

We were clearing a range of bits, so use bitmap_clear().

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
Juan Quintela [Wed, 9 Oct 2013 10:26:23 +0000 (12:26 +0200)] 
memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations

We were setting a range of bits, so use bitmap_set().

Note: xen has always been wrong, and should have used start instead
of addr from the beginning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: use find_next_bit() to find dirty bits
Juan Quintela [Wed, 9 Oct 2013 10:15:06 +0000 (12:15 +0200)] 
memory: use find_next_bit() to find dirty bits

This operation is way faster than doing it bit by bit.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
Juan Quintela [Wed, 9 Oct 2013 08:36:56 +0000 (10:36 +0200)] 
memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range

Now all functions use the same wording that bitops/bitmap operations

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_get_dirty() is used as returning a bool
Juan Quintela [Tue, 8 Oct 2013 18:40:55 +0000 (20:40 +0200)] 
memory: cpu_physical_memory_get_dirty() is used as returning a bool

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: make cpu_physical_memory_get_dirty() the main function
Juan Quintela [Tue, 8 Oct 2013 18:35:39 +0000 (20:35 +0200)] 
memory: make cpu_physical_memory_get_dirty() the main function

And make cpu_physical_memory_get_dirty_flag() to use it.  It used to
be the other way around.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: unfold cpu_physical_memory_set_dirty_flag()
Juan Quintela [Tue, 8 Oct 2013 18:27:58 +0000 (20:27 +0200)] 
memory: unfold cpu_physical_memory_set_dirty_flag()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: unfold cpu_physical_memory_set_dirty() in its only user
Juan Quintela [Tue, 8 Oct 2013 18:25:16 +0000 (20:25 +0200)] 
memory: unfold cpu_physical_memory_set_dirty() in its only user

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
Juan Quintela [Tue, 8 Oct 2013 18:21:10 +0000 (20:21 +0200)] 
memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: split dirty bitmap into three
Juan Quintela [Tue, 8 Oct 2013 14:14:39 +0000 (16:14 +0200)] 
memory: split dirty bitmap into three

After all the previous patches, spliting the bitmap gets direct.

Note: For some reason, I have to move DIRTY_MEMORY_* definitions to
the beginning of memory.h to make compilation work.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agobitmap: Add bitmap_zero_extend operation
Juan Quintela [Tue, 8 Oct 2013 14:12:17 +0000 (16:12 +0200)] 
bitmap: Add bitmap_zero_extend operation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_clear_dirty_flag() result is never used
Juan Quintela [Tue, 8 Oct 2013 13:50:55 +0000 (15:50 +0200)] 
memory: cpu_physical_memory_clear_dirty_flag() result is never used

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: only resize dirty bitmap when memory size increases
Juan Quintela [Tue, 8 Oct 2013 11:52:02 +0000 (13:52 +0200)] 
memory: only resize dirty bitmap when memory size increases

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: make sure that client is always inside range
Juan Quintela [Tue, 8 Oct 2013 11:29:11 +0000 (13:29 +0200)] 
memory: make sure that client is always inside range

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: use bit 2 for migration
Juan Quintela [Tue, 8 Oct 2013 11:26:29 +0000 (13:26 +0200)] 
memory: use bit 2 for migration

For historical reasons it was bit 3.  Once there, create a constant to
know the number of clients.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Juan Quintela [Tue, 8 Oct 2013 10:44:04 +0000 (12:44 +0200)] 
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag

Document it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: cpu_physical_memory_set_dirty_range() always dirty all flags
Juan Quintela [Tue, 8 Oct 2013 10:31:54 +0000 (12:31 +0200)] 
memory: cpu_physical_memory_set_dirty_range() always dirty all flags

So remove the flag argument and do it directly.  After this change,
there is nothing else using cpu_physical_memory_set_dirty_flags() so
remove it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: set single dirty flags when possible
Juan Quintela [Tue, 8 Oct 2013 10:25:25 +0000 (12:25 +0200)] 
memory: set single dirty flags when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: all users of cpu_physical_memory_get_dirty used only one flag
Juan Quintela [Tue, 8 Oct 2013 10:17:12 +0000 (12:17 +0200)] 
memory: all users of cpu_physical_memory_get_dirty used only one flag

So cpu_physical_memory_get_dirty_flags is not needed anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: make cpu_physical_memory_is_dirty return bool
Juan Quintela [Tue, 8 Oct 2013 10:01:01 +0000 (12:01 +0200)] 
memory: make cpu_physical_memory_is_dirty return bool

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agoexec: create function to get a single dirty bit
Juan Quintela [Tue, 8 Oct 2013 09:57:21 +0000 (11:57 +0200)] 
exec: create function to get a single dirty bit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agomemory: create function to set a single dirty bit
Juan Quintela [Tue, 8 Oct 2013 09:53:46 +0000 (11:53 +0200)] 
memory: create function to set a single dirty bit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoexec: use accessor function to know if memory is dirty
Juan Quintela [Tue, 8 Oct 2013 09:50:04 +0000 (11:50 +0200)] 
exec: use accessor function to know if memory is dirty

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agomemory: cpu_physical_memory_set_dirty_range() return void
Juan Quintela [Wed, 2 Oct 2013 12:30:02 +0000 (14:30 +0200)] 
memory: cpu_physical_memory_set_dirty_range() return void

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agomemory: cpu_physical_memory_set_dirty_flags() result is never used
Juan Quintela [Wed, 2 Oct 2013 12:04:19 +0000 (14:04 +0200)] 
memory: cpu_physical_memory_set_dirty_flags() result is never used

So return void.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agobitmap: use long as index
Juan Quintela [Tue, 17 Dec 2013 11:12:24 +0000 (12:12 +0100)] 
bitmap: use long as index

Move index and size fields from int to long.  We need that for
migration.  long is 64 bits on sane architectures, and 32bits should
be enough on all the 32bits architectures.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
8 years agotests: Some unit tests for vmstate.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:18 +0000 (12:01 -0200)] 
tests: Some unit tests for vmstate.c

 * Basic load/save tests
 * Tests for loading older versions
 * Tests for .field_exists() handling

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agosavevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
Eduardo Habkost [Fri, 29 Nov 2013 14:26:02 +0000 (12:26 -0200)] 
savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agoqemu-file: Move QEMUFile code to qemu-file.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:16 +0000 (12:01 -0200)] 
qemu-file: Move QEMUFile code to qemu-file.c

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agovmstate: Move VMState code to vmstate.c
Eduardo Habkost [Thu, 28 Nov 2013 14:01:15 +0000 (12:01 -0200)] 
vmstate: Move VMState code to vmstate.c

This will allow unit tests to be written for VMState code without
pulling dependencies from the savevm code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agosavevm.c: Coding style fix
Eduardo Habkost [Thu, 28 Nov 2013 14:01:14 +0000 (12:01 -0200)] 
savevm.c: Coding style fix

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agosavevm.c: Coding style fixes
Eduardo Habkost [Thu, 28 Nov 2013 14:01:13 +0000 (12:01 -0200)] 
savevm.c: Coding style fixes

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agosavevm: Convert all tabs to spaces
Eduardo Habkost [Thu, 28 Nov 2013 14:01:12 +0000 (12:01 -0200)] 
savevm: Convert all tabs to spaces

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agomigration: Move QEMU_VM_* defines to migration/migration.h
Eduardo Habkost [Thu, 28 Nov 2013 14:01:11 +0000 (12:01 -0200)] 
migration: Move QEMU_VM_* defines to migration/migration.h

The VMState code will be moved to vmstate.c and it uses some of the
QEMU_VM_* constants, so move it to a header.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agoqemu-file: Make a few functions non-static
Eduardo Habkost [Thu, 28 Nov 2013 14:01:10 +0000 (12:01 -0200)] 
qemu-file: Make a few functions non-static

The QEMUFile code will be moved to qemu-file.c. This will require making
the following functions non-static because they are used by the savevm.c
code:

 * qemu_peek_byte()
 * qemu_peek_buffer()
 * qemu_file_skip()
 * qemu_file_set_error()

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agomigration: Fix rate limit
Matthew Garrett [Mon, 25 Nov 2013 19:42:43 +0000 (14:42 -0500)] 
migration: Fix rate limit

The migration thread appears to want to allow writeout to occur at full
speed rather than being rate limited during completion of state saving,
but sets the limit to INT_MAX when xfer_limit is INT64_MAX. This causes
problems if there's more than 2GB of state left to save at this point. It
probably ought to just be INT64_MAX instead.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agointroduce MIG_STATE_CANCELLING state
Zhanghaoyu (A) [Thu, 7 Nov 2013 11:01:15 +0000 (11:01 +0000)] 
introduce MIG_STATE_CANCELLING state

Introduce MIG_STATE_CANCELLING state to avoid starting a new migration task while the previous one still exist.

Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agoavoid a bogus COMPLETED->CANCELLED transition
Zhanghaoyu (A) [Thu, 7 Nov 2013 08:21:23 +0000 (08:21 +0000)] 
avoid a bogus COMPLETED->CANCELLED transition

Avoid a bogus COMPLETED->CANCELLED transition.
There is a period of time from the timing of setting COMPLETED state to that of migration thread exits, so during which it's problematic in COMPLETED->CANCELLED transition.

Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 years agoMerge remote-tracking branch 'pmaydell/tags/pull-cocoa-20140112' into staging
Anthony Liguori [Mon, 13 Jan 2014 01:50:52 +0000 (17:50 -0800)] 
Merge remote-tracking branch 'pmaydell/tags/pull-cocoa-20140112' into staging

cocoa queue:
 * pass command key to guest when VM has mousegrab
 * add .qcow2 to extension list for image load dialog
 * fix bugs in code for starting QEMU via image load dialog
 * fix resize/redraw interaction
 * draw window black if guest hasn't sent anything to screen
 * minor style/typo fixes
 * add myself as cocoa co-maintainer

# gpg: Signature made Sun 12 Jan 2014 02:45:52 PM PST using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

* pmaydell/tags/pull-cocoa-20140112:
  MAINTAINERS: add myself as cocoa UI co-maintainer
  ui/cocoa: Remove stray tabs
  ui/cocoa: Draw black rectangle if we have no data yet
  ui/cocoa: Redraw at correct size when switching surface
  ui/cocoa: Fix code for starting QEMU via image file load dialog
  ui/cocoa: Add ".qcow2" to extension list for image load dialog
  ui/cocoa: Send warning message to stderr, not stdout
  ui/cocoa: Correct typos in comments and variable names
  ui/cocoa: Pass command key through to guest when VM has mousegrab

Message-id: 1389567158-31066-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
8 years agoMerge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140112' into staging
Anthony Liguori [Mon, 13 Jan 2014 01:50:43 +0000 (17:50 -0800)] 
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20140112' into staging

target-arm queue:
 * build fix for bigendian hosts

# gpg: Signature made Sun 12 Jan 2014 01:38:22 PM PST using RSA key ID 14360CDE
# gpg: Can't check signature: public key not found

* pmaydell/tags/pull-target-arm-20140112:
  arm: fix compile on bigendian host

Message-id: 1389562970-30944-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
8 years agoMAINTAINERS: add myself as cocoa UI co-maintainer
Peter Maydell [Mon, 16 Dec 2013 15:17:55 +0000 (15:17 +0000)] 
MAINTAINERS: add myself as cocoa UI co-maintainer

Add myself to the maintainers list for the cocoa UI; status
remains "Odd Fixes".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <andreas.faerber@web.de>
Message-id: 1387207075-10280-1-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Remove stray tabs
Peter Maydell [Tue, 24 Dec 2013 11:54:12 +0000 (11:54 +0000)] 
ui/cocoa: Remove stray tabs

The ui/cocoa.m file has just three lines with hardcoded tabs; fix them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1387886052-27067-1-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Draw black rectangle if we have no data yet
Peter Maydell [Tue, 24 Dec 2013 02:51:47 +0000 (02:51 +0000)] 
ui/cocoa: Draw black rectangle if we have no data yet

If our redraw method is called before we have any data from the guest,
then draw a black rectangle rather than leaving the window empty.
This mostly only matters when the guest machine has no framebuffer
device, but it is more in line with the behaviour of other QEMU UIs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1387853507-26298-3-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Redraw at correct size when switching surface
Peter Maydell [Tue, 24 Dec 2013 02:51:46 +0000 (02:51 +0000)] 
ui/cocoa: Redraw at correct size when switching surface

If the surface switch involved a resize, we were doing the redraw
at the old size rather than the new, because the update of
screen.width and screen.height was being done after the setFrame
method calls which triggered a redraw. Normally this isn't very
noticeable because typically after the guest triggers the window
resize it also draws something to it, which will in turn cause
us to redraw. However, the combination of a guest which never
draws to the display and a command line setting of a screen size
larger than the default can reveal odd effects.

Move most of the handling of resizes to the top of the method,
and guard it with a check that the surface size actually changed,
to avoid unnecessary operations (including some user visible ones
like "recenter the window on the screen") if the surface is the
same size as the old one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1387853507-26298-2-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Fix code for starting QEMU via image file load dialog
Peter Maydell [Sun, 8 Dec 2013 22:59:06 +0000 (22:59 +0000)] 
ui/cocoa: Fix code for starting QEMU via image file load dialog

Fix a number of bugs in the code for starting QEMU via the image
file load dialog:
 * use the actual argv[0] rather than "qemu": this avoids failures to
   find BIOS image files caused by not looking in the correct directory
   relative to the executable path
 * allocate a large enough argv array to NULL terminate it
 * use g_strdup(X) rather than g_strdup_printf("%s", X) or
   g_strdup_printf(X)
 * disable the printing of the simulated command line argument
   (which is presumably intended for debug only)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-6-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Add ".qcow2" to extension list for image load dialog
Peter Maydell [Sun, 8 Dec 2013 22:59:05 +0000 (22:59 +0000)] 
ui/cocoa: Add ".qcow2" to extension list for image load dialog

Add ".qcow2" to the list of file extensions which are accepted
by the initial disk image load dialog which is displayed if the
user runs QEMU without any command line arguments.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-5-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Send warning message to stderr, not stdout
Peter Maydell [Sun, 8 Dec 2013 22:59:04 +0000 (22:59 +0000)] 
ui/cocoa: Send warning message to stderr, not stdout

Bring a warning message into line with the others in this file by
sending it to stderr, not stdout.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-4-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Correct typos in comments and variable names
Peter Maydell [Sun, 8 Dec 2013 22:59:03 +0000 (22:59 +0000)] 
ui/cocoa: Correct typos in comments and variable names

Fix various non-user-visible typos in comments and variable names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1386543546-31919-3-git-send-email-peter.maydell@linaro.org

8 years agoui/cocoa: Pass command key through to guest when VM has mousegrab
Peter Maydell [Sun, 8 Dec 2013 22:59:02 +0000 (22:59 +0000)] 
ui/cocoa: Pass command key through to guest when VM has mousegrab

The guest might want to be able to use the command key for its won
purposes (as command if it is MacOS X, or for the Windows key if
it is a PC guest, for instance). In line with other UI frontends,
pass it through if the guest has mousegrab, and only use it for UI
menu accelerators if not grabbed.

Thanks to John Arbuckle for reporting this problem, helping
us work through what the best solution would be and providing
a patch which was the initial inspiration for this one.

Reported-by: John Arbuckle <programmingkidx@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1386543546-31919-2-git-send-email-peter.maydell@linaro.org

8 years agoarm: fix compile on bigendian host
Alexey Kardashevskiy [Sun, 12 Jan 2014 21:37:37 +0000 (21:37 +0000)] 
arm: fix compile on bigendian host

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Fri, 10 Jan 2014 19:05:17 +0000 (11:05 -0800)] 
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi-disk: add UNMAP limits to block limits VPD page
  block/iscsi: use a bh to schedule co reentrance

Message-id: 1387720926-11421-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>