Commit graph

41534 commits

Author SHA1 Message Date
Michael S. Tsirkin 8a9b6b37da vhost-user: unit test for new messages
Data is empty for now, but do make sure master
sets the new feature bit flag.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-02 17:04:32 +03:00
Paolo Bonzini ca06d9cc66 vhost-user-test: do not reinvent glib-compat.h
glib-compat.h has the gunk to support both old-style and new-style
gthread functions.  Use it instead of reinventing it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2015-10-02 17:04:31 +03:00
Peter Maydell 37dd86a44c Block layer patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJWDm85AAoJEH8JsnLIjy/W8UwQALTalzXwWVx0FeVHnBVDENXI
 vLh6ZUgGxMGs5JmVyycoF6YkFhlJMI+EBhBqY+VtXSkyTpiJN0+YMYpIjBHWZyX5
 KiDYJjJT1GDp1PcskE6nAU+b8r9GFov8+S0oCuE4l6++KxjG1liv7rifx3TW5uIl
 yHcEX6lr9rAVMO2Uz62vTvYWrLv2eRplzLvZy3I31Q413Fp5ed0Qbd2SGdUG7eCm
 3midqxFdvcWfed59C6OHg8AWbNxgT+MVIhved2n/N+oqKSE+cmcinWxE+HJwClfY
 1w4FBZ6+yuvUHJtM5iiU867VHPSNRsOc3NQVc3tBkqr30xUPmO3vPN/Ey4QG8ugH
 OfjBIHxKp/aVOJN44fH4FoJ3t2qnv5c8ncn/0N3WdbqVnH4LUpQF2DfdCGmxQpRt
 y91Sgs5Jxog3C+hdLzOvjhIdPi7AZvyU4jz13596Gg3AHWFoz25Sk+paefHJuN+i
 nK4bH6GNF1wnZYk9VX0r5SYAvTg8OoK4Zt+o254DXpkJZIXU0hDCGMPnVOFmmh8W
 +dCxZz3D5u5VdBU4VZ4kGHz7GZRUbrE7PYYoFdsKPrfxbV8daNO8pGF+Umph+jAX
 NS0hl8bcCQjCLal8rLDc06sjauBcltjo8pAyGe7D1QTae8nj3o6IqI1jOfSwp0wZ
 VUNtHjRjIB828+HIdPM9
 =4Do4
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 02 Oct 2015 12:49:13 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
  block: disable I/O limits at the beginning of bdrv_close()
  iotests: Fix test 128 for password-less sudo
  tests: Fix test 049 fallout from improved HMP error messages
  raw-win32: Fix write request error handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-02 14:47:10 +01:00
Richard W.M. Jones 73ba05d936 block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1265196

The following command fails on an NFS mountpoint:

  $ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144
  Formatting 'disk.img', fmt=qcow2 size=262144 encryption=off cluster_size=65536 preallocation='falloc' lazy_refcounts=off
  qemu-img: disk.img: Could not preallocate data for the new file: Bad file descriptor

The reason turns out to be because NFS doesn't support the
posix_fallocate call.  glibc emulates it instead.  However glibc's
emulation involves using the pread(2) syscall.  The pread syscall
fails with EBADF if the file descriptor is opened without the read
open-flag (ie. open (..., O_WRONLY)).

I contacted glibc upstream about this, and their response is here:

  https://bugzilla.redhat.com/show_bug.cgi?id=1265196#c9

There are two possible fixes: Use Linux fallocate directly, or (this
fix) work around the problem in qemu by opening the file with O_RDWR
instead of O_WRONLY.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1265196
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-02 13:48:29 +02:00
Alberto Garcia 99b7e77567 block: disable I/O limits at the beginning of bdrv_close()
Disabling I/O limits from a BDS also drains all pending throttled
requests, so it should be done at the beginning of bdrv_close() with
the rest of the bdrv_drain() calls before the BlockDriver is closed.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-02 13:48:29 +02:00
Max Reitz bb3c801df7 iotests: Fix test 128 for password-less sudo
As of 934659c460, $QEMU_IO is generally no
longer a program name, and therefore "sudo -n $QEMU_IO" will no longer
work.

Fix this by copying the qemu-io invocation function from common.config,
making it use $sudo for invoking $QEMU_IO_PROG, and then use that
function instead of $QEMU_IO.

Reported-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-02 13:48:29 +02:00
Eric Blake 552bb52c4b tests: Fix test 049 fallout from improved HMP error messages
Commit 50b7b000 improved HMP error messages, but forgot to update
qemu-iotests to match.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-10-02 13:48:29 +02:00
Kevin Wolf 5d555030ba raw-win32: Fix write request error handling
aio_worker() wrote the return code to the wrong variable.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Guangmu Zhu <guangmuzhu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2015-10-02 13:48:29 +02:00
David Hildenbrand d9f090ec77 s390x: rename io_subsystem_reset -> subsystem_reset
According to the Pop:
"Subsystem reset operates only on those elements in the configuration
which are not CPUs".

As this is what we actually do, let's simply rename the function.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1443689387-34473-6-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-10-02 13:31:52 +02:00
Christian Borntraeger a6085fab3b s390x/info registers: print vector registers properly
We want

F12=0000000000000000 F13=0000000000000000 F14=0000000000000000 F15=0000000000000000
V00=00000000000000000000000000000000 V01=00000000000000000000000000000000

instead of
F12=0000000000000000 F13=0000000000000000 F14=0000000000000000 F15=0000000000000000
V00=00000000000000000000000000000000
V01=00000000000000000000000000000000 V02=00000000000000000000000000000000

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1443689387-34473-5-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-10-02 13:31:52 +02:00
David Hildenbrand 7059384c7e s390x: set missing parent for hotplug and quiesce events
Existing code missed to set a parent for the quiesce and hotplug event.
While this didn't matter in practise, new introspection APIs basically now
do an object_unref(object_new(T)), which loops forever.

When trying to remove the event facility bus, the code tries to
unparent all childs on the bus, so they are properly deleted and therefore removed.
As object_unparent() on these child devices doesn't work, as there is no parent,
we loop forever.

Let's fix this by adding the event facility as a parent. Also switch from
object_initialize to object_new, so the only valid reference is in fact the
parent property. This makes it more obvious when the device (state) is actually
gone (and how the reference counting works).

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1443689387-34473-4-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-10-02 13:31:52 +02:00
David Hildenbrand 8a641ff60f s390x/gdb: expose virtualization specific registers
Let's expose some virtual/fake registers as virtualization specific
registers.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1443689387-34473-3-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-10-02 13:31:52 +02:00
Christian Borntraeger af3c15fee5 pc-bios/s390-ccw: avoid floating point operations
Some gcc versions (e.g. Fedora 22 gcc 5.1.1) seem to use floating
point registers for spilling and filling of general purpose registers.
As the BIOS does not activate the AFP register setting of CR0 this can
cause data exception program checks.
Disallow floating point in the BIOS as a simple solution.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1443689387-34473-2-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-10-02 13:31:52 +02:00
Peter Maydell ff770b07f3 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQIcBAABAgAGBQJWDYNJAAoJEL2+eyfA3jBXYlkP/j9U3cmhwpf0+nF+ogDzc+GW
 1wxFu/BaxY2Yvl140AtEbG0OkpQT9PX46jonWHk4VYOfUsEuMRus7UwgABQIapTh
 1Dn3TIBg9KvwL5Tc7kq4h6b5uwF5YrvIJg9U03CGD06IC6igwYppULDlmUutsGBL
 znhVL2LqIyfrRS/+xfEZQAzmtj/EQEbCTUgZGO4IYFZERXwrH+iGq0jdTdIiHXqE
 JCbaze3AXpNCEGGPqdEvIA8rbjF9BnWVew03w+qy69QCYV29tkLM4V2LgoEcFYQh
 uBqIL+j/cKI8D6LsmAhPapkrOJjcWyPR6RYA3E+eTl4GfDF9rcbyX0T0tqTHVH0y
 TgetOS2qeyNebRH9pBv+n3frZ9dodk2q0XDaDjm9mlmfnpMt2cfpfE6ZYiN9DKwn
 iN8n/aoifivrW7DPEas2KQ19k5412nYkdktyAr8TUcmEfSNCAPpFkUzXr0cy7Hrc
 39dVQzSEIfika3Mr8/ZJl6+yKYKtTh0dgTS3FStDIZpErBFsBmzmTJebbkaVzGfI
 KCrhKg3ds9UqnDV8uo+AMCL0vFXi6xNrUN/ELdI2kOPqKBtef1R0TzH2OLQJgsN/
 FxExRStpNL+BZTXnTsbD/cxPd5ozxp1RU6xJfkeXKBorTXsskYdIXNIIhyzfTlkg
 9NEQPST9K/0+EZXJPWfg
 =EIu7
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging

# gpg: Signature made Thu 01 Oct 2015 20:02:33 BST using RSA key ID C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"

* remotes/cody/tags/block-pull-request:
  block: mirror - fix full sync mode when target does not support zero init

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-02 11:01:18 +01:00
Alistair Francis 5250ced831 target-microblaze: Set the PC in reset instead of realize
Set the Microblaze CPU PC in the reset instead of setting it
in the realize. This is required as the PC is zeroed in the
reset function and causes problems in some situations.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2015-10-01 17:55:36 -07:00
Stefan Weil c8667283a0 disas/cris: Fix typo in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
2015-10-01 17:24:02 -07:00
Jeff Cody 5279efebcf block: mirror - fix full sync mode when target does not support zero init
During mirror, if the target device does not support zero init, a
mirror may result in a corrupted image for sync="full" mode.

This is due to how the initial dirty bitmap is set up prior to copying
data - we did not mark sectors as dirty that are unallocated.  This
means those unallocated sectors are skipped over on the target, and for
a device without zero init, invalid data may reside in those holes.

If both of the following conditions are true, then we will explicitly
mark all sectors as dirty:

    1.) sync = "full"
    2.) bdrv_has_zero_init(target) == false

If the target does support zero init, but a target image is passed in
with data already present (i.e. an "existing" image), it is assumed the
data present in the existing image is valid data for those sectors.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 91ed4bc5bda7e2b09eb508b07c83f4071fe0b3c9.1443705220.git.jcody@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
2015-10-01 15:02:21 -04:00
Richard Henderson 0d583647a7 virtio: Notice when the system doesn't support MSIx at all
And do not issue an error_report in that case.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-01 16:16:52 +03:00
Eduardo Habkost 798595075b pc: Add a comment explaining why pc_compat_2_4() doesn't exist
pc_compat_2_4() doesn't exist, and we shouldn't create one. Add a
comment explaining why the function doesn't exist and why pc_compat_*()
functions are deprecated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-01 16:16:52 +03:00
Michael S. Tsirkin 8561c9244d exec: allocate PROT_NONE pages on top of RAM
This inserts a read and write protected page between RAM and QEMU
memory, for file-backend RAM.
This makes it harder to exploit QEMU bugs resulting from buffer
overflows in devices using variants of cpu_physical_memory_map,
dma_memory_map etc.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2015-10-01 16:16:52 +03:00
Michael S. Tsirkin 9fac18f03a oslib: allocate PROT_NONE pages on top of RAM
This inserts a read and write protected page between RAM and QEMU
memory. This makes it harder to exploit QEMU bugs resulting from buffer
overflows in devices using variants of cpu_physical_memory_map,
dma_memory_map etc.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2015-10-01 16:16:52 +03:00
Michael S. Tsirkin c2dfc5ba3f oslib: rework anonimous RAM allocation
At the moment we first allocate RAM, sometimes more than necessary for
alignment reasons.  We then free the extra RAM.

Rework this to avoid the temporary allocation: reserve the
range by mapping it with PROT_NONE, then use just the
necessary range with MAP_FIXED.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2015-10-01 16:16:52 +03:00
Jason Wang 0cf33fb6b4 virtio-net: correctly drop truncated packets
When packet is truncated during receiving, we drop the packets but
neither discard the descriptor nor add and signal used
descriptor. This will lead several issues:

- sg mappings are leaked
- rx will be stalled if a lots of packets were truncated

In order to be consistent with vhost, fix by discarding the descriptor
in this case.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-01 16:16:52 +03:00
Jason Wang 29b9f5efd7 virtio: introduce virtqueue_discard()
This patch introduces virtqueue_discard() to discard a descriptor and
unmap the sgs. This will be used by the patch that will discard
descriptor when packet is truncated.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-01 16:16:52 +03:00
Jason Wang ce31746157 virtio: introduce virtqueue_unmap_sg()
Factor out sg unmapping logic. This will be reused by the patch that
can discard descriptor.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Andrew James <andrew.james@hpe.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-10-01 16:16:52 +03:00
Peter Maydell fa500928ad migration/next for 20150930
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWC5wiAAoJEPSH7xhYctcj2qUQAOCcToETW1SpCmxad9IZ2G4P
 JS5Z5Z8JOwg0eTsm7yPZBmp6aTOHff7IjJHGNmUWv16vfFlRef0pVjGvqaFoj9U9
 QezXh9LUsE7Iv4eJbo51lUSRcz2uV/MqRaEoD0Z8D/9X+xxq0/bjAasSSPibON0l
 K/1cDmpe7vlUWTsgGA0QGaheND7C6neVNTlIi3y/m3WLiTixbPCHOb5oYrj014UZ
 0EPEKarAHYS1fHpNJSgqVu4aO0gbb2BdoCG/PEqLvdYS48K0yaYpVQ/V8lu6sX7b
 gRBg+8gCG0a7DiNOBjOIsk0HJ3ddCTQdQ/r0HiuS/xqXStQJ17C1exSma4zNgWeE
 uh8JO4jt1xFtuPQrImHI5ujzgKeQtv+mzu/rSVhdVR+7dp/pcuPMhcy1FtAaWypg
 FeD0ksSST0YjsE0MQi326ALy5ZIqrfhTM18zLV29Xl6YAAibVXXWfyrjB280Ykaf
 LhXEmctB3/Zl+5XqNDPpASlG2LS+V3P3iry9xGz9AZgKIug+RW0ZNEQGlWAV046u
 KgJiR5msszalI/ECLZY6K8hZOXunhmP6MkL99IQ5s5Jwc7gpnPtjNw5edwUFiVm/
 1wYf2mZOObyfh4+2iPYRfk91PrTwuyqKQCwaf5o97wy7W8b5+Kcbto7OPbpm2xQ5
 7Yat+PmfeyWhY4cRbxvF
 =Qg2Y
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150930' into staging

migration/next for 20150930

# gpg: Signature made Wed 30 Sep 2015 09:24:02 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20150930:
  migration: Disambiguate MAX_THROTTLE
  qmp/hmp: Add throttle ratio to query-migrate and info migrate
  migration: Dynamic cpu throttling for auto-converge
  migration: Parameters for auto-converge cpu throttling
  cpu: Provide vcpu throttling interface
  migration: yet more possible state transitions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-10-01 10:49:38 +01:00
Paolo Bonzini 86abac06c1 linux-user: assert that target_mprotect cannot fail
All error conditions that target_mprotect checks are also checked
by target_mmap.  EACCESS cannot happen because we are just removing
PROT_WRITE.  ENOMEM should not happen because we are modifying a
whole VMA (and we have bigger problems anyway if it happens).

Fixes a Coverity false positive, where Coverity complains about
target_mprotect's return value being passed to tb_invalidate_phys_range.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-10-01 11:43:42 +03:00
Chen Gang d0924a26d8 linux-user/signal.c: Use setup_rt_frame() instead of setup_frame() for target openrisc
qemu has already considered about some targets may have no traditional
signals. And openrisc's setup_frame() is dummy, but it can be supported
by setup_rt_frame().

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-10-01 11:13:55 +03:00
Jason J. Herne dc3256272c migration: Disambiguate MAX_THROTTLE
Migration has a define for MAX_THROTTLE. Update comment to clarify that this is
used for throttling transfer speed. Hopefully this will prevent it from being
confused with a guest cpu throttling entity.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Jason J. Herne 4782893e09 qmp/hmp: Add throttle ratio to query-migrate and info migrate
Report throttle percentage in info migrate and query-migrate responses when
cpu throttling is active.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Jason J. Herne 070afca258 migration: Dynamic cpu throttling for auto-converge
Remove traditional auto-converge static 30ms throttling code and replace it
with a dynamic throttling algorithm.

Additionally, be more aggressive when deciding when to start throttling.
Previously we waited until four unproductive memory passes. Now we begin
throttling after only two unproductive memory passes. Four seemed quite
arbitrary and only waiting for two passes allows us to complete the migration
faster.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Jason J. Herne 1626fee3bd migration: Parameters for auto-converge cpu throttling
Add migration parameters to allow the user to adjust the parameters
that control cpu throttling when auto-converge is in effect. The added
parameters are as follows:

x-cpu-throttle-initial : Initial percantage of time guest cpus are throttled
when migration auto-converge is activated.

x-cpu-throttle-increment: throttle percantage increase each time
auto-converge detects that migration is not making progress.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Jason J. Herne 2adcc85d40 cpu: Provide vcpu throttling interface
Provide a method to throttle guest cpu execution. CPUState is augmented with
timeout controls and throttle start/stop functions. To throttle the guest cpu
the caller simply has to call the throttle set function and provide a percentage
of throttle time.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Juan Quintela 2a6e6e59df migration: yet more possible state transitions
On destination, we move from INMIGRATE to FINISH_MIGRATE.  Add that to
the list of allowed states.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2015-09-30 09:42:04 +02:00
Peter Maydell b2312c6800 Migration queue
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWCiwjAAoJEB6aO1+FQIO2bekQAIBudvPAajQcVNj8qQdKPiW6
 HzPqDHCsy2viyJdxPl1itXYso1lU6cQikx7o/gpzLeCmqYU7xWK747kkmGvUt0fa
 P210hFb+0GXQ1k4xOw0QxcDbaVISVqMQQLajxL5KR+Ktx6sg/byAFdT3Z6ACuHem
 jnupERCw6bkOeI236P9ajjZXQ0EHFFIL28wdxfUOJ3i+qHHxy3t/3NmO1Rhl0prL
 hH2ZS2SaPshpCrY2WiABDfzt1uZapgyhebgesCtzbHrMmOsz3m3g7sz/vleAlg/l
 KykPo+qHvc8simnmKXvk656fWr0FD/Qm5EXobQBfRVJA67gmPjUV/LH8zxqz98Xw
 Vi0kYBBvxLTmpzxdVCjlDNaNTpnRt18sw9SaFzh5+ySx/90qsM5y4dcXVkc508vt
 ipTVlQcr+QfGcg/VSVBvkrgiIIx9yEJ7We9sAWIrD6sBcCREpAjiDU0fY0ESNcXa
 mfpp8cPSjtsPNmvkg/pcQdj421RiuvS5STL8t97jNo7yGFO/b2ndUp2pKB3o+tkp
 UPtC+r/qbhnBKeOv86jnSH1futSdIsriC3/6CWpccGiMWKkJ1ATx1xE9QX7KiYcj
 6G16l1TIJMjckdAExSjBVGiAA3v4bJK9vo8WP/idL4YnNVeZB7efdpWHc+jnXVgp
 WjK3Ll/rfvDlbmprQ2EL
 =01Wd
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/amit-migration/tags/for-juan-201509' into staging

Migration queue

# gpg: Signature made Tue 29 Sep 2015 07:13:55 BST using RSA key ID 854083B6
# gpg: Good signature from "Amit Shah <amit@amitshah.net>"
# gpg:                 aka "Amit Shah <amit@kernel.org>"
# gpg:                 aka "Amit Shah <amitshah@gmx.net>"

* remotes/amit-migration/tags/for-juan-201509:
  ram_find_and_save_block: Split out the finding
  Move dirty page search state into separate structure
  migration: Use g_new() & friends where that makes obvious sense
  migration: qemu-file more size_t'ifying
  migration: size_t'ify some of qemu-file
  Init page sizes in qtest
  Split out end of migration code from migration_thread
  migration/ram.c: Use RAMBlock rather than MemoryRegion
  vmstate: Remove redefinition of VMSTATE_UINT32_ARRAY

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-29 12:41:19 +01:00
Dr. David Alan Gilbert b9e6092814 ram_find_and_save_block: Split out the finding
Split out the finding of the dirty page and all the wrap detection
into a separate function since it was getting a bit hairy.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1443018431-11170-3-git-send-email-dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>

[Fix comment -- Amit]
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:38:29 +05:30
Dr. David Alan Gilbert b8fb8cb748 Move dirty page search state into separate structure
Pull the search state for one iteration of the dirty page
search into a structure.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-Id: <1443018431-11170-2-git-send-email-dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:37:07 +05:30
Markus Armbruster 97f3ad3551 migration: Use g_new() & friends where that makes obvious sense
g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1442231491-23352-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:36:35 +05:30
Dr. David Alan Gilbert 56f3835ff1 migration: qemu-file more size_t'ifying
This time convert the external functions:
  qemu_get_buffer, qemu_peek_buffer
  qemu_put_buffer and qemu_put_buffer_async

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1439463094-5394-6-git-send-email-dgilbert@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:33:02 +05:30
Dr. David Alan Gilbert a202a4c001 migration: size_t'ify some of qemu-file
This is a start on using size_t more in qemu-file and friends;
it fixes up QEMUFilePutBufferFunc and QEMUFileGetBufferFunc
to take size_t lengths and return ssize_t return values (like read(2))
and fixes up all the different implementations of them.

Note that I've not yet followed this deeply into bdrv_ implementations.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1439463094-5394-5-git-send-email-dgilbert@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:33:02 +05:30
Dr. David Alan Gilbert c50766f5a9 Init page sizes in qtest
One of my patches used a loop that was based on host page size;
it dies in qtest since qtest hadn't bothered init'ing it.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-Id: <1439463094-5394-4-git-send-email-dgilbert@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:33:02 +05:30
Dr. David Alan Gilbert 09f6c85e39 Split out end of migration code from migration_thread
The code that gets run at the end of the migration process
is getting large, and I'm about to add more for postcopy.
Split it into a separate function.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1439463094-5394-3-git-send-email-dgilbert@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:33:02 +05:30
Dr. David Alan Gilbert 2f68e39956 migration/ram.c: Use RAMBlock rather than MemoryRegion
RAM migration mainly works on RAMBlocks but in a few places
uses data from MemoryRegions to access the same information that's
already held in RAMBlocks; clean it up just to avoid the
MemoryRegion use.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1439463094-5394-2-git-send-email-dgilbert@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:33:02 +05:30
Soren Brinkmann eb5c936e81 vmstate: Remove redefinition of VMSTATE_UINT32_ARRAY
The macro is defined twice in identical ways.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Message-Id: <1439532987-16335-1-git-send-email-soren.brinkmann@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-09-29 11:32:45 +05:30
Chen Gang 08703b9f7b linux-user/syscall.c: Add EAGAIN to host_to_target_errno_table for
Under Alpha host, EAGAIN is redefined to 35, so it need be remapped too.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:57:54 +03:00
Laurent Vivier 0f0426f343 linux-user: add name_to_handle_at/open_by_handle_at
This patch allows to run example given by open_by_handle_at(2):

      The following shell session demonstrates the use of these two programs:

           $ echo 'Can you please think about it?' > cecilia.txt
           $ ./t_name_to_handle_at cecilia.txt > fh
           $ ./t_open_by_handle_at < fh
           open_by_handle_at: Operation not permitted
           $ sudo ./t_open_by_handle_at < fh      # Need CAP_SYS_ADMIN
           Read 31 bytes
           $ rm cecilia.txt

       Now  we delete and (quickly) re-create the file so that it has the same
       content and (by chance) the  same  inode.[...]

           $ stat --printf="%i\n" cecilia.txt     # Display inode number
           4072121
           $ rm cecilia.txt
           $ echo 'Can you please think about it?' > cecilia.txt
           $ stat --printf="%i\n" cecilia.txt     # Check inode number
           4072121
           $ sudo ./t_open_by_handle_at < fh
           open_by_handle_at: Stale NFS file handle

See the man page for source code.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:44:46 +03:00
Timothy E Baldwin 93b4eff80a linux-user: Return target error number in do_fork()
Whilst calls to do_fork() are wrapped in get_errno() this does not
translate return values.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:40:12 +03:00
Jonathan Neuschäfer ee1045877a linux-user: fix cmsg conversion in case of multiple headers
Currently, __target_cmsg_nxthdr compares a pointer derived from
target_cmsg against the msg_control field of target_msgh (through
subtraction).  This failed for me when emulating i386 code under x86_64,
because pointers in the host address space and pointers in the guest
address space were not the same.  This patch passes the initial value of
target_cmsg into __target_cmsg_nxthdr.

I found and fixed two more related bugs:
- __target_cmsg_nxthdr now returns the new cmsg pointer instead of the
  old one.
- tgt_space (in host_to_target_cmsg) doesn't count "sizeof (struct
  target_cmsghdr)" twice anymore.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:39:43 +03:00
Stefan Brüns 59baae9a62 linux-user: remove MAX_ARG_PAGES limit
Instead of creating a temporary copy for the whole environment and
the arguments, directly copy everything to the target stack.

For this to work, we have to change the order of stack creation and
copying the arguments.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:29:11 +03:00
Stefan Brüns 84646ee25b linux-user: remove unused image_info members
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-09-28 16:29:01 +03:00