OSDN Git Service

qmiga/qemu.git
7 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Wed, 27 Sep 2017 15:48:39 +0000 (16:48 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Tue 26 Sep 2017 14:52:32 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (24 commits)
  block/qcow2-bitmap: fix use of uninitialized pointer
  qemu-iotests: add shrinking image test
  qcow2: add shrink image support
  qcow2: add qcow2_cache_discard
  qemu-img: add --shrink flag for resize
  iotests: fix 181: enable postcopy-ram capability on target
  qemu-iotests: Test change-backing-file command
  block: Fix permissions after bdrv_reopen()
  block: reopen: Queue children after their parents
  block: Base permissions on rw state after reopen
  block: Add reopen queue to bdrv_check_perm()
  block: Add reopen_queue to bdrv_child_perm()
  qemu-io: Drop write permissions before read-only reopen
  block: Clean up some bad code in the vvfat driver
  block/throttle-groups.c: allocate RestartData on the heap
  throttle: Assert that bkt->max is valid in throttle_compute_wait()
  iotests: Print full path of bad output if mismatch
  iotests: use virtio aliases for 067
  iotests: use -ccw on s390x for 051
  iotests: use -ccw on s390x for 040, 139, and 182
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20170927' into staging
Peter Maydell [Wed, 27 Sep 2017 14:59:35 +0000 (15:59 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170927' into staging

Another s390x compat fix that should make it into 2.10.1.

# gpg: Signature made Wed 27 Sep 2017 10:30:16 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20170927:
  s390x/cpumodel: remove ais from z14 default model-> also for 2.10.1

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agos390x/cpumodel: remove ais from z14 default model-> also for 2.10.1
Christian Borntraeger [Wed, 27 Sep 2017 07:20:28 +0000 (09:20 +0200)]
s390x/cpumodel: remove ais from z14 default model-> also for 2.10.1

We disabled ais for 2.10, so let's also remove it from the z14
default model.

Fixes: 3f2d07b3b01e ("s390x/ais: for 2.10 stable: disable ais facility")
CC: qemu-stable@nongnu.org
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20170927072030.35737-2-borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/fw-20170926-pull-request' into...
Peter Maydell [Tue, 26 Sep 2017 21:07:02 +0000 (22:07 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/fw-20170926-pull-request' into staging

add --firmwarepath to configure

# gpg: Signature made Tue 26 Sep 2017 12:06:07 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fw-20170926-pull-request:
  Add --firmwarepath to configure
  add qemu_add_data_dir()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging
Peter Maydell [Tue, 26 Sep 2017 18:49:08 +0000 (19:49 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging

trivial patches for 2017-09-26

# gpg: Signature made Tue 26 Sep 2017 07:13:16 BST
# gpg:                using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* remotes/mjt/tags/trivial-patches-fetch: (29 commits)
  hw/isa/pc87312: Mark the device with user_creatable = false
  Drop gld linker usage on SunOS
  tests/boot-sector: Increase timeout to 600 seconds
  nbd-client: Use correct macro parenthesization
  hw/display/virtio-gpu: Put the virtio-gpu-device into the display category
  osdep: Fix ROUND_UP(64-bit, 32-bit)
  target/xtensa: Use the pre-defined MEMTXATTRS_UNSPECIFIED macro
  trivial: Add missing "-m" parameter in docs/memory-hotplug.txt
  chardev/baum: fix baum that releases brlapi twice
  remove trailing whitespace from qemu-options.hx
  hw/display/xenfb.c: Add trace_xenfb_key_event
  aux-to-i2c-bridge: don't allow user to create one
  util/qemu-thread-posix.c: Replace OS ifdefs with CONFIG_HAVE_SEM_TIMEDWAIT
  MAINTAINERS: update docs/interop/ entries
  MAINTAINERS: update docs/devel/ entries
  MAINTAINERS: add missing Cryptography entry
  MAINTAINERS: add missing entry for Generic Loader
  MAINTAINERS: add missing AIO entry
  MAINTAINERS: add missing entries for throttling infra
  MAINTAINERS: add missing SSI entries
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20170925' into staging
Peter Maydell [Tue, 26 Sep 2017 18:08:49 +0000 (19:08 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20170925' into staging

BQL bug fix

# gpg: Signature made Mon 25 Sep 2017 23:14:48 BST
# gpg:                using RSA key 0x64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20170925:
  accel/tcg/cputlb: avoid recursive BQL (fixes #1706296)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'mreitz/tags/pull-block-2017-09-26' into queue-block
Kevin Wolf [Tue, 26 Sep 2017 13:03:02 +0000 (15:03 +0200)]
Merge remote-tracking branch 'mreitz/tags/pull-block-2017-09-26' into queue-block

Block patches

# gpg: Signature made Tue Sep 26 15:01:00 2017 CEST
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2017-09-26:
  block/qcow2-bitmap: fix use of uninitialized pointer
  qemu-iotests: add shrinking image test
  qcow2: add shrink image support
  qcow2: add qcow2_cache_discard
  qemu-img: add --shrink flag for resize

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoblock/qcow2-bitmap: fix use of uninitialized pointer
Vladimir Sementsov-Ogievskiy [Fri, 22 Sep 2017 14:43:53 +0000 (17:43 +0300)]
block/qcow2-bitmap: fix use of uninitialized pointer

Without initialization to zero dirty_bitmap field may be not zero
for a bitmap which should not be stored and
qcow2_store_persistent_dirty_bitmaps will erroneously call
store_bitmap for it which leads to SIGSEGV on bdrv_dirty_bitmap_name.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20170922144353.4220-1-vsementsov@virtuozzo.com
Cc: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
7 years agoqemu-iotests: add shrinking image test
Pavel Butsykin [Mon, 18 Sep 2017 12:42:30 +0000 (15:42 +0300)]
qemu-iotests: add shrinking image test

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20170918124230.8152-5-pbutsykin@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
7 years agoqcow2: add shrink image support
Pavel Butsykin [Mon, 18 Sep 2017 12:42:29 +0000 (15:42 +0300)]
qcow2: add shrink image support

This patch add shrinking of the image file for qcow2. As a result, this allows
us to reduce the virtual image size and free up space on the disk without
copying the image. Image can be fragmented and shrink is done by punching holes
in the image file.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20170918124230.8152-4-pbutsykin@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
7 years agoqcow2: add qcow2_cache_discard
Pavel Butsykin [Mon, 18 Sep 2017 12:42:28 +0000 (15:42 +0300)]
qcow2: add qcow2_cache_discard

Whenever l2/refcount table clusters are discarded from the file we can
automatically drop unnecessary content of the cache tables. This reduces
the chance of eviction useful cache data and eliminates inconsistent data
in the cache with the data in the file.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20170918124230.8152-3-pbutsykin@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
7 years agoqemu-img: add --shrink flag for resize
Pavel Butsykin [Mon, 18 Sep 2017 12:42:27 +0000 (15:42 +0300)]
qemu-img: add --shrink flag for resize

The flag is additional precaution against data loss. Perhaps in the future the
operation shrink without this flag will be blocked for all formats, but for now
we need to maintain compatibility with raw.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20170918124230.8152-2-pbutsykin@virtuozzo.com
[mreitz: Added a missing space to a warning]
Signed-off-by: Max Reitz <mreitz@redhat.com>
7 years agoiotests: fix 181: enable postcopy-ram capability on target
Vladimir Sementsov-Ogievskiy [Mon, 25 Sep 2017 14:55:29 +0000 (17:55 +0300)]
iotests: fix 181: enable postcopy-ram capability on target

Migration capabilities should be enabled on both source and
destination qemu processes.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoqemu-iotests: Test change-backing-file command
Kevin Wolf [Fri, 15 Sep 2017 16:56:41 +0000 (18:56 +0200)]
qemu-iotests: Test change-backing-file command

This involves a temporary read-write reopen if the backing file link in
the middle of a backing file chain should be changed and is therefore a
good test for the latest bdrv_reopen() vs. op blockers fixes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoblock: Fix permissions after bdrv_reopen()
Kevin Wolf [Mon, 3 Jul 2017 15:07:35 +0000 (17:07 +0200)]
block: Fix permissions after bdrv_reopen()

If we switch between read-only and read-write, the permissions that
image format drivers need on bs->file change, too. Make sure to update
the permissions during bdrv_reopen().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoblock: reopen: Queue children after their parents
Kevin Wolf [Thu, 14 Sep 2017 12:53:46 +0000 (14:53 +0200)]
block: reopen: Queue children after their parents

We will calculate the required new permissions in the prepare stage of a
reopen. Required permissions of children can be influenced by the
changes made to their parents, but parents are independent from their
children. This means that permissions need to be calculated top-down. In
order to achieve this, queue parents before their children rather than
queuing the children first.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoblock: Base permissions on rw state after reopen
Kevin Wolf [Thu, 14 Sep 2017 12:32:04 +0000 (14:32 +0200)]
block: Base permissions on rw state after reopen

When new permissions are calculated during bdrv_reopen(), they need to
be based on the state of the graph as it will be after the reopen has
completed, not on the current state of the involved nodes.

This patch makes bdrv_is_writable() optionally accept a BlockReopenQueue
from which the new flags are taken. This is then used for determining
the new bs->file permissions of format drivers as soon as we add the
code to actually pass a non-NULL reopen queue to the .bdrv_child_perm
callbacks.

While moving bdrv_is_writable(), make it static. It isn't used outside
block.c.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoblock: Add reopen queue to bdrv_check_perm()
Kevin Wolf [Thu, 14 Sep 2017 12:42:12 +0000 (14:42 +0200)]
block: Add reopen queue to bdrv_check_perm()

In the context of bdrv_reopen(), we'll have to look at the state of the
graph as it will be after the reopen. This interface addition is in
preparation for the change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoblock: Add reopen_queue to bdrv_child_perm()
Kevin Wolf [Thu, 14 Sep 2017 10:47:11 +0000 (12:47 +0200)]
block: Add reopen_queue to bdrv_child_perm()

In the context of bdrv_reopen(), we'll have to look at the state of the
graph as it will be after the reopen. This interface addition is in
preparation for the change.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqemu-io: Drop write permissions before read-only reopen
Kevin Wolf [Fri, 22 Sep 2017 12:50:12 +0000 (14:50 +0200)]
qemu-io: Drop write permissions before read-only reopen

qemu-io provides a 'reopen' command that allows switching from writable
to read-only access. We need to make sure that we don't try to keep
write permissions to a BlockBackend that becomes read-only, otherwise
things are going to fail.

This requires a bdrv_drain() call because otherwise in-flight AIO
write requests could issue new internal requests while the permission
has already gone away, which would cause assertion failures. Draining
the queue doesn't break AIO requests in any new way, bdrv_reopen() would
drain it anyway only a few lines later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
7 years agoblock: Clean up some bad code in the vvfat driver
Thomas Huth [Wed, 13 Sep 2017 10:21:28 +0000 (12:21 +0200)]
block: Clean up some bad code in the vvfat driver

Remove the unnecessary home-grown redefinition of the assert() macro here,
and remove the unusable debug code at the end of the checkpoint() function.
The code there uses assert() with side-effects (assignment to the "mapping"
variable), which should be avoided. Looking more closely, it seems as it is
apparently also only usable for one certain directory layout (with a file
named USB.H in it) and thus is of no use for the rest of the world.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoblock/throttle-groups.c: allocate RestartData on the heap
Manos Pitsidianakis [Mon, 18 Sep 2017 20:25:29 +0000 (23:25 +0300)]
block/throttle-groups.c: allocate RestartData on the heap

RestartData is the opaque data of the throttle_group_restart_queue_entry
coroutine. By being stack allocated, it isn't available anymore if
aio_co_enter schedules the coroutine with a bottom half and runs after
throttle_group_restart_queue returns.

Cc: qemu-stable@nongnu.org
Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agothrottle: Assert that bkt->max is valid in throttle_compute_wait()
Alberto Garcia [Wed, 13 Sep 2017 08:28:17 +0000 (11:28 +0300)]
throttle: Assert that bkt->max is valid in throttle_compute_wait()

If bkt->max == 0 and bkt->burst_length > 1 then we could have a
division by 0 in throttle_do_compute_wait(). That configuration is
however not permitted and is already detected by throttle_is_valid(),
but let's assert it in throttle_compute_wait() to make it explicit.

Found by Coverity (CID: 1381016).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoiotests: Print full path of bad output if mismatch
Fam Zheng [Fri, 15 Sep 2017 05:45:26 +0000 (13:45 +0800)]
iotests: Print full path of bad output if mismatch

So it is easier to copy paste the path.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoiotests: use virtio aliases for 067
Cornelia Huck [Wed, 13 Sep 2017 09:10:38 +0000 (11:10 +0200)]
iotests: use virtio aliases for 067

The default cpu model on s390x does not provide zPCI, which is
not yet wired up on tcg. Moreover, virtio-ccw is the standard
on s390x.

Using virtio-scsi will implicitly pick the right device, so just
switch to that for simplicity.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoiotests: use -ccw on s390x for 051
Cornelia Huck [Wed, 13 Sep 2017 09:10:37 +0000 (11:10 +0200)]
iotests: use -ccw on s390x for 051

The default cpu model on s390x does not provide zPCI, which is
not yet wired up on tcg. Moreover, virtio-ccw is the standard
on s390x, so use the -ccw instead of the -pci versions of virtio
devices on s390x.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoiotests: use -ccw on s390x for 040, 139, and 182
Cornelia Huck [Wed, 13 Sep 2017 09:10:36 +0000 (11:10 +0200)]
iotests: use -ccw on s390x for 040, 139, and 182

The default cpu model on s390x does not provide zPCI, which is
not yet wired up on tcg. Moreover, virtio-ccw is the standard
on s390x, so use the -ccw instead of the -pci versions of virtio
devices on s390x.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agodocs: add qemu-block-drivers(7) man page
Stefan Hajnoczi [Fri, 8 Sep 2017 08:39:41 +0000 (09:39 +0100)]
docs: add qemu-block-drivers(7) man page

Block driver documentation is available in qemu-doc.html.  It would be
convenient to have documentation for formats, protocols, and filter
drivers in a man page.

Extract the relevant part of qemu-doc.html into a new file called
docs/qemu-block-drivers.texi.  This file can also be built as a
stand-alone document (man, html, etc).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agofile-posix: Clear out first sector in hdev_create
Fam Zheng [Fri, 8 Sep 2017 09:44:57 +0000 (17:44 +0800)]
file-posix: Clear out first sector in hdev_create

People get surprised when, after "qemu-img create -f raw /dev/sdX", they
still see qcow2 with "qemu-img info", if previously the bdev had a qcow2
header. While this is natural because raw doesn't need to write any
magic bytes during creation, hdev_create is free to clear out the first
sector to make sure the stale qcow2 header doesn't cause such confusion.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoqemu-img: Clarify about relative backing file options
Fam Zheng [Fri, 4 Aug 2017 14:36:58 +0000 (22:36 +0800)]
qemu-img: Clarify about relative backing file options

It's not too surprising when a user specifies the backing file relative
to the current working directory instead of the top layer image. This
causes error when they differ. Though the error message has enough
information to infer the fact about the misunderstanding, it is better
if we document this explicitly, so that users don't have to learn from
mistakes.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7 years agoqemu-iotests: Add missing -machine accel=qtest
Kevin Wolf [Thu, 7 Sep 2017 08:50:00 +0000 (10:50 +0200)]
qemu-iotests: Add missing -machine accel=qtest

A basic set of qemu options is initialised in ./common:

    export QEMU_OPTIONS="-nodefaults -machine accel=qtest"

However, two test cases (172 and 186) overwrite QEMU_OPTIONS and neglect
to manually set '-machine accel=qtest'. Add the missing option for 172.
186 probably only copied the code from 172, it doesn't actually need to
overwrite QEMU_OPTIONS, so remove that in 186.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
7 years agoAdd --firmwarepath to configure
Gerd Hoffmann [Thu, 14 Sep 2017 11:42:36 +0000 (13:42 +0200)]
Add --firmwarepath to configure

Add a firmware path config option to configure.  Multiple directories
are accepted, with the usual colon as separator.  Default value is
${prefix}/share/qemu-firmware.  The path is searched in addition to the
current search path (typically ${prefix}/share/qemu).

This prepares qemu for the planned split of the prebuilt firmware blobs
into a separate project.

Distributions can also use this to get rid of the firmware symlink farm
and add -- for example -- /usr/share/seabios to the firmware path
instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170914114236.25343-3-kraxel@redhat.com

7 years agoadd qemu_add_data_dir()
Gerd Hoffmann [Thu, 14 Sep 2017 11:42:35 +0000 (13:42 +0200)]
add qemu_add_data_dir()

Add helper function to add a directory to the qemu search path, so we
don't duplicate the checks.  Add a check for duplicate entries, so we
stop trying to open files twice.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170914114236.25343-2-kraxel@redhat.com

7 years agohw/isa/pc87312: Mark the device with user_creatable = false
Thomas Huth [Wed, 13 Sep 2017 09:07:17 +0000 (11:07 +0200)]
hw/isa/pc87312: Mark the device with user_creatable = false

QEMU currently aborts if you try to use the device at the command
line:

$ ppc64-softmmu/qemu-system-ppc64 -S -machine prep -device pc87312
Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
qemu-system-ppc64: -device pc87312: Device 'parallel0' is in use
Aborted (core dumped)

It uses parallel_hds in its realize function, so I can not be
instantiated by the user again.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoDrop gld linker usage on SunOS
Kamil Rytarowski [Mon, 11 Sep 2017 20:50:01 +0000 (22:50 +0200)]
Drop gld linker usage on SunOS

This is required to be removed on SmartOS (Illumos).
As of now there are no alternative supported SunOS distributions.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotests/boot-sector: Increase timeout to 600 seconds
Thomas Huth [Fri, 22 Sep 2017 03:06:57 +0000 (05:06 +0200)]
tests/boot-sector: Increase timeout to 600 seconds

If QEMU has been compiled with the flags --enable-tcg-interpreter and
--enable-debug, the guest is running incredibly slow. The pxe boot test
can take up to 400 seconds when testing the pseries ppc64 machine. While
we should still look for ways to speed up the test on the pseries machine,
it's better to increase the timeout in this test to 600 seconds anyway to
allow the test to pass successfully now with this unusal configuration
already.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agonbd-client: Use correct macro parenthesization
Eric Blake [Mon, 18 Sep 2017 21:46:49 +0000 (16:46 -0500)]
nbd-client: Use correct macro parenthesization

If 'bs' is a complex expression, we were only casting the front half
rather than the full expression.  Luckily, none of the callers were
passing bad arguments, but it's better to be robust up front.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agohw/display/virtio-gpu: Put the virtio-gpu-device into the display category
Thomas Huth [Fri, 15 Sep 2017 08:46:21 +0000 (10:46 +0200)]
hw/display/virtio-gpu: Put the virtio-gpu-device into the display category

The virtio-gpu-pci device is already in the display category, so the
virtio-gpu-device should be there, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoosdep: Fix ROUND_UP(64-bit, 32-bit)
Eric Blake [Thu, 14 Sep 2017 13:49:23 +0000 (08:49 -0500)]
osdep: Fix ROUND_UP(64-bit, 32-bit)

When using bit-wise operations that exploit the power-of-two
nature of the second argument of ROUND_UP(), we still need to
ensure that the mask is as wide as the first argument (done
by using a ternary to force proper arithmetic promotion).
Unpatched, ROUND_UP(2ULL*1024*1024*1024*1024, 512U) produces 0,
instead of the intended 2TiB, because negation of an unsigned
32-bit quantity followed by widening to 64-bits does not
sign-extend the mask.

Broken since its introduction in commit 292c8e50 (v1.5.0).
Callers that passed the same width type to both macro parameters,
or that had other code to ensure the first parameter's maximum
runtime value did not exceed the second parameter's width, are
unaffected, but I did not audit to see which (if any) existing
clients of the macro could trigger incorrect behavior (I found
the bug while adding a new use of the macro).

While preparing the patch, checkpatch complained about poor
spacing, so I also fixed that here and in the nearby DIV_ROUND_UP.

CC: qemu-trivial@nongnu.org
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotarget/xtensa: Use the pre-defined MEMTXATTRS_UNSPECIFIED macro
Alistair Francis [Fri, 15 Sep 2017 21:56:07 +0000 (14:56 -0700)]
target/xtensa: Use the pre-defined MEMTXATTRS_UNSPECIFIED macro

Instead of using the hardcoded (MemTxAttrs){0} for no memory attributes
let's use the already defined MEMTXATTRS_UNSPECIFIED macro instead.

This is technically a change of behaviour as MEMTXATTRS_UNSPECIFIED sets
the unspecified field to 1, but it doesn't look like anything is
checking this field.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agotrivial: Add missing "-m" parameter in docs/memory-hotplug.txt
Thomas Huth [Tue, 19 Sep 2017 09:02:26 +0000 (11:02 +0200)]
trivial: Add missing "-m" parameter in docs/memory-hotplug.txt

The example obviously lacks the "-m" parameter.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agochardev/baum: fix baum that releases brlapi twice
Liang Yan [Fri, 22 Sep 2017 22:55:33 +0000 (18:55 -0400)]
chardev/baum: fix baum that releases brlapi twice

Error process of baum_chr_open needs to set brlapi null, so it won't
get released twice in char_braille_finalize, which will cause
"/usr/bin/qemu-system-x86_64: double free or corruption (!prev)"

Signed-off-by: Liang Yan <lyan@suse.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoremove trailing whitespace from qemu-options.hx
Michael Tokarev [Sat, 23 Sep 2017 16:31:59 +0000 (19:31 +0300)]
remove trailing whitespace from qemu-options.hx

Remove trailing whitespace in qemu-options documentation, as it causes
reproducibility issues depending on the echo implementation used by
the Makefile.

Reported-By: Vagrant Cascadian <vagrant@debian.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agohw/display/xenfb.c: Add trace_xenfb_key_event
Liang Yan [Wed, 23 Aug 2017 15:27:36 +0000 (11:27 -0400)]
hw/display/xenfb.c: Add trace_xenfb_key_event

It may be better to add a trace event to monitor the last moment of
a key event from QEMU to guest VM

Signed-off-by: Liang Yan <lyan@suse.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoaux-to-i2c-bridge: don't allow user to create one
KONRAD Frederic [Fri, 25 Aug 2017 11:46:09 +0000 (13:46 +0200)]
aux-to-i2c-bridge: don't allow user to create one

This device is private and is created once per aux-bus.
So don't allow the user to create one from command-line.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoutil/qemu-thread-posix.c: Replace OS ifdefs with CONFIG_HAVE_SEM_TIMEDWAIT
Peter Maydell [Tue, 5 Sep 2017 12:19:32 +0000 (13:19 +0100)]
util/qemu-thread-posix.c: Replace OS ifdefs with CONFIG_HAVE_SEM_TIMEDWAIT

In qemu-thread-posix.c we have two implementations of the
various qemu_sem_* functions, one of which uses native POSIX
sem_* and the other of which emulates them with pthread conditions.
This is necessary because not all our host OSes support
sem_timedwait().

Instead of a hard-coded list of OSes which don't implement
sem_timedwait(), which gets out of date, make configure
test for the presence of the function and set a new
CONFIG_HAVE_SEM_TIMEDWAIT appropriately.

In particular, newer NetBSDs have sem_timedwait(), so this
commit will switch them over to using it. OSX still does
not have an implementation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: update docs/interop/ entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:32 +0000 (14:36 -0300)]
MAINTAINERS: update docs/interop/ entries

moved in commit 7746cf8aab68

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Fam Zheng <famz@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: update docs/devel/ entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:31 +0000 (14:36 -0300)]
MAINTAINERS: update docs/devel/ entries

moved in commit ac06724a7158

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing Cryptography entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:30 +0000 (14:36 -0300)]
MAINTAINERS: add missing Cryptography entry

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing entry for Generic Loader
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:29 +0000 (14:36 -0300)]
MAINTAINERS: add missing entry for Generic Loader

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing AIO entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:28 +0000 (14:36 -0300)]
MAINTAINERS: add missing AIO entry

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing entries for throttling infra
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:27 +0000 (14:36 -0300)]
MAINTAINERS: add missing entries for throttling infra

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing SSI entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:26 +0000 (14:36 -0300)]
MAINTAINERS: add missing SSI entries

Alistair Francis volunteered :)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing PCI entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:25 +0000 (14:36 -0300)]
MAINTAINERS: add missing PCI entries

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing qcow2 entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:23 +0000 (14:36 -0300)]
MAINTAINERS: add missing qcow2 entry

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing Guest Agent entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:22 +0000 (14:36 -0300)]
MAINTAINERS: add missing Guest Agent entries

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing VMWare entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:21 +0000 (14:36 -0300)]
MAINTAINERS: add missing VMWare entry

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing entry for vhost
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:20 +0000 (14:36 -0300)]
MAINTAINERS: add missing entry for vhost

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing STM32 entry
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:36:19 +0000 (14:36 -0300)]
MAINTAINERS: add missing STM32 entry

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair@alistair23.me>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMAINTAINERS: add missing ARM entries
Philippe Mathieu-Daudé [Fri, 8 Sep 2017 17:31:32 +0000 (14:31 -0300)]
MAINTAINERS: add missing ARM entries

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoReplace round_page() with TARGET_PAGE_ALIGN()
Kamil Rytarowski [Mon, 11 Sep 2017 20:16:10 +0000 (22:16 +0200)]
Replace round_page() with TARGET_PAGE_ALIGN()

This change fixes conflict with the DragonFly BSD headers.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoconfigure: Remove unused code (found by shellcheck)
Stefan Weil [Tue, 28 Mar 2017 18:49:59 +0000 (20:49 +0200)]
configure: Remove unused code (found by shellcheck)

smartcard_cflags is no longer needed since commit
0b22ef0f57a8910d849602bef0940edcd0553d2c.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-09-25' into staging
Peter Maydell [Mon, 25 Sep 2017 23:24:15 +0000 (00:24 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-09-25' into staging

nbd patches for 2017-09-25

- Eric Blake: nbd-client: Use correct macro parenthesization
- Vladimir Sementsov-Ogievskiy: 0/3 nbd client refactoring and fixing

# gpg: Signature made Mon 25 Sep 2017 14:39:21 BST
# gpg:                using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2017-09-25:
  block/nbd-client: nbd_co_send_request: fix return code
  block/nbd-client: simplify check in nbd_co_receive_reply
  block/nbd-client: refactor nbd_co_receive_reply
  nbd-client: Use correct macro parenthesization

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Mon, 25 Sep 2017 19:31:24 +0000 (20:31 +0100)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

slirp updates

# gpg: Signature made Sun 24 Sep 2017 19:07:51 BST
# gpg:                using RSA key 0x9E511E01C737F075
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: 9A37 3D36 64A8 DC62 DA0A  34FD 9E51 1E01 C737 F075

* remotes/thibault/tags/samuel-thibault:
  slirp: Add a special case for the NULL socket
  slirp: Fix intermittent send queue hangs on a socket
  slirp: Add explanation for hostfwd parsing failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoaccel/tcg/cputlb: avoid recursive BQL (fixes #1706296)
Alex Bennée [Thu, 21 Sep 2017 11:06:25 +0000 (12:06 +0100)]
accel/tcg/cputlb: avoid recursive BQL (fixes #1706296)

The mmio path (see exec.c:prepare_mmio_access) already protects itself
against recursive locking and it makes sense to do the same for
io_readx/writex. Otherwise any helper running in the BQL context will
assert when it attempts to write to device memory as in the case of
the bug report.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
CC: Richard Jones <rjones@redhat.com>
CC: Paolo Bonzini <bonzini@gnu.org>
CC: qemu-stable@nongnu.org
Message-Id: <20170921110625.9500-1-alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 years agoblock/nbd-client: nbd_co_send_request: fix return code
Vladimir Sementsov-Ogievskiy [Wed, 20 Sep 2017 12:45:07 +0000 (15:45 +0300)]
block/nbd-client: nbd_co_send_request: fix return code

It's incorrect to return success rc >= 0 if we skip qio_channel_writev_all()
call due to s->quit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170920124507.18841-4-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
7 years agoblock/nbd-client: simplify check in nbd_co_receive_reply
Vladimir Sementsov-Ogievskiy [Wed, 20 Sep 2017 12:45:06 +0000 (15:45 +0300)]
block/nbd-client: simplify check in nbd_co_receive_reply

If we are woken up from while() loop in nbd_read_reply_entry
handles must be equal. If we are woken up from
nbd_recv_coroutines_wake_all s->quit must be true, so we do
not need checking handles equality.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170920124507.18841-3-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
7 years agoblock/nbd-client: refactor nbd_co_receive_reply
Vladimir Sementsov-Ogievskiy [Wed, 20 Sep 2017 12:45:05 +0000 (15:45 +0300)]
block/nbd-client: refactor nbd_co_receive_reply

"NBDReply *reply" parameter of nbd_co_receive_reply is used only
to pass return value for nbd_co_request (reply.error). Remove it
and use function return value instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170920124507.18841-2-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
7 years agonbd-client: Use correct macro parenthesization
Eric Blake [Mon, 18 Sep 2017 21:46:49 +0000 (16:46 -0500)]
nbd-client: Use correct macro parenthesization

If 'bs' is a complex expression, we were only casting the front half
rather than the full expression.  Luckily, none of the callers were
passing bad arguments, but it's better to be robust up front.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170918214649.17550-1-eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoslirp: Add a special case for the NULL socket
Kevin Cernekee [Wed, 20 Sep 2017 20:42:05 +0000 (13:42 -0700)]
slirp: Add a special case for the NULL socket

NULL sockets are used for NDP, BOOTP, and other critical operations.
If the topmost mbuf in a NULL session is blocked pending resolution,
it may cause problems if it blocks other packets with a NULL socket.
So do not add mbufs with a NULL socket field to the same session.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: Fix intermittent send queue hangs on a socket
Kevin Cernekee [Wed, 20 Sep 2017 20:42:04 +0000 (13:42 -0700)]
slirp: Fix intermittent send queue hangs on a socket

if_output() originally sent one mbuf per call and used the slirp->next_m
variable to keep track of where it left off.  But nowadays it tries to
send all of the mbufs from the fastq, and one mbuf from each session on
the batchq.  The next_m variable is both redundant and harmful: there is
a case[0] involving delayed packets in which next_m ends up pointing
to &slirp->if_batchq when an active session still exists, and this
blocks all traffic for that session until qemu is restarted.

The test case was created to reproduce a problem that was seen on
long-running Chromium OS VM tests[1] which rapidly create and
destroy ssh connections through hostfwd.

[0] https://pastebin.com/NNy6LreF
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=766323

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoslirp: Add explanation for hostfwd parsing failure
Dr. David Alan Gilbert [Fri, 8 Sep 2017 15:53:59 +0000 (16:53 +0100)]
slirp: Add explanation for hostfwd parsing failure

e.g.
./x86_64-softmmu/qemu-system-x86_64 -nographic -netdev 'user,id=vnet,hostfwd=:555.0.0.0:0-:22'
qemu-system-x86_64: -netdev user,id=vnet,hostfwd=:555.0.0.0:0-:22: Invalid host forwarding rule ':555.0.0.0:0-:22' (Bad host address)

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Sat, 23 Sep 2017 11:55:40 +0000 (12:55 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* Speed up AddressSpaceDispatch creation (Alexey)
* Fix kvm.c assert (David)
* Memory fixes and further speedup (me)
* Persistent reservation manager infrastructure (me)
* virtio-serial: add enable_backend callback (Pavel)
* chardev GMainContext fixes (Peter)

# gpg: Signature made Fri 22 Sep 2017 20:07:33 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (32 commits)
  chardev: remove context in chr_update_read_handler
  chardev: use per-dev context for io_add_watch_poll
  chardev: add Chardev.gcontext field
  chardev: new qemu_chr_be_update_read_handlers()
  scsi: add persistent reservation manager using qemu-pr-helper
  scsi: add multipath support to qemu-pr-helper
  scsi: build qemu-pr-helper
  scsi, file-posix: add support for persistent reservation management
  memory: Share special empty FlatView
  memory: seek FlatView sharing candidates among children subregions
  memory: trace FlatView creation and destruction
  memory: Create FlatView directly
  memory: Get rid of address_space_init_shareable
  memory: Rework "info mtree" to print flat views and dispatch trees
  memory: Do not allocate FlatView in address_space_init
  memory: Share FlatView's and dispatch trees between address spaces
  memory: Move address_space_update_ioeventfds
  memory: Alloc dispatch tree where topology is generared
  memory: Store physical root MR in FlatView
  memory: Rename mem_begin/mem_commit/mem_add helpers
  ...

# Conflicts:
# configure

7 years agochardev: remove context in chr_update_read_handler
Peter Xu [Thu, 21 Sep 2017 06:35:54 +0000 (14:35 +0800)]
chardev: remove context in chr_update_read_handler

We had a per-chardev cache for context, then we don't need this
parameter to be passed in every time when chr_update_read_handler()
called.  As long as we are calling chr_update_read_handler() using
qemu_chr_be_update_read_handlers() we'll be fine.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1505975754-21555-5-git-send-email-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agochardev: use per-dev context for io_add_watch_poll
Peter Xu [Thu, 21 Sep 2017 06:35:53 +0000 (14:35 +0800)]
chardev: use per-dev context for io_add_watch_poll

It was only passed in by chr_update_read_handlers().  However when
reconnect, we'll lose that context information.  So if a chardev was
running on another context (rather than the default context, the NULL
pointer), it'll switch back to the default context if reconnection
happens.  But, it should really stick to the old context.

Convert all the callers of io_add_watch_poll() to use the internally
cached gcontext.  Then the context should be able to survive even after
reconnections.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1505975754-21555-4-git-send-email-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agochardev: add Chardev.gcontext field
Peter Xu [Thu, 21 Sep 2017 06:35:52 +0000 (14:35 +0800)]
chardev: add Chardev.gcontext field

It caches the gcontext that is used to poll the chardev IO.  Before this
patch, we only passed it in via chr_update_read_handlers().  However
that may not be enough if the char backend is disconnected and
reconnected afterward.  There are chardev codes that still assumed the
context be NULL (which is the main context).  Will fix that up in
following up patches.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1505975754-21555-3-git-send-email-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agochardev: new qemu_chr_be_update_read_handlers()
Peter Xu [Thu, 21 Sep 2017 06:35:51 +0000 (14:35 +0800)]
chardev: new qemu_chr_be_update_read_handlers()

Add a wrapper for the chr_update_read_handler().

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1505975754-21555-2-git-send-email-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: add persistent reservation manager using qemu-pr-helper
Paolo Bonzini [Mon, 21 Aug 2017 16:58:56 +0000 (18:58 +0200)]
scsi: add persistent reservation manager using qemu-pr-helper

This adds a concrete subclass of pr-manager that talks to qemu-pr-helper.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: add multipath support to qemu-pr-helper
Paolo Bonzini [Tue, 22 Aug 2017 04:50:55 +0000 (06:50 +0200)]
scsi: add multipath support to qemu-pr-helper

Proper support of persistent reservation for multipath devices requires
communication with the multipath daemon, so that the reservation is
registered and applied when a path comes up.  The device mapper
utilities provide a library to do so; this patch makes qemu-pr-helper.c
detect multipath devices and, when one is found, delegate the operation
to libmpathpersist.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoscsi: build qemu-pr-helper
Paolo Bonzini [Tue, 22 Aug 2017 04:50:18 +0000 (06:50 +0200)]
scsi: build qemu-pr-helper

Introduce a privileged helper to run persistent reservation commands.
This lets virtual machines send persistent reservations without using
CAP_SYS_RAWIO or out-of-tree patches.  The helper uses Unix permissions
and SCM_RIGHTS to restrict access to processes that can access its socket
and prove that they have an open file descriptor for a raw SCSI device.

The next patch will also correct the usage of persistent reservations
with multipath devices.

It would also be possible to support for Linux's IOC_PR_* ioctls in
the future, to support NVMe devices.  For now, however, only SCSI is
supported.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into...
Peter Maydell [Fri, 22 Sep 2017 15:15:23 +0000 (16:15 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

Python queue, 2017-09-22

* MAINTAINERS update
* Fix logging issue on test scripts using qemu.py

# gpg: Signature made Fri 22 Sep 2017 15:41:43 BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  MAINTAINERS: Add Python scripts
  qemu.py: Call logging.basicConfig() automatically

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMAINTAINERS: Add Python scripts
Eduardo Habkost [Fri, 15 Sep 2017 23:07:44 +0000 (20:07 -0300)]
MAINTAINERS: Add Python scripts

Cleber and I are volunteering to review and queue patches for the
Python scripts and modules in scripts/.

I'm setting "M: Odd fixes" because not all scripts are actively
maintained.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170915230744.22942-1-ehabkost@redhat.com>
[ehabkost: add tests/*.py too]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agoqemu.py: Call logging.basicConfig() automatically
Eduardo Habkost [Thu, 21 Sep 2017 16:22:34 +0000 (13:22 -0300)]
qemu.py: Call logging.basicConfig() automatically

Not all scripts using qemu.py configure the Python logging
module, and end up generating a "No handlers could be found for
logger" message instead of actual log messages.

To avoid requiring every script using qemu.py to configure
logging manually, call basicConfig() when creating a QEMUMachine
object.  This won't affect scripts that already set up logging,
but will ensure that scripts that don't configure logging keep
working.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Fixes: 4738b0a85a0c2031fddc71b51cccebce0c4ba6b1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170921162234.847-1-ehabkost@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Acked-by: Lukáš Doktor <ldoktor@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20170922-1' into...
Peter Maydell [Fri, 22 Sep 2017 13:04:10 +0000 (14:04 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170922-1' into staging

migration/next for 20170922

# gpg: Signature made Fri 22 Sep 2017 13:15:06 BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/migration/20170922-1:
  migration: split ufd_version_check onto receive/request features part
  migration: fix hardcoded function name in error report
  migration: pass MigrationIncomingState* into migration check functions
  migration: split common postcopy out of ram postcopy
  migration: fix ram_save_pending
  migration: add has_postcopy savevm handler
  bitmap: provide to_le/from_le helpers
  bitmap: introduce bitmap_count_one()
  bitmap: remove BITOP_WORD()
  migration: Split migration_fd_process_incoming
  migration: Create multifd migration threads
  migration: Create x-multifd-page-count parameter
  migration: Create x-multifd-channels parameter
  migration: Add multifd capability
  migration: Create migration_has_all_channels
  migration: Add comments to channel functions
  migration: Teach it about G_SOURCE_REMOVE
  migration: Create migration_ioc_process_incoming()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoide: fix enum comparison for gcc 4.7
John Snow [Thu, 21 Sep 2017 01:38:21 +0000 (21:38 -0400)]
ide: fix enum comparison for gcc 4.7

Apparently GCC gets bent over comparing enum values against zero.
Replace the conditional with something less readable.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170921013821.1673-1-jsnow@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agomigration: split ufd_version_check onto receive/request features part
Alexey Perevalov [Tue, 19 Sep 2017 16:47:58 +0000 (19:47 +0300)]
migration: split ufd_version_check onto receive/request features part

This modification is necessary for userfault fd features which are
required to be requested from userspace.
UFFD_FEATURE_THREAD_ID is a one of such "on demand" feature, which will
be introduced in the next patch.

QEMU have to use separate userfault file descriptor, due to
userfault context has internal state, and after first call of
ioctl UFFD_API it changes its state to UFFD_STATE_RUNNING (in case of
success), but kernel while handling ioctl UFFD_API expects UFFD_STATE_WAIT_API.
So only one ioctl with UFFD_API is possible per ufd.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: fix hardcoded function name in error report
Alexey Perevalov [Tue, 19 Sep 2017 16:47:57 +0000 (19:47 +0300)]
migration: fix hardcoded function name in error report

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: pass MigrationIncomingState* into migration check functions
Alexey Perevalov [Tue, 19 Sep 2017 16:47:56 +0000 (19:47 +0300)]
migration: pass MigrationIncomingState* into migration check functions

That tiny refactoring is necessary to be able to set
UFFD_FEATURE_THREAD_ID while requesting features, and then
to create downtime context in case when kernel supports it.

Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: split common postcopy out of ram postcopy
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:16 +0000 (19:30 +0300)]
migration: split common postcopy out of ram postcopy

Split common postcopy staff from ram postcopy staff.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: fix ram_save_pending
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:15 +0000 (19:30 +0300)]
migration: fix ram_save_pending

Fill postcopy-able pending only if ram postcopy is enabled.
It is necessary because of there will be other postcopy-able states and
when ram postcopy is disabled, it should not spoil common postcopy
related pending.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: add has_postcopy savevm handler
Vladimir Sementsov-Ogievskiy [Mon, 10 Jul 2017 16:30:14 +0000 (19:30 +0300)]
migration: add has_postcopy savevm handler

Now postcopy-able states are recognized by not NULL
save_live_complete_postcopy handler. But when we have several different
postcopy-able states, it is not convenient. Ram postcopy may be
disabled, while some other postcopy enabled, in this case Ram state
should behave as it is not postcopy-able.

This patch add separate has_postcopy handler to specify behaviour of
savevm state.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agobitmap: provide to_le/from_le helpers
Peter Xu [Wed, 30 Aug 2017 08:32:00 +0000 (16:32 +0800)]
bitmap: provide to_le/from_le helpers

Provide helpers to convert bitmaps to little endian format. It can be
used when we want to send one bitmap via network to some other hosts.

One thing to mention is that, these helpers only solve the problem of
endianess, but it does not solve the problem of different word size on
machines (the bitmaps managing same count of bits may contains different
size when malloced). So we need to take care of the size alignment issue
on the callers for now.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agobitmap: introduce bitmap_count_one()
Peter Xu [Wed, 30 Aug 2017 08:31:59 +0000 (16:31 +0800)]
bitmap: introduce bitmap_count_one()

Count how many bits set in the bitmap.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agobitmap: remove BITOP_WORD()
Peter Xu [Wed, 30 Aug 2017 08:31:58 +0000 (16:31 +0800)]
bitmap: remove BITOP_WORD()

We have BIT_WORD(). It's the same.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: Split migration_fd_process_incoming
Juan Quintela [Mon, 17 Jul 2017 10:30:25 +0000 (12:30 +0200)]
migration: Split migration_fd_process_incoming

We need that on later patches.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agomigration: Create multifd migration threads
Juan Quintela [Thu, 14 Jan 2016 15:52:55 +0000 (16:52 +0100)]
migration: Create multifd migration threads

Creation of the threads, nothing inside yet.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
--

Use pointers instead of long array names
Move to use semaphores instead of conditions as paolo suggestion

Put all the state inside one struct.
Use a counter for the number of threads created.  Needed during cancellation.

Add error return to thread creation

Add id field

Rename functions to multifd_save/load_setup/cleanup
Change recv parameters to a pointer to struct
Change back to a struct
Use Error * for _cleanup

7 years agomigration: Create x-multifd-page-count parameter
Juan Quintela [Thu, 27 Apr 2017 08:48:25 +0000 (10:48 +0200)]
migration: Create x-multifd-page-count parameter

Indicates how many pages we are going to send in each batch to a multifd
thread.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--

Be consistent with defaults and documentation
Use new DEFINE_PROP_*
Rename x-multifd-group to x-multifd-page-count

7 years agomigration: Create x-multifd-channels parameter
Juan Quintela [Fri, 15 Jan 2016 07:56:17 +0000 (08:56 +0100)]
migration: Create x-multifd-channels parameter

Indicates the number of channels that we will create.  By default we
create 2 channels.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--

Catch inconsistent defaults (eric).
Improve comment stating that number of threads is the same than number
of sockets
Use new DEFIN_PROP_*
Rename x-multifd-threads to x-multifd-threads

7 years agomigration: Add multifd capability
Juan Quintela [Thu, 14 Jan 2016 11:23:00 +0000 (12:23 +0100)]
migration: Add multifd capability

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
--

Use new DEFINE_PROP

7 years agomigration: Create migration_has_all_channels
Juan Quintela [Mon, 24 Jul 2017 11:06:25 +0000 (13:06 +0200)]
migration: Create migration_has_all_channels

This function allows us to decide when to close the listener socket.
For now, we only need one connection.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>