Commit graph

49868 commits

Author SHA1 Message Date
Jan Beulich ff3b8b8f86 xen: fix quad word bufioreq handling
We should not consume the second slot if it didn't get written yet.
Normal writers - i.e. Xen - would not update write_pointer between the
two writes, but the page may get fiddled with by the guest itself, and
we're better off avoiding to enter an infinite loop in that case.

Reported-by: yanghongke <yanghongke@huawei.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-28 11:25:23 -08:00
Olaf Hering 7875efb9f6 xen_disk: split discard input to match internal representation
The guest sends discard requests as u64 sector/count pairs, but the
block layer operates internally with s64/s32 pairs. The conversion
leads to IO errors in the guest, the discard request is not processed.

  domU.cfg:
  'vdev=xvda, format=qcow2, backendtype=qdisk, target=/x.qcow2'
  domU:
  mkfs.ext4 -F /dev/xvda
  Discarding device blocks: failed - Input/output error

Fix this by splitting the request into chunks of BDRV_REQUEST_MAX_SECTORS.
Add input range checking to avoid overflow.

Fixes f313520 ("xen_disk: add discard support")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-23 10:47:48 -08:00
Stefan Hajnoczi 00227fefd2 Update version for v2.8.0-rc1 release
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 22:29:08 +00:00
Stefan Hajnoczi 01d7d15ce3 Xen 2016/11/22
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYNJFTAAoJEIlPj0hw4a6QeoQP/0EZQQCM2N0xUjiuaJ3tkl7I
 LSVQACtkSZ8ZHXilu30cmav9+HoyO1kE2lTeLAW9nkKAdiwhumVodBxBYYMbxL3m
 nVzccXnOzj1kJ3ObffZY/cIegiJEoDjJR/QqC6LmmyrV68KlYoaU9nD1GXoz/Moc
 ScOe6o/mOdbYfRP7CJITLzKQ3wu6eg6Azgks/jjoZ14Kjjl0kPPg2uiCew0m52Q6
 2/9d24db5QABVrokG6/7DNTy7/knOBug4dHIQhkgQuTY6US+97Ovw2xK5V5oUlsJ
 QaA5EF5Fz55Ifc1H4dpFytRVI6ljGqfpv9xPyn0M4eycVZL5fpuMA3l1g3wExNoo
 bI3YV/akIYNNBTmNcKZiS7xcAZF6IGkcpjhoSoTK0xAX2NVxA0kTX9Zw6A6q+YGI
 jk/lvm1NnHqZjhqe1LqhVX7kTIdNqxH9Eom/Y8yfIDwb3QKKSRPFu1ySQ/yGmQsR
 Dxk/IxLN8b3BkxvhaTr7K9F+3DUwa8c+9JmVg4ejVoIh/B+20SQGjSjAmQhWNa8g
 eHJHx498dgReWkft30T/iB0PzcsbpUvz7057cTTB3qCbf9MoyQdaZvgxO+2xUUrm
 JuHhGd2beWH4O3O1Nx8GkhrAWW0027Gb2BBR4sDyGpC0zTivNw3cdar0UUITdI+E
 3DKBdrec0c2Y5E7PLvgJ
 =DmJS
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'sstabellini/tags/xen-20161122-tag' into staging

Xen 2016/11/22

# gpg: Signature made Tue 22 Nov 2016 06:41:23 PM GMT
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>"
# gpg:                 aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* sstabellini/tags/xen-20161122-tag:
  xen: attach pvusb usb bus to backend qdev
  xen: create qdev for each backend device
  qdev: add function qdev_set_id()
  xen: add an own bus for xen backend devices
  xen: fix ioreq handling

Message-id: alpine.DEB.2.10.1611221037010.21858@sstabellini-ThinkPad-X260
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 19:30:39 +00:00
Stefan Hajnoczi 76989f4ffa Block layer patches for 2.8.0-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYNGp6AAoJEH8JsnLIjy/WAgYP/isOOb1NF6OWQKkVHc6cipMd
 RElj5HQlFYP7FmdP4Z2QdNI82K12G/wnctGtREAqmUQqivpJoejsLHXo70Oik6EZ
 KIafgD/xD1zXw+DBTsJBZI5iE/VWRXcQ7l49OqtRTqYEF0V4chzJmlo8m4+TLHbq
 119b48GmjYy94a4xbgPBL3Yhude1tvkXR3VNfEQU7EzxpwTGZnH+egqdNvpMpvmY
 Ty400of4oq/eH25XtJ5pUESeLvUv13WTMsLMCmGBpliJx2R9nqN7ScgJW8z7/fkS
 z3RC49jroL1O1TIMXIY/EGzFoiGWFAdolVrnLyvzV2sFtynLcbKrM6XHXqUN6ITt
 rNPpjMX5cij8106kPNgwynpao4/n9abOx8RxtMBZvVVyWvJ/f6HD+gx9QFPseKXC
 ++l50aOkAu3oLh/KIrXcD/sLe5wCNnJRC5NjNjfi8Bi2Lxcwt8XHHYbGlyierDDW
 KDL98jshA3tlnC+hso7D5pnwNBt67zN4sOlBiqywZieFTJhwCvhWSUUfEXnIIIrl
 QV/Fu/y3ohTDiNpzJ4g0Zgb1UbTu+nccQiuaUHaUBIhgKjZR9oyAEsjdky47o67T
 qvB7wSsfXnURblncn303Q0BuZIGV60JTdxTXEdOp8X3dJy+mkvzH9zRagzWIk10Y
 FRatMVcTna8MsBJ1pYTy
 =1Mkm
 -----END PGP SIGNATURE-----

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

Block layer patches for 2.8.0-rc1

# gpg: Signature made Tue 22 Nov 2016 03:55:38 PM GMT
# 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

* kwolf/tags/for-upstream:
  block: Pass unaligned discard requests to drivers
  block: Return -ENOTSUP rather than assert on unaligned discards
  block: Let write zeroes fallback work even with small max_transfer
  qcow2: Inform block layer about discard boundaries

Message-id: 1479830693-26676-1-git-send-email-kwolf@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 19:30:03 +00:00
Stefan Hajnoczi 5167dff8c7 seabios: update to 1.10.1 stable release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYNAwHAAoJEEy22O7T6HE4b6kQAKF9QqZG0/hgTF8GjOMI9V9t
 ha7lTV/X5OhkqwI3w1LXM/3YsroXM6tgpPdu1qVJXZxLD0vqiEPuSbV0vgKeYtdK
 TckWoj+07zZvHjdsgSmw6zC77vOFvDI3J6zy2EgOhNNhY+nL6dp2HzdGyNvkFOro
 YfV5RaXLduykrmV/zfg5wuz87/5PDgu2ZTqmTixBjzVN3cNRJW8pn3PjW1WO1zDT
 swQzBYaKx+LHWwHoYC3kmMB4QQC3pNPvvy0QKMNEHD0Wa5biIKlXml8RcdDPVxmh
 jv9HV49rxL7YyEQ7C7Jkh02J5ImPI7l1YHT5wHbehdkDhXKfQusUysiMFlhYht64
 qxyknqn0FF1oKeYxh0bueJWe8+vuzlk5apgwNG3H74mHPh65/TSEAFF9SeEhmIMt
 Yc8zORuQUaUr/Qh5/2O4h1P16alp6SVhMAadQA3nXAo1sKD6U6VPlvm/DhVlz7Wn
 T5Eud6mPbBlA9VxaboFj1b4Ojvy800ySibwX/3HK8CxrOI0W/k0RHuSVM4fjHY9M
 8i2omx0eXoZwE0hZYQ9p+iOm8kg/u7jBrPZAUX8L4Fi56KJ0Gl1CQcROeO5rGuks
 cFOXY0xqkziPRjc5zhzx6XwafGldXZRAA1DIwp2mmyfOHQTgQKgBBQxunlMdzjYa
 i4VumSQL9o6pdUtj6314
 =bq9b
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'kraxel/tags/pull-seabios-20161122-1' into staging

seabios: update to 1.10.1 stable release

# gpg: Signature made Tue 22 Nov 2016 09:12:39 AM GMT
# 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

* kraxel/tags/pull-seabios-20161122-1:
  seabios: update to 1.10.1 stable release

Message-id: 1479806144-25599-1-git-send-email-kraxel@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 19:29:30 +00:00
Juergen Gross f1784a222e xen: attach pvusb usb bus to backend qdev
Attach the usb bus of a new pvusb controller to the qdev associated
with the Xen backend. Any device connected to that controller can now
specify the bus and port directly via its properties.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-22 10:29:41 -08:00
Juergen Gross 3a6c9172ac xen: create qdev for each backend device
Create a qdev plugged to the xen-sysbus for each new backend device.
This device can be used as a parent for all needed devices of that
backend. The id of the new device will be "xen-<type>-<dev>" with
<type> being the xen backend type (e.g. "qdisk") and <dev> the xen
backend number of the type under which it is to be found in xenstore.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-22 10:29:39 -08:00
Juergen Gross ce49b734b4 qdev: add function qdev_set_id()
In order to have an easy way to add a new qdev with a specific id
carve out the needed functionality from qdev_device_add() into a new
function qdev_set_id().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-22 10:29:37 -08:00
Juergen Gross 873d57abba xen: add an own bus for xen backend devices
Add a bus for Xen backend devices in order to be able to establish a
dedicated device path for pluggable devices.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-22 10:29:32 -08:00
Jan Beulich b85f9dfdb1 xen: fix ioreq handling
Avoid double fetches and bounds check size to avoid overflowing
internal variables.

This is CVE-2016-9381 / XSA-197.

Reported-by: yanghongke <yanghongke@huawei.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2016-11-22 10:29:22 -08:00
Eric Blake 3482b9bc41 block: Pass unaligned discard requests to drivers
Discard is advisory, so rounding the requests to alignment
boundaries is never semantically wrong from the data that
the guest sees.  But at least the Dell Equallogic iSCSI SANs
has an interesting property that its advertised discard
alignment is 15M, yet documents that discarding a sequence
of 1M slices will eventually result in the 15M page being
marked as discarded, and it is possible to observe which
pages have been discarded.

Between commits 9f1963b and b8d0a980, we converted the block
layer to a byte-based interface that ultimately ignores any
unaligned head or tail based on the driver's advertised
discard granularity, which means that qemu 2.7 refuses to
pass any discard request smaller than 15M down to the Dell
Equallogic hardware.  This is a slight regression in behavior
compared to earlier qemu, where a guest executing discards
in power-of-2 chunks used to be able to get every page
discarded, but is now left with various pages still allocated
because the guest requests did not align with the hardware's
15M pages.

Since the SCSI specification says nothing about a minimum
discard granularity, and only documents the preferred
alignment, it is best if the block layer gives the driver
every bit of information about discard requests, rather than
rounding it to alignment boundaries early.

Rework the block layer discard algorithm to mirror the write
zero algorithm: always peel off any unaligned head or tail
and manage that in isolation, then do the bulk of the request
on an aligned boundary.  The fallback when the driver returns
-ENOTSUP for an unaligned request is to silently ignore that
portion of the discard request; but for devices that can pass
the partial request all the way down to hardware, this can
result in the hardware coalescing requests and discarding
aligned pages after all.

Reported by: Peter Lieven <pl@kamp.de>
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-22 15:59:23 +01:00
Eric Blake 49228d1e95 block: Return -ENOTSUP rather than assert on unaligned discards
Right now, the block layer rounds discard requests, so that
individual drivers are able to assert that discard requests
will never be unaligned.  But there are some ISCSI devices
that track and coalesce multiple unaligned requests, turning it
into an actual discard if the requests eventually cover an
entire page, which implies that it is better to always pass
discard requests as low down the stack as possible.

In isolation, this patch has no semantic effect, since the
block layer currently never passes an unaligned request through.
But the block layer already has code that silently ignores
drivers that return -ENOTSUP for a discard request that cannot
be honored (as well as drivers that return 0 even when nothing
was done).  But the next patch will update the block layer to
fragment discard requests, so that clients are guaranteed that
they are either dealing with an unaligned head or tail, or an
aligned core, making it similar to the block layer semantics of
write zero fragmentation.

CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-22 15:59:22 +01:00
Eric Blake b2f95feec5 block: Let write zeroes fallback work even with small max_transfer
Commit 443668ca rewrote the write_zeroes logic to guarantee that
an unaligned request never crosses a cluster boundary.  But
in the rewrite, the new code assumed that at most one iteration
would be needed to get to an alignment boundary.

However, it is easy to trigger an assertion failure: the Linux
kernel limits loopback devices to advertise a max_transfer of
only 64k.  Any operation that requires falling back to writes
rather than more efficient zeroing must obey max_transfer during
that fallback, which means an unaligned head may require multiple
iterations of the write fallbacks before reaching the aligned
boundaries, when layering a format with clusters larger than 64k
atop the protocol of file access to a loopback device.

Test case:

$ qemu-img create -f qcow2 -o cluster_size=1M file 10M
$ losetup /dev/loop2 /path/to/file
$ qemu-io -f qcow2 /dev/loop2
qemu-io> w 7m 1k
qemu-io> w -z 8003584 2093056

In fairness to Denis (as the original listed author of the culprit
commit), the faulty logic for at most one iteration is probably all
my fault in reworking his idea.  But the solution is to restore what
was in place prior to that commit: when dealing with an unaligned
head or tail, iterate as many times as necessary while fragmenting
the operation at max_transfer boundaries.

Reported-by: Ed Swierk <eswierk@skyportsystems.com>
CC: qemu-stable@nongnu.org
CC: Denis V. Lunev <den@openvz.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-22 15:59:22 +01:00
Eric Blake ecdbead659 qcow2: Inform block layer about discard boundaries
At the qcow2 layer, discard is only possible on a per-cluster
basis; at the moment, qcow2 silently rounds any unaligned
requests to this granularity.  However, an upcoming patch will
fix a regression in the block layer ignoring too much of an
unaligned discard request, by changing the block layer to
break up a discard request at alignment boundaries; for that
to work, the block layer must know about our limits.

However, we can't go one step further by changing
qcow2_discard_clusters() to assert that requests are always
aligned, since that helper function is reached on paths
outside of the block layer.

CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-22 15:59:22 +01:00
Ed Maste a7764f1548 Fix FreeBSD (10.x) build after 7dc9ae43
Include sys/user.h for declaration of 'struct kinfo_proc'.
Add -lutil to qemu-ga link for kinfo_getproc.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Message-id: 1479778365-11315-1-git-send-email-emaste@freebsd.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 10:56:01 +00:00
Stefan Hajnoczi 06bf33cfe7 -----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJYM3FbAAoJEL2+eyfA3jBXMTQP/1H8ifACMq+09fAyCR9IfXkm
 oT9HMIrb+iGhckW/z6R0tTfjETvUOg+1cRKPAKi7YUrdYMkyZLhcmAxxpIqtHXeT
 rNqr38fYGYCK3ZL62gRfQx1rhPoNGKmh3Sv0DMi38FExF2r4pt6O6HTO3v8mJUHM
 BG8inzATzJEuZ2gKDpO8i/cRIROwCaZCM3l9vakMKiANV6x+qi57/m7XeMU1tb8u
 u9QSLzS4gy371wf3NSma09hRFIOBMydNfO0eO3mTy2YOU1rn4JKIbe97jBNnxO8m
 TT5NYNZhfuICSw93VdO4LdQ9Rh8BI2WShaw9q92sBLNXd0wbJDgfacwrVbxrvnOb
 zWM35X1/GwVkbNmlHoQI1VlQ2cDQMQCEUpNz9Aj5aafLbwWeIzm3acyMKwpci7xq
 lanXio7MGLwMjqXUoTIv8g3rEq5f6v3aPZt4HrqYyKtKXgfJw/mvqaemzMj2+8aZ
 YzPCEEfn4L/f1SM/1iDNrgARyzgETsakedeLPL2PdqrCCTj4XgAB9xaJO5auLaQd
 GtnPlTXcjktZk1srgLfXvEBAqw19MJW/Oi4opVvu5ao1AYpX2iDmk1DglRJ+eTGj
 uNMi7wEmUPG9cNos/i43549NOlcJCY7iCUQ844yTbsTBAmCiju2Q4HSM9/pF3Im7
 nCP0RDL3WKa3xI4PoN3c
 =vgtW
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Mon 21 Nov 2016 10:12:43 PM GMT
# gpg:                using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* jtc/tags/block-pull-request:
  gluster: Fix use after free in glfs_clear_preopened()

Message-id: 1479766499-29972-1-git-send-email-jcody@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-22 10:54:40 +00:00
Gerd Hoffmann cae41fda0f seabios: update to 1.10.1 stable release
git shortlog rel-1.10.0..rel-1.10.1
===================================

Igor Mammedov (1):
      drop "etc/boot-cpus" fw_cfg file and reuse legacy QEMU_CFG_NB_CPUS

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-22 10:12:08 +01:00
Kevin Wolf 668c0e441d gluster: Fix use after free in glfs_clear_preopened()
This fixes a use-after-free bug introduced in commit 6349c154. We need
to use QLIST_FOREACH_SAFE() when freeing elements in the loop. Spotted
by Coverity.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1479378608-11962-1-git-send-email-kwolf@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
2016-11-21 17:04:43 -05:00
Stefan Hajnoczi ab9125c021 Xen 2016/11/08
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYIiv8AAoJEIlPj0hw4a6QT3gP/RvYaenyZ1imbrGl9RMGw0Ev
 1nej+tGhR1szBs19+P8X7cY8TeuaxVxeiGMhP3aZZ4VDOXJY0gSVzVk3wwMYfJBu
 DEwaHaWkIEqPpobY+Vs/KvKgE7wo8e8KSYwD27ngngJHSxqcGmrPzn7k1DaPrm9N
 fmo8yNngbcNBWxpcritJUX5PtnA0CNvV5kizq0KParNuc2B6f3Xt7N9ubsJNhAoe
 8e25SVZlfurSQSVnstOuh8xbKXIGl2IJuZcfPqNKxydjd1Ob+EfrofZaTIN57BpP
 UyyD5vOFj3BzXm1+mQIk5alJ0d3zKMaRpIAHwHkn5yhdZ2X6N7SAtHTZBnjuI55K
 xFHYZWe7HTJ2w/w/MzWMufmNOUGCCxGiR8uXfSXnP4/2ujz88xNqolzEjORbefU0
 deNePztu/h1lClGH1P7O/a7b15fxCLeqDLsKqWoMPjP0AmWQmTgIuOc/rb++yKID
 S11oZBTn9Tv1Uz3C1xD3RYsh0dwT91pkw1OI+oJaDOGjbLVuR1a9Zm8paBoM+zEh
 pdnohr4EkVZvGhd5bzzhvRKYSuYlxtWrYdt5in0k5UUSLvHj4CrfDF8DHJ/ySLuG
 h7JHb5dWnrKRqE4wH4Edy8ody1u4W1iECERTkpPCwteqgR8IHE3IF6jDYqV3D20b
 x0oH9LiF4SpHRtoGcOBl
 =2Fud
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'sstabellini/tags/xen-20161108-tag' into staging

Xen 2016/11/08

# gpg: Signature made Tue 08 Nov 2016 07:48:12 PM GMT
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>"
# gpg:                 aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* sstabellini/tags/xen-20161108-tag:
  xen: Fix xenpv machine initialisation

Message-id: alpine.DEB.2.10.1611081150170.3491@sstabellini-ThinkPad-X260
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-21 15:29:55 +00:00
Stefan Hajnoczi c36ed06e91 virtio, vhost, pc: fixes
Most notably this fixes a regression with vhost introduced by the pull before
 last.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYLyObAAoJECgfDbjSjVRptPoIAK/4SdEAqS9pnXPekPZpIddV
 KHCFjj4Q68s22i0jpA1hxSXk1yQZIl56dnynU0DIAbCD1NYQIEmWx7uOJjppre9O
 L64V2s2ItEagFBGFwQDoJnUDIyEhth8KRqsa36V2YWJXYOaH1Rx1QNb9tX9R0aeb
 2lVwYE+yig1Gc/2PAYJrcKWwM3iwWrYW6ssycP2LEOGOhBCIrGZwDJkqv7ayDVL9
 j4tH2eBRrOAzm8c3fybC3OZkeLqcQJnbVONmD8kV0Q0IphcFvloJQCvcefb/3Ox1
 HAz57JxZfpxMZPVtvgU8Q+xzElz8noCXg+6lF/dx71CKicwXxg4lsMF1LyKHUoU=
 =cuAn
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'mst/tags/for_upstream' into staging

virtio, vhost, pc: fixes

Most notably this fixes a regression with vhost introduced by the pull before
last.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Fri 18 Nov 2016 03:51:55 PM GMT
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* mst/tags/for_upstream:
  acpi: Use apic_id_limit when calculating legacy ACPI table size
  ipmi: fix qemu crash while migrating with ipmi
  ivshmem: Fix 64 bit memory bar configuration
  virtio: set ISR on dataplane notifications
  virtio: access ISR atomically
  virtio: introduce grab/release_ioeventfd to fix vhost
  virtio-crypto: fix virtio_queue_set_notification() race

Message-id: 1479484366-7977-1-git-send-email-mst@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-21 11:09:58 +00:00
Eduardo Habkost 4b5b47abbf acpi: Use apic_id_limit when calculating legacy ACPI table size
The code that calculates the legacy ACPI table size for migration
compatibility uses max_cpus when calculating legacy_aml_len (the size of
the DSDT and SSDT tables). However, the SSDT grows according to APIC ID
limit, not max_cpus.

The bug is not triggered very often because of the 4k alignment on the
table size. But it can be triggered if you are unlucky enough to cross a
4k boundary.

Change the legacy_aml_len calculation to use apic_id_limit, to calculate
the right size.

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>
2016-11-18 17:50:09 +02:00
ZhuangYanying d668fc4c7c ipmi: fix qemu crash while migrating with ipmi
Qemu crash in the source side while migrating, after starting ipmi service inside vm.

./x86_64-softmmu/qemu-system-x86_64 --enable-kvm -smp 4 -m 4096 \
-drive file=/work/suse/suse11_sp3_64_vt,format=raw,if=none,id=drive-virtio-disk0,cache=none \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
-vnc :99 -monitor vc -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-kcs,bmc=bmc0,ioport=0xca2

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffec4268700 (LWP 7657)]
__memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2757
(gdb) bt
 #0  __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2757
 #1  0x00005555559ef775 in memcpy (__len=3, __src=0xc1421c, __dest=<optimized out>)
     at /usr/include/bits/string3.h:51
 #2  qemu_put_buffer (f=0x555557a97690, buf=0xc1421c <Address 0xc1421c out of bounds>, size=3)
     at migration/qemu-file.c:346
 #3  0x00005555559eef66 in vmstate_save_state (f=f@entry=0x555557a97690,
     vmsd=0x555555f8a5a0 <vmstate_ISAIPMIKCSDevice>, opaque=0x555557231160,
     vmdesc=vmdesc@entry=0x55555798cc40) at migration/vmstate.c:333
 #4  0x00005555557cfe45 in vmstate_save (f=f@entry=0x555557a97690, se=se@entry=0x555557231de0,
     vmdesc=vmdesc@entry=0x55555798cc40) at /mnt/sdb/zyy/qemu/migration/savevm.c:720
 #5  0x00005555557d2be7 in qemu_savevm_state_complete_precopy (f=0x555557a97690,
     iterable_only=iterable_only@entry=false) at /mnt/sdb/zyy/qemu/migration/savevm.c:1128
 #6  0x00005555559ea102 in migration_completion (start_time=<synthetic pointer>,
     old_vm_running=<synthetic pointer>, current_active_state=<optimized out>,
     s=0x5555560eaa80 <current_migration.44078>) at migration/migration.c:1707
 #7  migration_thread (opaque=0x5555560eaa80 <current_migration.44078>) at migration/migration.c:1855
 #8  0x00007ffff3900dc5 in start_thread (arg=0x7ffec4268700) at pthread_create.c:308
 #9  0x00007fffefc6c71d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-18 17:50:09 +02:00
Zhuang Yanying be4e0d7375 ivshmem: Fix 64 bit memory bar configuration
Device ivshmem property use64=0 is designed to make the device
expose a 32 bit shared memory BAR instead of 64 bit one.  The
default is a 64 bit BAR, except pc-1.2 and older retain a 32 bit
BAR.  A 32 bit BAR can support only up to 1 GiB of shared memory.

This worked as designed until commit 5400c02 accidentally flipped
its sense: since then, we misinterpret use64=0 as use64=1 and vice
versa.  Worse, the default got flipped as well.  Devices
ivshmem-plain and ivshmem-doorbell are not affected.

Fix by restoring the test of IVShmemState member not_legacy_32bit
that got messed up in commit 5400c02.  Also update its
initialization for devices ivhsmem-plain and ivshmem-doorbell.
Without that, they'd regress to 32 bit BARs.

Cc: qemu-stable@nongnu.org
Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2016-11-18 17:29:34 +02:00
Paolo Bonzini 83d768b564 virtio: set ISR on dataplane notifications
Dataplane has been omitting forever the step of setting ISR when
an interrupt is raised.  This caused little breakage, because the
specification actually says that ISR may not be updated in MSI mode.

Some versions of the Windows drivers however didn't clear MSI mode
correctly, and proceeded using polling mode (using ISR, not the used
ring index!) for crashdump and hibernation.  If it were just crashdump
and hibernation it would not be a big deal, but recent releases of
Windows do not really shut down, but rather log out and hibernate to
make the next startup faster.  Hence, this manifested as a more serious
hang during shutdown with e.g. Windows 8.1 and virtio-win 1.8.0 RPMs.
Newer versions fixed this, while older versions do not use MSI at all.

The failure has always been there for virtio dataplane, but it became
visible after commits 9ffe337 ("virtio-blk: always use dataplane path
if ioeventfd is active", 2016-10-30) and ad07cd6 ("virtio-scsi: always
use dataplane path if ioeventfd is active", 2016-10-30) made virtio-blk
and virtio-scsi always use the dataplane code under KVM.  The good news
therefore is that it was not a bug in the patches---they were doing
exactly what they were meant for, i.e. shake out remaining dataplane bugs.

The fix is not hard, so it's worth arranging for the broken drivers.
The virtio_should_notify+event_notifier_set pair that is common to
virtio-blk and virtio-scsi dataplane is replaced with a new public
function virtio_notify_irqfd that also sets ISR.  The irqfd emulation
code now need not set ISR anymore, so virtio_irq is removed.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
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>
2016-11-18 17:29:25 +02:00
Paolo Bonzini 0687c37c5e virtio: access ISR atomically
This will be needed once dataplane will be able to set it outside
the big QEMU lock.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
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>
2016-11-18 17:29:25 +02:00
Paolo Bonzini 310837de6c virtio: introduce grab/release_ioeventfd to fix vhost
Following the recent refactoring of virtio notifiers [1], more specifically
the patch ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to
start/stop ioeventfd") that uses virtio_bus_set_host_notifier [2]
by default, core virtio code requires 'ioeventfd_started' to be set
to true/false when the host notifiers are configured.

When vhost is stopped and started, however, there is a stop followed by
another start. Since ioeventfd_started was never set to true, the 'stop'
operation triggered by virtio_bus_set_host_notifier() will not result
in a call to virtio_pci_ioeventfd_assign(assign=false). This leaves
the memory regions with stale notifiers and results on the next start
triggering the following assertion:

  kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
  Aborted

This patch reintroduces (hopefully in a cleaner way) the concept
that was present with ioeventfd_disabled before the refactoring.
When ioeventfd_grabbed>0, ioeventfd_started tracks whether ioeventfd
should be enabled or not, but ioeventfd is actually not started at
all until vhost releases the host notifiers.

[1] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07748.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07760.html

Reported-by: Felipe Franciosi <felipe@nutanix.com>
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Fixes: ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to start/stop ioeventfd")
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
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>
2016-11-18 17:29:25 +02:00
Stefan Hajnoczi d93b1fb009 -----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJYLxfCAAoJEJykq7OBq3PIyYAH/2b6cf08NatPvq40D09eGsZg
 3//k8ydh0KtNIKd3a73v8e3guN3kth6b6+Qz1h1YAiyfEuWlTUN/DDW44pXqTj5o
 wOq9O1/lAISUHqAiViA+hv9mpVagIfriif9+Wzy6J1dbovibD4ugoL4M2cHRc9pH
 v+W0+I1MlWn+C2eLMZ0zTjVfYaQyKBET2s2FHcLy5T8W3TEF1kmx/34Z20ed8VNY
 /rcqkx2yWG1pp0tSmsjS1mPy7SBHsV0QJXKiNXiVHZWyRj17YCWKUKbv5h97+gsa
 sG1rLM+LxBsKzHfsPlI4P1CzJIKlbiuYH7LK0+fdiDRDvCkjTbgJ4aexjbxTWHE=
 =ooMG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'public/tags/tracing-pull-request' into staging

# gpg: Signature made Fri 18 Nov 2016 03:01:22 PM GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* public/tags/tracing-pull-request:
  trace: fix generated code build break

Message-id: 1479481289-2479-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-18 15:24:26 +00:00
Stefan Hajnoczi 600f5ce356 virtio-crypto: fix virtio_queue_set_notification() race
We must check for new virtqueue buffers after re-enabling notifications.
This prevents the race condition where the guest added buffers just
after we stopped popping the virtqueue but before we re-enabled
notifications.

I think the virtio-crypto code was based on virtio-net but this crucial
detail was missed.  virtio-net does not have the race condition because
it processes the virtqueue one more time after re-enabling
notifications.

Cc: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
2016-11-18 17:14:10 +02:00
Stefan Hajnoczi ad538782d7 -----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJYLcu7AAoJENro4Ql1lpzl5D8P/0Mkfa9BzTGTBfE5bF4Z0kH+
 0i+5Nw95NeiOWsW35DL2I5uIdeJpQ8Iwu22r/rfjV2PKJlO+/NgGZq59vp0Xk+vJ
 BcGi/sSTyTJUXtxJdqzZ0wDoKRt3qjCjg4wLjJN+BsPWBGlbDrSyQer21qgKT6mZ
 dPDTSpngX5isp/dM7AsZu74iGsPIlDxDXwR3M5st/6zHkhnZLUWVyT2TXqhJ4zwp
 W+iM2yhkOp5zXnv69gnLuTyG5WLR+xd7fo4MIzfCen/APOIYmuIJBHmrIrzGlOmc
 ftCEj1kSYJMadWIlm5XzmPry8rXNFkQzx1D6k8d5shk3ZD0vCpZTz0sGn7HsLRoy
 oDadNLdrDeCv6idISrvDqmHE6XmDrZ0Qk33Pl/r1LPBVLPLBavWA/TUuP4Kpem/f
 UTPnezVKuCf3pYCW2t4e8O1AHSyTMr2RtzYoiSNDcbP93xG77MSo6izfGSkIlRlM
 gsuD+NxXKvUVAH7qSYerYriK7DxIgkRiJnQboVPYxiF2wi/jgJn1TvONynfdrO/L
 +kCuslJUqBKwZZYul8v/Lz8xdbentSAJwdoeebYzpnt64MAVbf4A3g7BX57O8L5j
 G0Fg2USfCHuiWxeI3MMu6ZLhksfPWZtEclVaAxKTOMrtByvkhwFQJjo8N2jBWeXo
 BXfkz+X/VyZA3z8V+e9U
 =EZeB
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/elmarco/tags/ivshmem-pull-request' into staging

* remotes/elmarco/tags/ivshmem-pull-request:
  ivshmem: Fix 64 bit memory bar configuration

Message-id: 20161117152613.18578-1-marcandre.lureau@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-18 14:58:48 +00:00
Stefan Hajnoczi e7830f8961 Update alpha palcode for smp
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYLcVZAAoJEK0ScMxN0CebCrwIAJowWUot48Vt96UH0Nm2+Qd9
 ORx5LL22Qv8J0OP7ljSMN2X2UtF/zQl22FN/Cpr9zoQ7h1Nt4tcqwVicG1c0byM8
 lfHgiwsRVqQ9CqTb0ZuNyqTF8wVlAWTEmxN7Oy3kfgjAlj524GSa+4gcFtexIEic
 JaWq42oMQgmKvEu1eYYN0Chg2T9Ayh1pUbDsxr01Rht/p+wkYLKTAMKEmd02td8C
 To2F0RsGyIvhdFWG7UuaolzcrCf3kpvl30wCx8w7VEDI3DV0xFRofleF3EH/78UZ
 SXsLUulYAxRUotyhxPJuuLAlGaRh2jHGs1GbrSkX7J/G7QfiQiz3PtsGFMIg72U=
 =nLFp
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'rth/tags/pull-axp-20161117' into staging

Update alpha palcode for smp

# gpg: Signature made Thu 17 Nov 2016 02:57:29 PM GMT
# gpg:                using RSA key 0xAD1270CC4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"
# Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC  16A4 AD12 70CC 4DD0 279B

* rth/tags/pull-axp-20161117:
  target-alpha: Log cpuid with -d int
  target-alpha: Update palcode for smp

Message-id: 1479394965-11254-1-git-send-email-rth@twiddle.net
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-18 14:49:02 +00:00
Greg Kurz d4f7ca5901 trace: fix generated code build break
If the QEMU source dir is

    /var/tmp/aaa-qemu-clone

and the build dir is

    /var/tmp/qemu-aio-poll-v2

Then I get an error as:

trace/generated-tracers.c:15950:13: error: invalid suffix "_trace_events"
 on integer constant
 TraceEvent *2_trace_events[] = {
             ^
trace/generated-tracers.c:15950:13: error: expected identifier or ‘(’ before
 numeric constant
trace/generated-tracers.c: In function ‘trace_2_register_events’:
trace/generated-tracers.c:17949:32: error: invalid suffix "_trace_events" on
 integer constant
     trace_event_register_group(2_trace_events);
                                ^
make: *** [trace/generated-tracers.o] Error 1

This patch fixes the issue.

Reported-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Tested-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-18 11:09:58 +00:00
Stefan Hajnoczi 363effe28b -----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJYLYQSAAoJEPMMOL0/L748ogsP/2e1fZBsm6TTfGtVnT0KvyEi
 vqWvWRQoXMHVWpjGTFyjMSp0c9ogQTmqLp77znlOyO/veKsjamow/UUksiRVnHSu
 aWvP9H+9rB2bLSWSaQvHyD8BMsCq0rfnhPq+wyRUPmR33X6/jlDwWHxRPXdnEApl
 rgzqvOgivfjk0KJjY4iwoOnBYtyEzVB/WgZD6ssK9DKeU2Vxg+NCk8im9N58Qpv8
 ffUypDQ7FiS+wmLtazp0Iks7AFSTkGsdtJ/bMJOqkj2CLUwdx5sP1KLMnwKfsPK6
 mfvXaXnd2x2Q11EgQv8CWJS8GtiNHW9hTvgKM3p5xB0yV5/bXIk/tGETYIgEkOWC
 gRMZFaG/U8ztyWUZ7W7P0s/YHbZx1/OsGubB6Z3eEHa/WLAB0aoCHGESGFb0KqsD
 EjMY1fe9c4pSE0MtGD+Byy3WMkn+Iki9Ewc2KLjR0v9IRT3+LgIto087aONMN6AS
 KOle/l32OEX+UIgvLn5Xh5adyhcI0m0elVPFfdwsv/XIjIx6jSePKJ8uShs5p3oO
 HHMEEmEtudxw0bEa3XboVVvGNQAA364/BPCULAoVEYiDnB1scS1z9YQNm0NpCC/p
 wQKVPVV29u5Y+1KFxqf0laOqkVtVluRlbADrQcktfneHkFz96/U38U7QU62ZtXh1
 /28TbRGeBetMRDQ9xz4c
 =GHnD
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'vivier/tags/trivial-patches-pull-request' into staging

# gpg: Signature made Thu 17 Nov 2016 10:18:58 AM GMT
# gpg:                using RSA key 0xF30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* vivier/tags/trivial-patches-pull-request:
  qapi-schema: clarify 'colo' state for MigrationStatus

Message-id: 1479378016-19022-1-git-send-email-laurent@vivier.eu
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-18 11:05:48 +00:00
Richard Henderson 022f52e040 target-alpha: Log cpuid with -d int
Signed-off-by: Richard Henderson <rth@twiddle.net>
2016-11-17 15:56:31 +01:00
Richard Henderson dfbd2768b2 target-alpha: Update palcode for smp
Signed-off-by: Richard Henderson <rth@twiddle.net>
2016-11-17 15:56:31 +01:00
Zhuang Yanying b2b79a6960 ivshmem: Fix 64 bit memory bar configuration
Device ivshmem property use64=0 is designed to make the device
expose a 32 bit shared memory BAR instead of 64 bit one.  The
default is a 64 bit BAR, except pc-1.2 and older retain a 32 bit
BAR.  A 32 bit BAR can support only up to 1 GiB of shared memory.

This worked as designed until commit 5400c02 accidentally flipped
its sense: since then, we misinterpret use64=0 as use64=1 and vice
versa.  Worse, the default got flipped as well.  Devices
ivshmem-plain and ivshmem-doorbell are not affected.

Fix by restoring the test of IVShmemState member not_legacy_32bit
that got messed up in commit 5400c02.  Also update its
initialization for devices ivhsmem-plain and ivshmem-doorbell.
Without that, they'd regress to 32 bit BARs.

Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1479385863-7648-1-git-send-email-ann.zhuangyanying@huawei.com>
2016-11-17 18:39:59 +04:00
zhanghailiang 252093a726 qapi-schema: clarify 'colo' state for MigrationStatus
VM can not get into colo state unless users enable 'x-colo'
capability for migration, Here it is necessary to clarify
this.

Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Message-Id: <1478072652-9884-1-git-send-email-zhang.zhanghailiang@huawei.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2016-11-17 08:52:47 +01:00
Igor Mammedov e3cadac073 pc: fix FW_CFG_NB_CPUS to account for -device added CPUs
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1479301481-197333-1-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2016-11-16 12:10:00 -02:00
Igor Mammedov 5836d16812 fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1()
PC will use this field in other way, so move it outside the common
code so PC could set a different value, i.e. all CPUs
regardless of where they are coming from (-smp X | -device cpu...).

It's quick and dirty hack as it could be implemented in more generic
way in MashineClass. But do it in simple way since only PC is affected
so far.

Later we can generalize it when another affected target gets support
for -device cpu.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1479212236-183810-3-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2016-11-16 12:09:58 -02:00
Igor Mammedov eabff15820 Revert "pc: Add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs"
This reverts commit 080ac219cc.

Legacy FW_CFG_NB_CPUS will be reused instead of 'etc/boot-cpus'
fw_cfg file since it does the same and there is no point
to maintaing duplicate guest ABI, if it can be helped.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1479212236-183810-2-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2016-11-16 12:09:53 -02:00
Stefan Hajnoczi b0bcc86d2a Update version for v2.8.0-rc0 release
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-15 20:55:12 +00:00
Stefan Hajnoczi 51f492e5da virtio, vhost, pc, pci: documentation, fixes and cleanups
Lots of fixes all over the place.
 
 Unfortunately, this does not yet fix a regression with vhost
 introduced by the last pull, the issue is typically this error:
     kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
 followed by QEMU aborting.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYKyfxAAoJECgfDbjSjVRpI4oH/2ZBpUxT/neq4ezX0bou5+1R
 lQ1m0VI1JDbay5uYw0Z0rUY7aLP0kX2XLu2jNBZg7fGz3+BPhqAoEjkGdlUran79
 fEnuYCvMMokQNzvMaHv+lFXO/MuEJthdDeUJyi4B0NU0sseutiz8opXuSWIC8Ncx
 pyqRb8AfgKnsUSRizEVfiOWI1fk+zsTFbSyUwajwKi5E7RNEuHwLiqk5VFhzrrTX
 nLwnUvlH7NrcDfliam9ziadhguo5cwCE4jBlMpeHnW5tGalNRulvF5EgwXybIdrU
 JaR6lzQabOcoaAuJJ/dgo336B1Ef3JA/hogqfTW4unJGL5VVkWT0HLZ9OV42NEg=
 =ibZy
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, vhost, pc, pci: documentation, fixes and cleanups

Lots of fixes all over the place.

Unfortunately, this does not yet fix a regression with vhost
introduced by the last pull, the issue is typically this error:
    kvm_mem_ioeventfd_add: error adding ioeventfd: File exists
followed by QEMU aborting.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

* remotes/mst/tags/for_upstream: (28 commits)
  docs: add PCIe devices placement guidelines
  virtio: drop virtio_queue_get_ring_{size,addr}()
  vhost: drop legacy vring layout bits
  vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout
  nvdimm acpi: introduce NVDIMM_DSM_MEMORY_SIZE
  nvdimm acpi: use aml_name_decl to define named object
  nvdimm acpi: rename nvdimm_dsm_reserved_root
  nvdimm acpi: fix two comments
  nvdimm acpi: define DSM return codes
  nvdimm acpi: rename nvdimm_acpi_hotplug
  nvdimm acpi: cleanup nvdimm_build_fit
  nvdimm acpi: rename nvdimm_plugged_device_list
  docs: improve the doc of Read FIT method
  nvdimm acpi: clean up nvdimm_build_acpi
  pc: memhp: stop handling nvdimm hotplug in pc_dimm_unplug
  pc: memhp: move nvdimm hotplug out of memory hotplug
  nvdimm acpi: drop the lock of fit buffer
  qdev: hotplug: drop HotplugHandler.post_plug callback
  vhost: migration blocker only if shared log is used
  virtio-net: mark VIRTIO_NET_F_GSO as legacy
  ...

Message-id: 1479237527-11846-1-git-send-email-mst@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-15 19:50:36 +00:00
Stefan Hajnoczi 60c5a47a16 qdev: Fix assert in PCI address property when used by vfio-pci
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJYK1OGAAoJECgHk2+YTcWm564QALuTbxPJVXBkOsWOURmXx337
 e2tnfAM0zci+gyuA4wF2OzUrn6QfwsNf61XTWkkzLoAttlJGQxktbrjglkUF16Kn
 VbG2XQKBGRhXxCjziO9IKz5JtJkLpvSBc5nzkUL6HGWRY3wAbFibHwP00xv4ZJWx
 irZaJJz1acVhpdFEzFUTTc0H/QhFmg5Oewx4lwTvHj7WLmd112Y2Wst/iTpwokcX
 cKCBhQUSL5tiAwt8QWb4aR+0PpT+oNwB14xFJXrVRBmy/+dln5inZO9wLpEWRkv1
 UeCz7UyHrReBNAD9Dv2j4NEOPB8ANe/iCFL0++C4TihJ8kJbSgrNjDnfL3/bUpO/
 HK7rueJ6VVXght43je94V75F1R8HowAflNny2fDwNhP8n5RBUQTwvj8Yue2JWh0W
 RaK4UweDVGRbADVifgnIdTVEGEHfnj5Dy13dA0sU3UgcxkGGQ4uBMhVNhuHFh3Aq
 rTWHyd5VFwOZfFNTc5wK1C+ZXu10ZDLETm1V8bjI6NUQeEhOC3JSwxQJKy8SyDEw
 OE5mf+4yzA9fgsn+q5EHun63x0ddI3Y8+/6vJi9cyutiYoYsxvet0aBc8omLrdV2
 /GRMf7pLl6MF3917IqxOKTY892AYDOkmGCVe4OBq63FVxWLEzCGmRjNEK33Jc7pd
 q4cst1qaZ5UEdBB4sRBy
 =/oL0
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'ehabkost/tags/machine-pull-request' into staging

qdev: Fix assert in PCI address property when used by vfio-pci

# gpg: Signature made Tue 15 Nov 2016 06:27:18 PM GMT
# 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

* ehabkost/tags/machine-pull-request:
  qdev: Fix assert in PCI address property when used by vfio-pci

Message-id: 1479234540-3192-1-git-send-email-ehabkost@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-15 19:02:09 +00:00
Daniel Oram 00b8702581 qdev: Fix assert in PCI address property when used by vfio-pci
Allow the PCIHostDeviceAddress structure to work as the host property
in vfio-pci when it has it's default value of all fields set to ~0. In
this form the property indicates a non-existant device but given the
field bit sizes gets asserted as excess (and invalid) precision
overflows the string buffer. The BDF of an invalid device
"FFFF:FF:FF.F" is returned instead.

Signed-off-by: Daniel Oram <daniel.oram@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <71f06765c4ba16dcd71cbf78e877619948f04ed9.1478777270.git.daniel.oram@gmail.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2016-11-15 15:50:04 -02:00
Stefan Hajnoczi 82e6e5ef0e -----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJYKyzlAAoJEJykq7OBq3PIcF0H/0p4N5lCaganb0WzWptTnGEB
 5hsrBrFITbrcuxUoin42Hq5SVWQHC44u+hlJEQaRdjZGqq9GJ2UbLU8B6QMXxgBG
 6bJ8MM/3pcbyB/DrLKOeDkLDCLRbxM2GKMAYSq0MMAST33iy4bSCYoCCgZT1H5pC
 uG7cS1EC/KZZjBLGqsrcVo0ssv7lELl+/uBVpyNeE4aU+IEBdev1YTpyu5PsJIY4
 nUKwnBZSoL+zlsLIVOdJMYfTaRbQg7lLW4nvfqTVq8hwv9/R0AHcEyOJHqIfEy3F
 uQB9tbR8BCUGtxwtIgue3G8cjqZBOD0jm4Sf1K4nQuRmlSYTo28yjNzbA/G4Xyc=
 =gFuz
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Tue 15 Nov 2016 03:42:29 PM GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* public/tags/block-pull-request:
  test-replication: fix leaks

Message-id: 1479224556-19367-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-15 16:17:13 +00:00
Marc-André Lureau baf905e580 test-replication: fix leaks
ASAN spotted:
SUMMARY: AddressSanitizer: 301990288 byte(s) leaked in 33 allocation(s).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20161109104547.23861-1-marcandre.lureau@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-15 15:41:00 +00:00
Marcel Apfelbaum 453ac8835b docs: add PCIe devices placement guidelines
Proposes best practices on how to use PCI Express/PCI device
in PCI Express based machines and explain the reasoning behind them.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-15 17:20:38 +02:00
Greg Kurz 435346d748 virtio: drop virtio_queue_get_ring_{size,addr}()
These are not used anymore.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-15 17:20:38 +02:00
Greg Kurz 1cdce7c54d vhost: drop legacy vring layout bits
The legacy vring layout is not used anymore as we use the separate
mappings even for legacy devices.
This patch simply removes it.

This also fixes a bug with virtio 1 devices when the vring descriptor table
is mapped at a higher address than the used vring because the following
function may return an insanely great value:

hwaddr virtio_queue_get_ring_size(VirtIODevice *vdev, int n)
{
    return vdev->vq[n].vring.used - vdev->vq[n].vring.desc +
           virtio_queue_get_used_size(vdev, n);
}

and the mapping fails.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-15 17:20:38 +02:00
Greg Kurz f1f9e6c596 vhost: adapt vhost_verify_ring_mappings() to virtio 1 ring layout
With virtio 1, the vring layout is split in 3 separate regions of
contiguous memory for the descriptor table, the available ring and the
used ring, as opposed with legacy virtio which uses a single region.

In case of memory re-mapping, the code ensures it doesn't affect the
vring mapping. This is done in vhost_verify_ring_mappings() which assumes
the device is legacy.

This patch changes vhost_verify_ring_mappings() to check the mappings of
each part of the vring separately.

This works for legacy mappings as well.

Cc: qemu-stable@nongnu.org
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-11-15 17:20:38 +02:00