OSDN Git Service

qmiga/qemu.git
10 years agovirtio-blk: Unify {non-,}dataplane's request handlings
Fam Zheng [Tue, 17 Jun 2014 06:32:09 +0000 (14:32 +0800)]
virtio-blk: Unify {non-,}dataplane's request handlings

This drops request handling code from dataplane, and uses code from
hw/block/virtio-blk.c.

It starts to use multiwrite as non-dataplane does.

Dataplane sets VirtIOBlock.complete_request to vring version, and calls
into non-dataplane's process handling. In complete_request_early,
qiov.size is added to vring push length, because it's also called in rw
completion now.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Schedule BH in the right context
Fam Zheng [Tue, 17 Jun 2014 06:32:08 +0000 (14:32 +0800)]
virtio-blk: Schedule BH in the right context

The BH must be called in the AioContext of bs. Currently it is only the
main loop, but with coming changes, it could also be a dataplane
IOThread.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Export request handling functions to dataplane
Fam Zheng [Tue, 17 Jun 2014 06:32:07 +0000 (14:32 +0800)]
virtio-blk: Export request handling functions to dataplane

So that dataplane can use virtio_blk_handle_request and
virtio_submit_multiwrite.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Make request completion function virtual
Fam Zheng [Tue, 17 Jun 2014 06:32:06 +0000 (14:32 +0800)]
virtio-blk: Make request completion function virtual

virtio_blk_req_complete will call VirtIOBlock.complete_request() to push
data and notify guest. No functional change.

Later, this will allow dataplane to provide it's own (vring_) version.

Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: acquire AioContext in qmp_query_blockstats()
Stefan Hajnoczi [Tue, 17 Jun 2014 06:32:05 +0000 (14:32 +0800)]
block: acquire AioContext in qmp_query_blockstats()

Make query-blockstats safe for dataplane by acquiring the
BlockDriverState's AioContext.  This ensures that the dataplane IOThread
and the main loop's monitor code do not race.

Note the assumption that acquiring the drive's BDS AioContext also
protects ->file and ->backing_hd.  This assumption is made by other
aio_context_acquire() callers too.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: make bdrv_query_stats() static
Stefan Hajnoczi [Tue, 17 Jun 2014 06:32:04 +0000 (14:32 +0800)]
block: make bdrv_query_stats() static

This function is only called from block/qapi.c.  There is no need to
keep it public.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Fix and clean up the in_sg and out_sg check
Fam Zheng [Wed, 11 Jun 2014 04:11:50 +0000 (12:11 +0800)]
virtio-blk: Fix and clean up the in_sg and out_sg check

out_sg is checked by iov_to_buf below, so it can be dropped.

Add assert and iov_discard_back around in_sg, as the in_sg is handled in
dataplane code.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Fill in VirtIOBlockReq.out in dataplane code
Fam Zheng [Wed, 11 Jun 2014 04:11:49 +0000 (12:11 +0800)]
virtio-blk: Fill in VirtIOBlockReq.out in dataplane code

VirtIOBlockReq is allocated in process_request, and freed in command
functions.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Convert VirtIOBlockReq.out to structrue
Fam Zheng [Wed, 11 Jun 2014 04:11:48 +0000 (12:11 +0800)]
virtio-blk: Convert VirtIOBlockReq.out to structrue

The virtio code currently assumes that the outhdr is in its own iovec.
This is not guaranteed by the spec, so we should relax this assumption.

Convert the VirtIOBlockReq.out field to structrue so that we can use
iov_to_buf and then discard the header from the beginning of iovec.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdr
Fam Zheng [Wed, 11 Jun 2014 04:11:47 +0000 (12:11 +0800)]
virtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdr

In current virtio spec, inhdr is a single byte, and is unlikely to
change for both functionality and compatibility considerations.
Non-dataplane uses .in, and we are on the way to converge them. So
let's unify it to get cleaner code.

Remove .inhdr and use .in.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReq
Fam Zheng [Wed, 11 Jun 2014 04:11:46 +0000 (12:11 +0800)]
virtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReq

Field "inhdr" is added temporarily for a more mechanical change, and
will be dropped in the next commit.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Drop VirtIOBlockRequest.read
Fam Zheng [Wed, 11 Jun 2014 04:11:45 +0000 (12:11 +0800)]
virtio-blk: Drop VirtIOBlockRequest.read

Since it's set but not used.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Drop bounce buffer from dataplane code
Fam Zheng [Wed, 11 Jun 2014 04:11:44 +0000 (12:11 +0800)]
virtio-blk: Drop bounce buffer from dataplane code

The block layer will handle the unaligned request.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Convert VirtIOBlockReq.elem to pointer
Fam Zheng [Wed, 11 Jun 2014 04:11:43 +0000 (12:11 +0800)]
virtio-blk: Convert VirtIOBlockReq.elem to pointer

This will make converging with dataplane code easier.

Add virtio_blk_free_request to handle the freeing of request internal
fields.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovirtio-blk: Move VirtIOBlockReq to header
Fam Zheng [Wed, 11 Jun 2014 04:11:42 +0000 (12:11 +0800)]
virtio-blk: Move VirtIOBlockReq to header

For later reusing by dataplane code.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Add node-name argument to drive-mirror
Benoît Canet [Mon, 16 Jun 2014 10:00:55 +0000 (12:00 +0200)]
block: Add node-name argument to drive-mirror

This new argument can be used to specify the node-name of the new mirrored BDS.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoquorum: Add the rewrite-corrupted parameter to quorum
Benoît Canet [Wed, 11 Jun 2014 13:24:10 +0000 (15:24 +0200)]
quorum: Add the rewrite-corrupted parameter to quorum

On read operations when this parameter is set and some replicas are corrupted
while quorum can be reached quorum will proceed to rewrite the correct version
of the data to fix the corrupted replicas.

This will shine with SSD where the FTL will remap the same block at another
place on rewrite.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: add qemu-iotest for resize base during live commit
Jeff Cody [Wed, 25 Jun 2014 20:55:31 +0000 (16:55 -0400)]
block: add qemu-iotest for resize base during live commit

If 'base' is smaller than the overlay image being committed into it,
then the base image will be grown in commit_run via bdrv_truncate().

This tests to make sure that this works, and the bdrv_truncate() is
not blocked when it shouldn't be.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: check for RESIZE blocker in the QMP command, not bdrv_truncate()
Jeff Cody [Wed, 25 Jun 2014 20:55:30 +0000 (16:55 -0400)]
block: check for RESIZE blocker in the QMP command, not bdrv_truncate()

If we check for the RESIZE blocker in bdrv_truncate(), that means a
commit will fail if the overlay layer is larger than the base, due to
the backing blocker.

This is a regression in behavior from 2.0; currently, commit will try to
grow the size of the base image to match the overlay size, if the
overlay size is larger.

By moving this into the QMP command qmp_block_resize(), it allows
usage of bdrv_truncate() within block jobs.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu_opts_append: Play nicely with QemuOptsList's head
Michal Privoznik [Wed, 25 Jun 2014 08:38:41 +0000 (10:38 +0200)]
qemu_opts_append: Play nicely with QemuOptsList's head

When running a libvirt test suite I've noticed the qemu-img is
crashing occasionally. Tracing the problem down led me to the
following valgrind output:

qemu.git $ valgrind -q ./qemu-img create -f qed -obacking_file=/dev/null,backing_fmt=raw qed
==14881== Invalid write of size 8
==14881==    at 0x1D263F: qemu_opts_create (qemu-option.c:692)
==14881==    by 0x130782: bdrv_img_create (block.c:5531)
==14881==    by 0x118DE0: img_create (qemu-img.c:462)
==14881==    by 0x11E7E4: main (qemu-img.c:2830)
==14881==  Address 0x11fedd38 is 24 bytes inside a block of size 232 free'd
==14881==    at 0x4C2CA5E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14881==    by 0x592D35E: g_realloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
==14881==    by 0x1D38D8: qemu_opts_append (qemu-option.c:1129)
==14881==    by 0x13075E: bdrv_img_create (block.c:5528)
==14881==    by 0x118DE0: img_create (qemu-img.c:462)
==14881==    by 0x11E7E4: main (qemu-img.c:2830)
==14881==
Formatting 'qed', fmt=qed size=0 backing_file='/dev/null' backing_fmt='raw' cluster_size=65536
==14881== Invalid write of size 8
==14881==    at 0x1D28BE: qemu_opts_del (qemu-option.c:750)
==14881==    by 0x130BF3: bdrv_img_create (block.c:5638)
==14881==    by 0x118DE0: img_create (qemu-img.c:462)
==14881==    by 0x11E7E4: main (qemu-img.c:2830)
==14881==  Address 0x11fedd38 is 24 bytes inside a block of size 232 free'd
==14881==    at 0x4C2CA5E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14881==    by 0x592D35E: g_realloc (in /usr/lib64/libglib-2.0.so.0.3800.2)
==14881==    by 0x1D38D8: qemu_opts_append (qemu-option.c:1129)
==14881==    by 0x13075E: bdrv_img_create (block.c:5528)
==14881==    by 0x118DE0: img_create (qemu-img.c:462)
==14881==    by 0x11E7E4: main (qemu-img.c:2830)
==14881==

The problem is apparently in the qemu_opts_append(). Well, if it
gets called twice or more. On the first call, when @dst is NULL
some initialization is done during which @dst->head list gets
initialized. The list is initialized in a way, so that the list
tail points at the list head. However, the next time
qemu_opts_append() is called for new options to be added,
g_realloc() may move @dst to a new address making the old list tail
point at an invalid address. If that's the case, we must update the
list pointers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: Remove a special case for protocols
Kevin Wolf [Wed, 4 Jun 2014 12:33:27 +0000 (14:33 +0200)]
block: Remove a special case for protocols

The only semantic change is that bs->open_flags gets BDRV_O_PROTOCOL set
now. This isn't useful, but it doesn't hurt either. The code that was
previously skipped by 'goto done' is automatically disabled because
protocol drivers don't support backing files (and if they did, this
would probably be a fix) and can't have snapshot_flags set.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Catch backing files assigned to non-COW drivers
Kevin Wolf [Wed, 4 Jun 2014 13:09:35 +0000 (15:09 +0200)]
block: Catch backing files assigned to non-COW drivers

Since we parse backing.* options to add a backing file from the command
line when the driver didn't assign one, it has been possible to have a
backing file for e.g. raw images (it just was never accessed).

This is obvious nonsense and should be rejected.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Remove second bdrv_open() recursion
Kevin Wolf [Wed, 4 Jun 2014 12:19:44 +0000 (14:19 +0200)]
block: Remove second bdrv_open() recursion

This recursion was introduced in commit 505d7583 in order to allow
nesting image formats. It only ever takes effect when the user
explicitly specifies a driver name and that driver isn't suitable for
the protocol level.

We can check this earlier in bdrv_open() and if the explicitly
requested driver is a format driver, clear BDRV_O_PROTOCOL so that
another bs->file layer is opened.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Inline bdrv_file_open()
Kevin Wolf [Wed, 4 Jun 2014 10:03:59 +0000 (12:03 +0200)]
block: Inline bdrv_file_open()

It doesn't do much any more, we can move the code to bdrv_open() now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Use common driver selection code for bdrv_open_file()
Kevin Wolf [Tue, 3 Jun 2014 14:44:19 +0000 (16:44 +0200)]
block: Use common driver selection code for bdrv_open_file()

This moves the bdrv_open_file() call a bit down so that it can use the
bdrv_open() code that selects the right block driver.

The code between the old and the new call site is either common code
(the error message for an unknown driver has been unified now) or
doesn't run with cleared BDRV_O_PROTOCOL (added an if block in one
place, whereas the right path was already asserted in another place)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
10 years agoblock: Always pass driver name through options QDict
Kevin Wolf [Tue, 27 May 2014 08:50:29 +0000 (10:50 +0200)]
block: Always pass driver name through options QDict

The "driver" entry in the options QDict is now only missing if we're
opening an image with format probing.

We also catch cases now where both the drv argument and a "driver"
option is specified, e.g. by specifying -drive format=qcow2,driver=raw

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Move json: parsing to bdrv_fill_options()
Kevin Wolf [Mon, 26 May 2014 09:45:08 +0000 (11:45 +0200)]
block: Move json: parsing to bdrv_fill_options()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Move bdrv_fill_options() call to bdrv_open()
Kevin Wolf [Mon, 26 May 2014 09:39:55 +0000 (11:39 +0200)]
block: Move bdrv_fill_options() call to bdrv_open()

bs->options now contains the modified version of the options.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock: Create bdrv_fill_options()
Kevin Wolf [Mon, 26 May 2014 09:09:59 +0000 (11:09 +0200)]
block: Create bdrv_fill_options()

The idea of bdrv_fill_options() is to convert every parameter for
opening images, in particular the filename and flags, to entries in the
options QDict.

This patch starts with moving the filename parsing and driver probing
part from bdrv_file_open() to the new function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoblock/nfs: add knob to set readahead
Peter Lieven [Tue, 24 Jun 2014 22:06:01 +0000 (00:06 +0200)]
block/nfs: add knob to set readahead

upcoming libnfs will feature internal readahead support.
Add a knob to pass the optional readahead value as a URL
parameter.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/nfs: fix url parameter checking
Peter Lieven [Tue, 24 Jun 2014 22:06:00 +0000 (00:06 +0200)]
block/nfs: fix url parameter checking

this patch fixes the incorrect usage of strncmp and
adds simple error checking by means of parse_uint_full
instead of atoi for the supplied URL parameters.

Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Test 0-length image for mirror
Fam Zheng [Tue, 24 Jun 2014 12:26:38 +0000 (20:26 +0800)]
qemu-iotests: Test 0-length image for mirror

All behavior and invariant should hold for images with 0 length, so
add a class to repeat all the tests in TestSingleDrive.

Hide two unapplicable test methods that would fail with 0 image length
because it's also used as cluster size.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit
Fam Zheng [Tue, 24 Jun 2014 12:26:37 +0000 (20:26 +0800)]
qemu-iotests: Test BLOCK_JOB_READY event for 0Kb image active commit

There should be a BLOCK_JOB_READY event with active commit, regardless
of image length. Let's test the 0 length image case, and make sure it
goes through the ready->complete process.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agomirror: Go through ready -> complete process for 0 len image
Fam Zheng [Tue, 24 Jun 2014 12:26:36 +0000 (20:26 +0800)]
mirror: Go through ready -> complete process for 0 len image

When mirroring or active committing a zero length image, BLOCK_JOB_READY
is not reported now, instead the job completes because we short circuit
the mirror job loop.

This is inconsistent with non-zero length images, and only confuses
management software.

Let's do the same thing when seeing a 0-length image: report ready
immediately; wait for block-job-cancel or block-job-complete; clear the
cancel flag as existing non-zero image synced case (cancelled after
ready); then jump to the exit.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockjob: Add block_job_yield()
Fam Zheng [Tue, 24 Jun 2014 12:26:35 +0000 (20:26 +0800)]
blockjob: Add block_job_yield()

This will unset busy flag and put coroutine to sleep, can be used to
wait for QMP complete/cancel.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-24' into staging
Peter Maydell [Tue, 24 Jun 2014 16:14:57 +0000 (17:14 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-24' into staging

trivial patches for 2014-06-24

# gpg: Signature made Tue 24 Jun 2014 17:07:31 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-06-24:
  Add support for the arm breakpoint syscall
  Increase maximum number of session of the internal TFTP server.
  target-s390x: Remove unused ld_code6() function
  hw/moxie/moxiesim.c: Remove unused moxie_intc_create()
  target-unicore: Remove unused functions
  build-sys: introduce install-prog macro to install&strip binaries and use it
  tcg: mark tcg_out* and tcg_patch* with attribute 'unused'
  rng-random: NULL check not needed before g_free()
  block.c: Remove useless 'buf' variable
  vscclient: Add required headers to fix build on FreeBSD
  target-ppc: Fix compiler warning
  configure: Enable TPM by default, add --disable-tpm
  Fix new typos (found by codespell)
  virtio-serial: remove useless set_config function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoAdd support for the arm breakpoint syscall
Hunter Laux [Fri, 20 Jun 2014 11:13:14 +0000 (04:13 -0700)]
Add support for the arm breakpoint syscall

OABI arm used a software interrupt(0xef9f0001) for breakpoints.
Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI.
Apparently Steel Bank Common Lisp still uses the swi instruction.

This is the kernel implementation:
http://lxr.free-electrons.com/source/arch/arm/kernel/traps.c#L598

Signed-off-by: Hunter Laux <hunterlaux@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoIncrease maximum number of session of the internal TFTP server.
Bernhard Übelacker [Sat, 21 Jun 2014 13:26:05 +0000 (15:26 +0200)]
Increase maximum number of session of the internal TFTP server.

Grub fails to boot from internal TFTP server when loading more than
3 initrd files.

Grub first opens a session to the TFTP server for every initrd file and
retrieves only the file size for all.
Then it wants to download the content using the old sessions which are
already expired.

Increasing the maximum number of session of the internal TFTP
server avoids this issue.

The error message reads as following:
error: timeout reading
`/boot/ISO.ROOT/BOOTMGR'.

Press any key to continue...

Signed-off-by: Bernhard Übelacker <bernhardu@vr-web.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotarget-s390x: Remove unused ld_code6() function
Peter Maydell [Mon, 23 Jun 2014 23:06:34 +0000 (00:06 +0100)]
target-s390x: Remove unused ld_code6() function

The ld_code6() function is unused; remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/moxie/moxiesim.c: Remove unused moxie_intc_create()
Peter Maydell [Mon, 23 Jun 2014 23:10:09 +0000 (00:10 +0100)]
hw/moxie/moxiesim.c: Remove unused moxie_intc_create()

The function moxie_intc_create() is unused; remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotarget-unicore: Remove unused functions
Peter Maydell [Mon, 23 Jun 2014 23:07:59 +0000 (00:07 +0100)]
target-unicore: Remove unused functions

The functions gen_st64, gen_ld64, gen_mulxy, ucf64_itod and
ucf64_dtoi are all unused; remove them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agobuild-sys: introduce install-prog macro to install&strip binaries and use it
Michael Tokarev [Sun, 22 Jun 2014 06:55:23 +0000 (10:55 +0400)]
build-sys: introduce install-prog macro to install&strip binaries and use it

Use common rule (macro) to install and strip binaries, and use
it in all places where we install binaries, instead of fixing
bugs like 1319493 in every place.
(This fixes https://bugs.launchpad.net/bugs/1319493)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotcg: mark tcg_out* and tcg_patch* with attribute 'unused'
Peter Maydell [Sat, 7 Jun 2014 17:08:44 +0000 (18:08 +0100)]
tcg: mark tcg_out* and tcg_patch* with attribute 'unused'

The tcg_out* and tcg_patch* functions are utility routines that may or
may not be used by a particular backend; mark them with the 'unused'
attribute to suppress spurious warnings if they aren't used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agorng-random: NULL check not needed before g_free()
Eduardo Habkost [Fri, 30 May 2014 20:02:18 +0000 (17:02 -0300)]
rng-random: NULL check not needed before g_free()

g_free() is NULL-safe.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoblock.c: Remove useless 'buf' variable
Chen Gang [Sat, 21 Jun 2014 13:00:44 +0000 (21:00 +0800)]
block.c: Remove useless 'buf' variable

'buf' is not used actually, so remove it and related snprintf() statement.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovscclient: Add required headers to fix build on FreeBSD
Ed Maste [Wed, 18 Jun 2014 12:58:00 +0000 (08:58 -0400)]
vscclient: Add required headers to fix build on FreeBSD

Signed-off-by: Ed Maste <emaste@freebsd.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotarget-ppc: Fix compiler warning
Stefan Weil [Tue, 17 Jun 2014 17:18:28 +0000 (19:18 +0200)]
target-ppc: Fix compiler warning

gcc reports a warning which is usually wrong:

target-ppc/dfp_helper.c: In function ‘dfp_get_digit’:
target-ppc/dfp_helper.c:417:1: warning:
 control reaches end of non-void function [-Wreturn-type]

The compiler shows the warning if assert is not marked with the noreturn
attribute or if the code is compiled with -DNDEBUG.

Using g_assert_not_reached better documents the intention and does not
have these problems.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: Enable TPM by default, add --disable-tpm
Cole Robinson [Mon, 16 Jun 2014 19:32:47 +0000 (15:32 -0400)]
configure: Enable TPM by default, add --disable-tpm

I don't see why tpm is disabled by default: it doesn't have any
external dependencies, or change default behavior. Leaving it disabled
is just going to cause it to bit rot.

Enable it by default, and add a --disable-tpm option.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoFix new typos (found by codespell)
Stefan Weil [Fri, 13 Jun 2014 18:42:57 +0000 (20:42 +0200)]
Fix new typos (found by codespell)

* accomodate -> accommodate
* aquiring -> acquiring
* beacuse -> because
* loosing -> losing
* prefering -> preferring
* threshhold -> threshold

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovirtio-serial: remove useless set_config function
Paolo Bonzini [Thu, 12 Jun 2014 09:20:53 +0000 (11:20 +0200)]
virtio-serial: remove useless set_config function

Its only contents are a dead memcpy.  Since it is optional,
drop the function altogether.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into...
Peter Maydell [Tue, 24 Jun 2014 14:33:42 +0000 (15:33 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into staging

migration/next for 20140623

# gpg: Signature made Mon 23 Jun 2014 18:18:57 BST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140623: (22 commits)
  vmstate: Refactor & increase tests for primitive types
  vmstate: Return error in case of error
  migration: Remove unneeded minimum_version_id_old
  tests: vmstate static checker: add size mismatch inside substructure
  tests: vmstate static checker: add substructure for usb-kbd for hid section
  tests: vmstate static checker: remove Subsections
  tests: vmstate static checker: remove a subsection
  tests: vmstate static checker: remove Description inside Fields
  tests: vmstate static checker: remove Description
  tests: vmstate static checker: remove Fields
  tests: vmstate static checker: change description name
  tests: vmstate static checker: remove last field in a struct
  tests: vmstate static checker: remove a field
  tests: vmstate static checker: remove a section
  tests: vmstate static checker: minimum_version_id check
  tests: vmstate static checker: version mismatch inside a Description
  tests: vmstate static checker: add version error in main section
  tests: vmstate static checker: incompat machine types
  tests: vmstate static checker: add dump1 and dump2 files
  vmstate-static-checker: script to validate vmstate changes
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Tue, 24 Jun 2014 12:06:13 +0000 (13:06 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp: (43 commits)
  monitor: protect event emission
  monitor: protect outbuf and mux_out with mutex
  qemu-char: make writes thread-safe
  qemu-char: move pty_chr_update_read_handler around
  qemu-char: do not call chr_write directly
  qemu-char: introduce qemu_chr_alloc
  qapi event: clean up
  qapi event: convert QUORUM events
  qapi event: convert GUEST_PANICKED
  qapi event: convert BALLOON_CHANGE
  qmp: convert ACPI_DEVICE_OST event
  qapi event: convert SPICE events
  qapi event: convert VNC events
  qapi event: convert NIC_RX_FILTER_CHANGED
  qapi event: convert other BLOCK_JOB events
  qapi event: convert BLOCK_IMAGE_CORRUPTED
  qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  qapi event: convert DEVICE_TRAY_MOVED
  qapi event: convert DEVICE_DELETED
  qapi event: convert WATCHDOG
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 24 Jun 2014 10:14:47 +0000 (11:14 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,pci,vhost,net fixes, enhancements

Don's patches to limit below-4g ram for pc
Marcel's pcie hotplug rewrite
Gabriel's changes to e1000 auto-negotiation
qemu char bugfixes by Stefan
misc bugfixes

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 23 Jun 2014 16:25:19 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (23 commits)
  xen-hvm: Handle machine opt max-ram-below-4g
  pc & q35: Add new machine opt max-ram-below-4g
  xen-hvm: Fix xen_hvm_init() to adjust pc memory layout
  pcie: coding style tweak
  hw/pcie: better hotplug/hotunplug support
  hw/pcie: implement power controller functionality
  hw/pcie: correct debug message
  q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props
  virtio-pci: Report an error when msix vectors init fails
  qemu-char: avoid leaking unused fds in tcp_get_msgfds()
  qemu-char: fix qemu_chr_fe_get_msgfd()
  qapi/string-output-visitor: fix human output
  e1000: factor out checking for auto-negotiation availability
  e1000: move e1000_autoneg_timer() to after set_ics()
  e1000: signal guest on successful link auto-negotiation
  e1000: improve auto-negotiation reporting via mii-tool
  e1000: emulate auto-negotiation during external link status change
  qtest: fix vhost-user-test unbalanced mutex locks
  qtest: fix qtest for vhost-user
  libqemustub: add more stubs for qemu-char
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging
Peter Maydell [Mon, 23 Jun 2014 17:26:58 +0000 (18:26 +0100)]
Merge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging

* remotes/rth/tcg-ppc-merge-1: (25 commits)
  tcg-ppc: Use the return address as a base pointer
  tcg-ppc: Merge cache-utils into the backend
  qemu/osdep: Remove the need for qemu_init_auxval
  tcg-ppc: Rename the tcg/ppc64 backend
  tcg-ppc: Remove the backend
  tcg-ppc64: Merge ppc32 shifts
  tcg-ppc64: Support mulsh_i32
  tcg-ppc64: Merge ppc32 register usage
  tcg-ppc64: Merge ppc32 qemu_ld/st
  tcg-ppc64: Merge ppc32 brcond2, setcond2, muluh
  tcg-ppc64: Begin merging ppc32 with ppc64
  tcg-ppc64: Fix sub2 implementation
  tcg-ppc64: Merge 32-bit ABIs into the prologue / frame code
  tcg-ppc64: Adjust tcg_out_call for ELFv2
  tcg-ppc64: Support the ppc64 elfv2 ABI
  tcg-ppc64: Use the correct test in tcg_out_call
  tcg-ppc64: Better parameterize the stack frame
  tcg-ppc64: Fix TCG_TARGET_CALL_STACK_OFFSET
  tcg-ppc64: Move call macros out of tcg-target.h
  tcg-ppc64: Make TCG_AREG0 and TCG_REG_CALL_STACK enum constants
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agovmstate: Refactor & increase tests for primitive types
Juan Quintela [Sat, 5 Apr 2014 18:12:51 +0000 (20:12 +0200)]
vmstate: Refactor & increase tests for primitive types

This commit refactor the simple tests to test all integer types. We
move to hex because it is easier to read values of different types.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agovmstate: Return error in case of error
Juan Quintela [Sat, 5 Apr 2014 18:16:22 +0000 (20:16 +0200)]
vmstate: Return error in case of error

If there is an error while loading a field, we should stop reading and
not continue with the rest of fields.  And we should also set an error
in qemu_file.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agomigration: Remove unneeded minimum_version_id_old
Juan Quintela [Tue, 10 Jun 2014 15:04:08 +0000 (17:04 +0200)]
migration: Remove unneeded minimum_version_id_old

Once there, make checkpatch happy.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agotests: vmstate static checker: add size mismatch inside substructure
Amit Shah [Fri, 20 Jun 2014 13:26:25 +0000 (18:56 +0530)]
tests: vmstate static checker: add size mismatch inside substructure

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add substructure for usb-kbd for hid section
Amit Shah [Fri, 20 Jun 2014 13:26:24 +0000 (18:56 +0530)]
tests: vmstate static checker: add substructure for usb-kbd for hid section

This shows how the script deals with substructures added to vmstate
descriptions that don't change the on-wire format.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Subsections
Amit Shah [Fri, 20 Jun 2014 13:26:23 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Subsections

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a subsection
Amit Shah [Fri, 20 Jun 2014 13:26:22 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a subsection

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Description inside Fields
Amit Shah [Fri, 20 Jun 2014 13:26:21 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description inside Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Description
Amit Shah [Fri, 20 Jun 2014 13:26:20 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Fields
Amit Shah [Fri, 20 Jun 2014 13:26:19 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: change description name
Amit Shah [Fri, 20 Jun 2014 13:26:18 +0000 (18:56 +0530)]
tests: vmstate static checker: change description name

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove last field in a struct
Amit Shah [Fri, 20 Jun 2014 13:26:17 +0000 (18:56 +0530)]
tests: vmstate static checker: remove last field in a struct

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a field
Amit Shah [Fri, 20 Jun 2014 13:26:16 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a field

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a section
Amit Shah [Fri, 20 Jun 2014 13:26:15 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: minimum_version_id check
Amit Shah [Fri, 20 Jun 2014 13:26:14 +0000 (18:56 +0530)]
tests: vmstate static checker: minimum_version_id check

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: version mismatch inside a Description
Amit Shah [Fri, 20 Jun 2014 13:26:13 +0000 (18:56 +0530)]
tests: vmstate static checker: version mismatch inside a Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add version error in main section
Amit Shah [Fri, 20 Jun 2014 13:26:12 +0000 (18:56 +0530)]
tests: vmstate static checker: add version error in main section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: incompat machine types
Amit Shah [Fri, 20 Jun 2014 13:26:11 +0000 (18:56 +0530)]
tests: vmstate static checker: incompat machine types

This commit modifies the dump2 data to flag incompatibilities in the
machine types being compared.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add dump1 and dump2 files
Amit Shah [Fri, 20 Jun 2014 13:26:10 +0000 (18:56 +0530)]
tests: vmstate static checker: add dump1 and dump2 files

These are stripped-down JSON data as obtained from the -dump-vmstate
option.  The two files are identical in this commit, and will be
modified in the later commits to show what the script does with the
data.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agovmstate-static-checker: script to validate vmstate changes
Amit Shah [Fri, 20 Jun 2014 13:26:09 +0000 (18:56 +0530)]
vmstate-static-checker: script to validate vmstate changes

This script compares the vmstate dumps in JSON format as output by QEMU
with the -dump-vmstate option.

It flags various errors, like version mismatch, sections going away,
size mismatches, etc.

This script is tolerant of a few changes that do not change the on-wire
format, like embedding a few fields within substructs.

The script takes -s/--src and -d/--dest parameters, to which filenames
are given as arguments.

Example:

(in a qemu 2.0 tree):
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json

(in a qemu 2.2 tree:)
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-i440fx-2.0 \
   qemu-2.2-m2.0.json

./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json

The script also takes a --reverse parameter to switch the src and dest
jsons.  This is just a shorthand for reversing the src and dest.

The --help parameter shows usage information.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: dump vmstate info as a json file for static analysis
Amit Shah [Fri, 20 Jun 2014 13:26:08 +0000 (18:56 +0530)]
migration: dump vmstate info as a json file for static analysis

This commit adds a new command, '-dump-vmstate', that takes a filename
as an argument.  When executed, QEMU will dump the vmstate information
for the machine type it's invoked with to the file, and quit.

The JSON-format output can then be used to compare the vmstate info for
different QEMU versions, specifically to test whether live migration
would break due to changes in the vmstate data.

A Python script that compares the output of such JSON dumps is included
in the following commit.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agordma: bug fixes
Michael R. Hines [Tue, 18 Feb 2014 02:34:06 +0000 (10:34 +0800)]
rdma: bug fixes

1. Fix small memory leak in parsing inet address from command line in data_init()
2. Fix ibv_post_send() return value check and pass error code back up correctly.
3. Fix rdma_destroy_qp() segfault after failure to connect to destination.

Reported-by: frank.yangjie@gmail.com
Reported-by: dgilbert@redhat.com
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging
Peter Maydell [Mon, 23 Jun 2014 16:47:28 +0000 (17:47 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging

A couple of s390-ccw bios bugfixes: Fix booting for some bootmaps and get
the devices to a sane state before running the guest.

# gpg: Signature made Mon 23 Jun 2014 13:22:32 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140623-2:
  pc-bios/s390-ccw: update s390-ccw.img binary
  pc-bios/s390-ccw: fix for fragmented SCSI bootmap
  pc-bios/s390-ccw: do a subsystem reset before running the guest
  pc-bios/s390-ccw: virtio_load_direct() can't load max number of sectors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agomonitor: protect event emission
Paolo Bonzini [Wed, 18 Jun 2014 06:44:00 +0000 (08:44 +0200)]
monitor: protect event emission

Event emission must be protected by a mutex because of access to
the shared rate-limiting state, and to guard against concurrent
monitor "hot-plug" by means of human-monitor-command.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: protect outbuf and mux_out with mutex
Paolo Bonzini [Wed, 18 Jun 2014 06:43:59 +0000 (08:43 +0200)]
monitor: protect outbuf and mux_out with mutex

This lets the block layer emit QMP events from outside the I/O thread.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: make writes thread-safe
Paolo Bonzini [Wed, 18 Jun 2014 06:43:58 +0000 (08:43 +0200)]
qemu-char: make writes thread-safe

This will let threads other than the I/O thread raise QMP events.

GIOChannel is thread-safe, and send and receive state is usually
well-separated.  The only driver that requires some care is the
pty driver, where some of the state is shared by the read and write
sides.  That state is protected with the chr_write_lock too.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: move pty_chr_update_read_handler around
Paolo Bonzini [Wed, 18 Jun 2014 06:43:57 +0000 (08:43 +0200)]
qemu-char: move pty_chr_update_read_handler around

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: do not call chr_write directly
Paolo Bonzini [Wed, 18 Jun 2014 06:43:56 +0000 (08:43 +0200)]
qemu-char: do not call chr_write directly

Make the mux always go through qemu_chr_fe_write, so that we'll get
the mutex for the underlying chardev.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: introduce qemu_chr_alloc
Paolo Bonzini [Wed, 18 Jun 2014 06:43:55 +0000 (08:43 +0200)]
qemu-char: introduce qemu_chr_alloc

The next patch will modify this function to initialize state that is
common to all backends.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: clean up
Wenchao Xia [Wed, 18 Jun 2014 06:43:54 +0000 (08:43 +0200)]
qapi event: clean up

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert QUORUM events
Wenchao Xia [Wed, 18 Jun 2014 06:43:53 +0000 (08:43 +0200)]
qapi event: convert QUORUM events

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert GUEST_PANICKED
Wenchao Xia [Wed, 18 Jun 2014 06:43:52 +0000 (08:43 +0200)]
qapi event: convert GUEST_PANICKED

'monitor.h' is still included in target-s390x/kvm.c, since I have
no good way to verify whether other code need it on my x86 host.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BALLOON_CHANGE
Wenchao Xia [Wed, 18 Jun 2014 06:43:51 +0000 (08:43 +0200)]
qapi event: convert BALLOON_CHANGE

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: convert ACPI_DEVICE_OST event
Igor Mammedov [Mon, 23 Jun 2014 13:26:57 +0000 (15:26 +0200)]
qmp: convert ACPI_DEVICE_OST event

... using new QAPI event infrastructure

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SPICE events
Wenchao Xia [Wed, 18 Jun 2014 06:43:50 +0000 (08:43 +0200)]
qapi event: convert SPICE events

SPICE_INITIALIZED, SPICE_CONNECTED, SPICE_DISCONNECTED and
SPICE_MIGRATE_COMPLETED are converted in one patch, since they
use some common functions. inet_strfamily() is removed since no
callers exist anymore.

Note that there is no existing doc for SPICE_MIGRATE_COMPLETED
in docs/qmp/qmp-events.txt before this patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert VNC events
Wenchao Xia [Wed, 18 Jun 2014 06:43:49 +0000 (08:43 +0200)]
qapi event: convert VNC events

Since VNC_CONNECTED, VNC_DISCONNECTED, VNC_INITIALIZED share some
common functions, convert them in one patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert NIC_RX_FILTER_CHANGED
Wenchao Xia [Wed, 18 Jun 2014 06:43:48 +0000 (08:43 +0200)]
qapi event: convert NIC_RX_FILTER_CHANGED

Param name is declared as optional, since in code it is an optional
one.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert other BLOCK_JOB events
Wenchao Xia [Wed, 18 Jun 2014 06:43:47 +0000 (08:43 +0200)]
qapi event: convert other BLOCK_JOB events

Since BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are
related, convert them in one patch. The block_job_event_* functions
are used to keep encapsulation of BlockJob structure.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BLOCK_IMAGE_CORRUPTED
Wenchao Xia [Wed, 18 Jun 2014 06:43:46 +0000 (08:43 +0200)]
qapi event: convert BLOCK_IMAGE_CORRUPTED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
Wenchao Xia [Wed, 18 Jun 2014 06:43:45 +0000 (08:43 +0200)]
qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert DEVICE_TRAY_MOVED
Wenchao Xia [Wed, 18 Jun 2014 06:43:44 +0000 (08:43 +0200)]
qapi event: convert DEVICE_TRAY_MOVED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert DEVICE_DELETED
Wenchao Xia [Wed, 18 Jun 2014 06:43:43 +0000 (08:43 +0200)]
qapi event: convert DEVICE_DELETED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert WATCHDOG
Wenchao Xia [Wed, 18 Jun 2014 06:43:42 +0000 (08:43 +0200)]
qapi event: convert WATCHDOG

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert RTC_CHANGE
Wenchao Xia [Wed, 18 Jun 2014 06:43:41 +0000 (08:43 +0200)]
qapi event: convert RTC_CHANGE

This patch also eliminates build time warning caused by no caller
of monitor_qapi_event_throttle().

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert WAKEUP
Wenchao Xia [Wed, 18 Jun 2014 06:43:40 +0000 (08:43 +0200)]
qapi event: convert WAKEUP

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SUSPEND_DISK
Wenchao Xia [Wed, 18 Jun 2014 06:43:39 +0000 (08:43 +0200)]
qapi event: convert SUSPEND_DISK

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>