Commit Graph

63080 Commits

Author SHA1 Message Date
Sameeh Jubran
c5840b905e qga-win: Handle fstrim for OSes lower than Win8
The defrag.exe tool which is used for executing the fstrim command
on Windows doesn't support retrim for OSes lower than Win8. This
commit handles this case and returns a suitable error.

Output of fstrim before this commit:
{"execute":"guest-fstrim"}
{"return": {"paths": [{"path": "C:\\", "error": "An invalid command line option
was specified. (0x89000008)"}, {"path": "F:\\", "error": "An invalid command
line option was specified. (0x89000008)"}, {"path": "S:\\", "error": "An
invalid command line option was specified. (0x89000008)"}]}}

Reported on:
https://bugzilla.redhat.com/show_bug.cgi?id=1594113

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
* use alternative version query code proposed by Sameeh
* fix up version check logic
* avoid CamelCase variable names when possible
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-07-23 18:45:21 -05:00
Peter Maydell
4eecc2e212 Mark xmm registers call-clobbered.
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbVg5DAAoJEGTfOOivfiFf7asH/jk/krKaLUyHaBUox3kPZwME
 E4bkfNLD3veb0I9Q+htLcIvPqLXuXdIC7MXE4MtfB6MPOHt5YMdwnvGAIoeWfkqP
 /hcvWNMZBg3cKhrIaoGE4xyM/iYfd0B4JYK0tPlanFEJ7Jw6r8dQc2ZUCRc/7JY/
 XtyCaJJmkggDaqMyj8p0FUc/b4tg2ccch3E0lIl8XVLNHXFmzBdok3CW0k0H+amI
 YqXwmaHTwvWtuDrsBO3Q3uF6k7zGroa7KLTXf4QLM1hYMsTXJDasEFFd+qp+pwZp
 2rrA+oIN3JWPggy5LI9vZ6gs7HOki/YFndayl6dGo6Wqzf8QW9waoZiEsbO3Bxw=
 =Kgc2
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180723' into staging

Mark xmm registers call-clobbered.

# gpg: Signature made Mon 23 Jul 2018 18:20:03 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180723:
  tcg/i386: Mark xmm registers call-clobbered

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 19:24:05 +01:00
Peter Maydell
5c29b203df Block layer patches:
- vvfat: Disable debug message by default
 - qemu-iotests fixes
 - Fix typos in comments
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbVgX4AAoJEH8JsnLIjy/WAJkQAIO61ydCkVEGch9GBThPHKlH
 wqmE2jVfiM08aFKrfNXvIyJTvYskZ78PCFSLwKp2SSJsggkmSc2RyQUkZJEw1ECx
 wS3rW6OynwwfcDBJkUiM2J21r0eByuxZpn1hQUv7sX1ZaxXmmwB4fGS4F+fNi2j1
 kxQIvWbsxswB58v0jcpZiidJGgrBlxxR3TyBN2d2bnfLEJSRUoCHUqq7d1KIgQA2
 YfVKEt0La6w9IuXWrfzXps3sZlMWoJn8AoEjHzTUEnxWZE0TgsQPfFEbkxeCnaYv
 /JqeVw6ErJm46swgxWtPEkK3vjBBAum5wZ6USPi/KDhULVRh4djVrAzhUN1Y87YR
 p2U1GEnpCPRL6bgq22eHD6ub70wn02FpgCuHIsK044xMjOvGhpsCnPUMlkNHBAZU
 BCroEJ3OWOxZaedb4vPaVicOAnoBuxJWzuUBpbrX/a6w7r8vP/Xy540NHcL3RetO
 +N1YgtTuc8J7Kleo35MvQAZtEfwcOt0JOeGED0facpqcQunVY7u7lAbbH7gqvhbk
 biuw7+u7lvvy3jYwVmBP+KYU686voqE6o9zE42dtUPbtdqDPdQ6Cf6/Iwipu/RKI
 UZVVNP0gzXhSG5pMRKbbOFgHa1wU+tF7iedckGwsuC+97Scq5kekT+nKlwn4RDI1
 o8Vd8Uql8lz88rbKdirX
 =YWeJ
 -----END PGP SIGNATURE-----

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

Block layer patches:

- vvfat: Disable debug message by default
- qemu-iotests fixes
- Fix typos in comments

# gpg: Signature made Mon 23 Jul 2018 17:44:40 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# 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:
  block/vvfat: Disable debug message by default
  iotests: Disallow compat=0.10 in 223
  iotest: Fix filtering order in 226
  iotests: remove LUKS support from test 226
  qemu-img: avoid overflow of min_sparse parameter
  block: Fix typos in comments (found by codespell)
  qemu-iotests: Use host_device instead of file in 149

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 18:37:39 +01:00
Richard Henderson
672189cd58 tcg/i386: Mark xmm registers call-clobbered
When host vector registers and operations were introduced, I failed
to mark the registers call clobbered as required by the ABI.

Fixes: 770c2fc7bb
Cc: qemu-stable@nongnu.org
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-07-23 09:21:14 -07:00
Eduardo Habkost
5f00335aec i386: Rename enum CacheType members
Rename DCACHE to DATA_CACHE and ICACHE to INSTRUCTION_CACHE.
This avoids conflict with Linux asm/cachectl.h macros and fixes
build failure on mips hosts.

Reported-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180717194010.30096-1-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-07-23 12:56:19 -03:00
Peter Maydell
e596be9039 target-arm queue:
* spitz, exynos: fix bugs when introspecting some devices
  * hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
  * target/arm: Correctly handle overlapping small MPU regions
  * hw/sd/bcm2835_sdhost: Fix PIO mode writes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJbVejJAAoJEDwlJe0UNgzexO0P/RQR9aGIREHCsqb3muC3O8Bh
 tjgwi7yQwpdMgalchyaPSFu7x2cz56KuwT/2N7z6k5WGqHPST1nPCsR+k1Y0V9aF
 5b9bJX013ltMA67Tsg4hFJ4X3HES6NnV6LCHJE7qsiRaqDyZCnIOHeoY5lZp7fkf
 NRX6dTN4fECP303nB+8jdmAUZOQapWOO8Y+4LDUkezHyujKdmMD3LcyW1XtfldwP
 AaFtoJE/f4N1mKqno1PJWgPgiRyHgjidHhZRr1jHpu7zOpNOn9aol+cF46h8N1Tg
 umFkjrlb7rzAS3WwaCy2jxGipSrJdKnmo5ETtRvpRnbk2ipylG5rW8dug/s6iLOX
 GIzCQghvV1PaA2NzxrxtvoqeAXS/3sZLyxTJhtLCccwEjjtS6m1RFfPBUS1aXhw5
 ZBHmRCW0jHK3yqrEwnjpD3Bk+C2p30IyATvb7UeaXxBd0Vr2bR8magfHxuz9TuNN
 q7hoxgDDcuBeURMUYIhu/nK+ym76zu66OF1OQNOjGurvXrpkdYzuqcEfhvd2s1Vw
 dXSvxRmmSPmduOB1SXT5kw8Uhd4n7OxN8kdcyAdy8TDjrQ5zFkIqfYenyfb936tB
 VePkT/lPZ5WLRZqnUi2RMj+WoCQ7xmE4M3ciTQTXYlHeDsPFyB8iYajL2wk5TNi+
 PweTylYDFyoUE3xpwwAz
 =qZ71
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180723' into staging

target-arm queue:
 * spitz, exynos: fix bugs when introspecting some devices
 * hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
 * target/arm: Correctly handle overlapping small MPU regions
 * hw/sd/bcm2835_sdhost: Fix PIO mode writes

# gpg: Signature made Mon 23 Jul 2018 15:40:09 BST
# gpg:                using RSA key 3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20180723:
  hw/intc/exynos4210_gic: Turn instance_init into realize function
  hw/arm/spitz: Move problematic nand_init() code to realize function
  target/arm: Correctly handle overlapping small MPU regions
  hw/sd/bcm2835_sdhost: Fix PIO mode writes
  hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 16:15:24 +01:00
Thomas Huth
3e31b4e170 block/vvfat: Disable debug message by default
It's annoying to see this debug message every time you use vvfat.
Disable it with the DLOG() macro by default, as it is done with the
other debug messages in this file.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Max Reitz
092b9c408f iotests: Disallow compat=0.10 in 223
223 tests persistent dirty bitmaps which are not supported in
compat=0.10, so that option is unsupported for this test.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Max Reitz
d6e4ca9021 iotest: Fix filtering order in 226
The test directory should be filtered before the image format, otherwise
the test will fail if the image format is part of the test directory,
like so:

[...]
-can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
+can't open: Could not open '/tmp/test-IMGFMT/t.IMGFMT': Is a directory
[...]

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
John Snow
e05eb9f29b iotests: remove LUKS support from test 226
This test doesn't actually care about the format anyway, it just
supports "all formats" as a convenience. LUKS however does not use a
simple image filename which confuses this iotest.

We can simply skip the test for formats that use IMGOPTSSYNTAX for
their filenames without missing much coverage.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Peter Lieven
6360ab278c qemu-img: avoid overflow of min_sparse parameter
the min_sparse convert parameter can overflow (e.g. -S 1024G)
in the conversion from int64_t to int resulting in a negative
min_sparse parameter. Avoid this by limiting the valid parameters
to sane values. In fact anything exceeding the convert buffer size
is also pointless. While at it also forbid values that are non
multiple of 512 to avoid undesired behaviour. For instance, values
between 1 and 511 were legal, but resulted in full allocation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Stefan Weil
50d6a8a352 block: Fix typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Kevin Wolf
4e04f3d91a qemu-iotests: Use host_device instead of file in 149
The test case uses block devices with driver=file, which causes the test
to fail after commit 230ff73904 added a deprecation warning for this.
Fix the test case to use driver=host_device and update the reference
output accordingly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-23 16:50:43 +02:00
Thomas Huth
1ddc9b98c3 hw/intc/exynos4210_gic: Turn instance_init into realize function
The instance_init function of the "exynos4210.gic" device creates a
new "arm_gic" device and immediately realizes it with qdev_init_nofail().
This will leave a lot of object in the QOM tree during introspection of
the "exynos4210.gic" device, e.g. reproducible by starting QEMU like this:

qemu-system-aarch64 -M none -nodefaults -nographic -monitor stdio

And then by running "info qom-tree" at the HMP monitor, followed by
"device_add exynos4210.gic,help" and finally checking "info qom-tree"
again.

Also note that qdev_init_nofail() can exit QEMU in case of errors - and
this must never happen during an instance_init function, otherwise QEMU
could terminate unexpectedly during introspection of a device.

Since most of the code that follows the qdev_init_nofail() depends on
the realized "gicbusdev", the easiest solution to the problem is to
turn the whole instance_init function into a realize function instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1532337784-334-1-git-send-email-thuth@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 15:21:27 +01:00
Thomas Huth
07bc425ea3 hw/arm/spitz: Move problematic nand_init() code to realize function
nand_init() does not only create the NAND device, it also realizes
the device with qdev_init_nofail() already. So we must not call
nand_init() from an instance_init function like sl_nand_init(),
otherwise we get superfluous NAND devices in the QOM tree after
introspecting the 'sl-nand' device. So move the nand_init() to the
realize function of 'sl-nand' instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 1532006134-7701-1-git-send-email-thuth@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 15:21:26 +01:00
Peter Maydell
9d2b5a58f8 target/arm: Correctly handle overlapping small MPU regions
To correctly handle small (less than TARGET_PAGE_SIZE) MPU regions,
we must correctly handle the case where the address being looked
up hits in an MPU region that is not small but the address is
in the same page as a small region. For instance if MPU region
1 covers an entire page from 0x2000 to 0x2400 and MPU region
2 is small and covers only 0x2200 to 0x2280, then for an access
to 0x2000 we must not return a result covering the full page
even though we hit the page-sized region 1. Otherwise we will
then cache that result in the TLB and accesses that should
hit region 2 will incorrectly find the region 1 information.

Check for the case where we miss an MPU region but it is still
within the same page, and in that case narrow the size we will
pass to tlb_set_page_with_attrs() for whatever the final
outcome is of the MPU lookup.

Reported-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180716133302.25989-1-peter.maydell@linaro.org
2018-07-23 15:21:26 +01:00
Guenter Roeck
03a31776e8 hw/sd/bcm2835_sdhost: Fix PIO mode writes
Writes in PIO mode have two requirements:

- A data interrupt must be generated after a write command has been
  issued to indicate that the chip is ready to receive data.
- A block interrupt must be generated after each block to indicate
  that the chip is ready to receive the next data block.

Rearrange the code to make this happen. Tested on raspi3 (in PIO mode)
and raspi2 (in DMA mode).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 1531779837-20557-1-git-send-email-linux@roeck-us.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 15:21:26 +01:00
Thomas Huth
7b6d7b84da hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
Valgrind complains:

echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
 "'arguments':{'typename':'xlnx,zynqmp-pmu-soc'}}" \
 "{'execute': 'human-monitor-command', " \
 "'arguments': {'command-line': 'info qtree'}}" | \
 valgrind -q microblazeel-softmmu/qemu-system-microblazeel -M none,accel=qtest -qmp stdio
[...]
==13605== Invalid read of size 8
==13605==    at 0x2AC69A: qdev_print (qdev-monitor.c:686)
==13605==    by 0x2AC69A: qbus_print (qdev-monitor.c:719)
==13605==    by 0x2591E8: handle_hmp_command (monitor.c:3446)

Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1531839343-13828-1-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 15:21:25 +01:00
Peter Maydell
9ba7dd1435 QAPI and monitor patches for 2018-07-23 (3.0.0-rc2)
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbVdNVAAoJEDhwtADrkYZT00MP+gL9WPGhKbmVsyNVwighKGic
 VkIv8rq3SWj3bdobOZrixR50ZgwOdc00e0SfSTTf23Pk7kmsgq0qgquO2pGn1Ob3
 uqY4L3+DXw3SSbDZioRsAzuTZeKAu/b4yMLKyqWFHWERVInAFuwmV4+Dt3T62Og5
 VL8/3kOdmqwOeoACtBONI1VEJdveDLjH7BHNGYJbsyMzUUAejYURzuJVRmwGU7/g
 r+8KfaSq1gq9rqbENCOJVVMkJ0IuSOZw1a9TwymWzxlaoY6hCN+fy3ac/cNWM7eX
 TtE11TnGGlwcM2/yCTL5PBGeLwBr1pQDW1qQhr4fG+enJRZveU2apJJVl+/ziEZt
 LB80eu2OKq9iMmSgo3zHsWkEvUPz5wkyPsmcTZTYlPnL5EHIrbq71mUUzjXPgkVE
 XAfBIXU/toEWaemVMy1a96Ejombx8UbxyPRDyY/fpRyEN9cNhfvcsi//36bofr33
 aE6GwiyYUbdWuj9EhqgDBKTQwxNlk4D69GiBh6uEvXvC3c1VgAu1YFEqSv8AZfQ/
 k9pSVZVx8AXhCviwS8141iu/5Ir3280TYv1nJVCBkdqvn/YIpXLeSbsKvZeOs941
 O515r9Uv4pPjEsWOeWHSV+TF3LQxhZ9kKcYj4/3V7a+7RBER4Ec8EWANH+64bRIb
 cJuLfmDIQshzkrbjYB78
 =bjEh
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2018-07-23' into staging

QAPI and monitor patches for 2018-07-23 (3.0.0-rc2)

# gpg: Signature made Mon 23 Jul 2018 14:08:37 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2018-07-23:
  monitor: Fix unsafe sharing of @cur_mon among threads
  qapi: Make 'allow-oob' optional in SchemaInfoCommand

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 15:15:46 +01:00
Peter Maydell
55b1f14cef Some ppc/ppc64 fixes:
- we can run now most of the targets on a ppc64 host with 64kB pages
 - add swapcontext syscall to run tests/test-coroutine in
   debian-powerpc-user-cross
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJbVdBdAAoJEPMMOL0/L748vuUP/2gxM37iTEKRs/tT46fWj1/u
 Lq+TQqsTJ0xKzrTJr47HgpHJfIbYdqx0Smd1/0bkDN99H402d+4n6m+Oj62YCaBK
 XxtO9CC7fuzLdd99g8NVVvactzhmXYpFKm8E8O+FLogV+ku1hEZHsnPo+l2bZmBv
 GSxoy2pvaogFK1BP4vIvcLxbzUCyg1V6GIzLJpTdfaGMoezTeg7WT+n5SdYXIbdR
 YB9RkMo0Qxjr4mM9g8B39oTGQwp8XHGk1E2QKzDNxP1ydG4MWyBbwGKW1hA/n1/F
 6GcAtClsBy6lOFY2t/YR8VxXWuDHMRwoRWhEtMUhF8TsWdAtm3KfzuZ7PibuetMO
 cneSNzT6Nbyc4qrbqINlBLmbqT201fWRPXUAt9XiblmDG2c9A4w1uiHAQ4zOoCWx
 cPiDFXKrJe4OSLgHlBJdH1hox8kaSeb/ryZyOz98Zb95/ETYOQ0ZlF5zwEzp+R1N
 BRTy+0ryAeRQCg0zg/D1NS5cptK4oP328xsobaqPcWDAhUKbUpS1zjWBuFSzwKFQ
 SCSQAOKnq3XtwT4OZJw7gBdo9fyWBdb6MbV5uCuJXzX+Bv2/XeTWJFj3oeml5CkR
 6+M+J3f82SYBLW6EuUyikbAOLdeKQqcIsDSHwC7mdt4pZrFTusGEWssAJVDFDZEH
 jdk4ZlUXuLj+oPMTs3ZL
 =DTRa
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging

Some ppc/ppc64 fixes:
- we can run now most of the targets on a ppc64 host with 64kB pages
- add swapcontext syscall to run tests/test-coroutine in
  debian-powerpc-user-cross

# gpg: Signature made Mon 23 Jul 2018 13:55:57 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# 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

* remotes/vivier2/tags/linux-user-for-3.0-pull-request:
  linux-user/ppc: Implement swapcontext syscall
  linux-user: fix ELF load alignment error

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 14:03:14 +01:00
Peter Xu
62aa1d887f monitor: Fix unsafe sharing of @cur_mon among threads
@cur_mon is null unless the main thread is running monitor code, either
HMP code within monitor_read(), or QMP code within
monitor_qmp_dispatch().

Use of @cur_mon outside the main thread is therefore unsafe.

Most of its uses are in monitor command handlers.  These run in the main
thread.

However, there are also uses hiding elsewhere, such as in
error_vprintf(), and thus error_report(), making these functions unsafe
outside the main thread.  No such unsafe uses are known at this time.
Regardless, this is an unnecessary trap.  It's an ancient trap, though.

More recently, commit cf869d5317 "qmp: support out-of-band (oob)
execution" spiced things up: the monitor I/O thread assigns to @cur_mon
when executing commands out-of-band.  Having two threads save, set and
restore @cur_mon without synchronization is definitely unsafe.  We can
end up with @cur_mon null while the main thread runs monitor code, or
non-null while it runs non-monitor code.

We could fix this by making the I/O thread not mess with @cur_mon, but
that would leave the trap armed and ready.

Instead, make @cur_mon thread-local.  It's now reliably null unless the
thread is running monitor code.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[peterx: update subject and commit message written by Markus]
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180720033451.32710-1-peterx@redhat.com>
2018-07-23 14:00:03 +02:00
Markus Armbruster
25b1ef31db qapi: Make 'allow-oob' optional in SchemaInfoCommand
Making 'allow-oob' optional in SchemaInfoCommand permits omitting it
in the common case.  Shrinks query-qmp-schema's output from 122.1KiB
to 118.6KiB for me.

Note that out-of-band execution is still experimental (you have to
configure the monitor with x-oob=on to use it).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180718090557.17248-1-armbru@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
2018-07-23 13:57:52 +02:00
Stefan Weil
6598f0cdad po: Don't include comments with location
Those comments change often when ui/gtk.c is changed and are not
really useful.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20180720212509.18339-1-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-23 10:50:54 +01:00
Richard Henderson
fa97e38eed linux-user/ppc: Implement swapcontext syscall
This allows the tests generated by debian-powerpc-user-cross
to function properly, especially tests/test-coroutine.

Technically this syscall is available to both ppc32 and ppc64,
but only ppc32 glibc actually uses it.  Thus the ppc64 path is
untested.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180718200648.22529-1-richard.henderson@linaro.org>
2018-07-22 21:33:45 +02:00
Laurent Vivier
33143c446e linux-user: fix ELF load alignment error
When we try to use some targets on ppc64, it can happen the target
doesn't support the host page size to align ELF load sections and
fails with:

  ELF load command alignment not page-aligned

Since commit a70daba377 ("linux-user: Tell guest about big host
page sizes") the host page size is used to align ELF sections, but
this doesn't work if the alignment required by the load section is
smaller than the host one.  For these cases, we continue to use the
TARGET_PAGE_SIZE instead of the host one.

I have tested this change on ppc64, and it fixes qemu linux-user for:
  s390x, m68k, i386, arm, aarch64, hppa
and I have tested it doesn't break the following targets:
  x86_64, mips64el, sh4
mips and mipsel abort, but I think for another reason.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[lv: fixed "info->alignment = 0"]
Message-Id: <20180716195349.29959-1-laurent@vivier.eu>
2018-07-22 21:32:50 +02:00
Peter Maydell
5b3ecd3d94 Fix aarch64 host vector mul
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbUV3oAAoJEGTfOOivfiFfrYoH/R3M+BLFwS2CRfEc3Du1fSdy
 So35c4X9SwyMf9uPGkmWEpQtqcSy88ONbqeecsJC+YkJUpCkueF3206+eOO3uFIh
 Sz5niIUzd3rDKU/pmgj1NyUopfBuqfx81zEpccRjRIEN5Df7BV2xk96f6Cs1r50a
 GybmxgNLgc39NGDVXuoZvSKdiMMTcD/HwQU2Lt0NY0c9ZLkxa+nkpHveUgwfX/2v
 csa4rmyo+1+bSs2Ylmj04arI7NUyJjaFqnhgKDJl6xej7m9acvcZzw6z8WAYwUqj
 gi3uPFec9BU8ePKD1kl/0CdjwAnGOc8Izk94Wzfcnsp1oWD5X3tHe2lBTeCrDSA=
 =SP/k
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180719' into staging

Fix aarch64 host vector mul

# gpg: Signature made Fri 20 Jul 2018 04:58:32 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180719:
  tcg/aarch64: limit mul_vec size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-20 11:08:33 +01:00
Peter Maydell
9d5d247e32 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJbUS+LAAoJEO8Ells5jWIRaM0H+wZMfW4SDf+CaR3e4LZVRvyS
 88km4y4EZFbAnVmI89fUzn9FhDizT659vgTxNwrFd1S/p/x51OzrEJtiGm/OfkRc
 y/fU2DQt8eIx2WDp7HzvHyMYXd08WQiItyJbpCLUukqXAzX2v4OATnz9ZoAxPHof
 z0fzejOokEo0fKqe+LgOB3upQDRsXGPOYiSo7wUHy1tk9P+ndym5kZcdU44EPtON
 Q/6COv3claUmEmDtQbpOhPZ2HPFL5nJoSL9rIKfUEweJj1+OHp7b1+lrw1W7sPRP
 INUdmX5+bnk6oieR2dsSFp8IealZH6BwZ4jkc8sME/HeCSBTy1mWyeFa+TDA2lI=
 =3U4O
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Fri 20 Jul 2018 01:40:43 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
# 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: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  tap: fix memory leak on success to create a tap device
  e1000e: Prevent MSI/MSI-X storms

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-20 10:00:08 +01:00
Yunjian Wang
323e7c1177 tap: fix memory leak on success to create a tap device
The memory leak on success to create a tap device. And the nfds and
nvhosts may not be the same and need to be processed separately.

Fixes: 07825977 ("tap: fix memory leak on failure to create a multiqueue tap device")
Fixes: 264986e2 ("tap: multiqueue support")
Cc: qemu-stable@nongnu.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-07-20 08:30:49 +08:00
Jan Kiszka
4712c158c5 e1000e: Prevent MSI/MSI-X storms
Only signal MSI/MSI-X events on rising edges. So far we re-triggered the
interrupt sources even if the guest did no consumed the pending one,
easily causing interrupt storms.

Issue was observable with Linux 4.16 e1000e driver when MSI-X was used.
Vector 2 was causing interrupt storms after the driver activated the
device.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-07-20 08:30:48 +08:00
Peter Maydell
0b46a3f005 Pull request
Contains a fix to use double-dash consistently with tracing command-line
 options in documentation and output.
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbULtTAAoJEJykq7OBq3PIJFUH/iuk6OMzhBcC//yOkCswN8te
 7LIOnfQHyN5nz9PUfYO2yOhlQNUbub6oNA4UFV6EfOJ1rmteYA8EOw2sqUp8h7Gw
 FoSeo/CA6cAKuyiEHPhn+e59h1R7zP+xc2aW8heoeR2VRQ5YRRA89MocDDLaVAVC
 9h6jmaE9wR5kv9Dsf2eZezXItISnLiJS5OpsMMCOahyVlprl9L56bfAWBhuQqbhB
 IAQpdVBB2FTBMeOKlHX8vFSMppfV3PvjF6ynPmdGZeUY6rm9dlkgd/sNr1gCaxZP
 YH2tbTwE+LHA2Fs/zYTXPWBMXuknvYHelbNpCdshbIXE20/VXP82kjnQfopBo98=
 =/8Hl
 -----END PGP SIGNATURE-----

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

Pull request

Contains a fix to use double-dash consistently with tracing command-line
options in documentation and output.

# gpg: Signature made Thu 19 Jul 2018 17:24:51 BST
# gpg:                using RSA key 9CA4ABB381AB73C8
# 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

* remotes/stefanha/tags/tracing-pull-request:
  tracing: Use double-dash spelling for trace option

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-19 18:25:53 +01:00
Peter Maydell
9f2b67e1ca riscv: Fix introspection problems
This is based on Thomas's work fixing introspection problems [1] and
 applied to the RISC-V port.
 
 1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEE9sSsRtSTSGjTuM6PIeENKd+XcFQFAltQtu8ACgkQIeENKd+X
 cFTCvAf+MNkMDcOJOlb2AsCwmYcnDj1YwiaobkDpPbKCl4u2q6j6kOhbBGpaROE0
 RBwIYOMIuWiyevnlDSytFGgc+TSnriFNmwMrfMKlD8haRbc+mbYulRICAYIRWCOo
 mk8Z+GYn3fw8tYiIudEj2jmObA7ushMjhKvo8/RmWk+Gz866KS8BpqR8LiTm6E66
 ejiar28IDId+XUbl3OJhh4RzUCyttEMfmUKE5s8Bi4gPN6J578FexdcLIlvkqPqN
 UUMz/8GgogjvFS/jkR5fRIcdqV6flKNtwnzZByTu76HtyvF7kXMr5PHe52kgVAQ2
 0RYea4XxQWMG+9MeZ/CsXYyiJRi/Lg==
 =EVRY
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-pull-20180719' into staging

riscv: Fix introspection problems

This is based on Thomas's work fixing introspection problems [1] and
applied to the RISC-V port.

1: https://lists.gnu.org/archive/html/qemu-devel/2018-07/msg03261.html

# gpg: Signature made Thu 19 Jul 2018 17:06:07 BST
# gpg:                using RSA key 21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>"
# 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: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* remotes/alistair/tags/pull-riscv-pull-20180719:
  spike: Fix crash when introspecting the device
  riscv_hart: Fix crash when introspecting the device
  virt: Fix crash when introspecting the device
  sifive_u: Fix crash when introspecting the device
  sifive_e: Fix crash when introspecting the device

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-19 17:21:43 +01:00
Alex Bennée
e65a5f227d tcg/aarch64: limit mul_vec size
In AdvSIMD we can only do 32x32 integer multiples although SVE is
capable of larger 64 bit multiples. As a result we can end up
generating invalid opcodes. Fix this by only reprting we can emit
mul vector ops if the size is small enough.

Fixes a crash on:

  sve-all-short-v8.3+sve@vq3/insn_mul_z_zi___INC.risu.bin

When running on AArch64 hardware.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20180719154248.29669-1-alex.bennee@linaro.org>
[rth: Removed the tcg_debug_assert -- there are plenty of other
cases that we do not diagnose within the insn encoding helpers.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-07-19 09:07:31 -07:00
Alistair Francis
8ff62f6aa0 spike: Fix crash when introspecting the device
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2018-07-19 09:05:48 -07:00
Alistair Francis
5657c3f53c riscv_hart: Fix crash when introspecting the device
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2018-07-19 09:05:48 -07:00
Alistair Francis
a993cb150f virt: Fix crash when introspecting the device
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2018-07-19 09:05:48 -07:00
Alistair Francis
4eea9d7deb sifive_u: Fix crash when introspecting the device
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2018-07-19 09:05:48 -07:00
Alistair Francis
54f3141a58 sifive_e: Fix crash when introspecting the device
Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2018-07-19 09:05:48 -07:00
Peter Maydell
e1ea55668f Pull request
This fix prevents hangs when a drive leaves a throttling group.
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbUKAVAAoJEJykq7OBq3PIrTwH+wUjn5FCz1DFeGtEGof/CzMN
 vzGC+LPm1zcvgHf62afeCwYPAJbAYpX4xj4uqF4RT87QBXgb737d6y7JW+4eH6DA
 Ibf6aC9H/0KtMl5x3MYWGkXAe5RedY+01Yiy8idWHs3/AkZ0K18AvOUn7RMNFH1a
 wogHpqpb6nRSpetHuWi650TJCoy+tKAESLFxJ478sWcSM2eTHWMen9tFFCtq9ptR
 eF4z8Tz4zWsYJTMorIbe1V6Qe89IEKtLPDWspvX83uUNzMjicr4SlLpI5KgDxfco
 BarpwDxPG71hHzQqqbmoDmZzUdkl4mlTtl8QAepgJpw/bs6JCabL22RWL7evz0k=
 =Pi5y
 -----END PGP SIGNATURE-----

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

Pull request

This fix prevents hangs when a drive leaves a throttling group.

# gpg: Signature made Thu 19 Jul 2018 15:28:37 BST
# gpg:                using RSA key 9CA4ABB381AB73C8
# 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

* remotes/stefanha/tags/block-pull-request:
  throttle-groups: fix hang when group member leaves

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-19 15:38:06 +01:00
Peter Maydell
771eab9349 don't segfault when trying to baseline an odd cpu model
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAltQeFkSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+vAekP/ivXO2fiBv9nP1/xPTReSXC1mMFHS+e3
 TZY6xA5GWbZ/M+s6OMpi40IToCN6OQVYxQQm1W+MiZq5lrM1/M+F/qA0rUZciaQW
 qK4UxTC/wTfL5N5Q47g7c7IeHlAONGGGFxZfu8rmrU2Dxe7+5g1aDmCzZ+fknlPG
 4AZSmc/GMacTYqL0Dno0GtHeneygruPsbssozLh87IEYUF3DRlQBBHvgUlx0IJ3T
 xI5xnS425u+DeF/DNEVhzKGkAcN5WkGgWargCS1kICBKHFIIiQh4CBS7Gv1ae8+i
 1B8OLbJz5jcLcw0bz4PyKQ5VyCgTwn5kTDAvEPSMrMUk0eFGN2W+eoDQEqu2TyKK
 V2dYqUOG+S5WnzbmkkIlBhHyBocoBf+yg0wRFajZRG0sMDb/lEIa5e4cJrBbTP8h
 TbD/TUHEhXThHw3Pn7IiGkGxHuGebrPtzEJbcz3MoUnuTBqdngr23LFm3yhPQ5rU
 LHm16foWAoHBPaIinWrhY83W88wPVsWONJn3JMGI9bk2APBAVOyI4q0xhQFGnXas
 zfG7eI+ae8TWUGZh1VMOICE8Qk0zbtTcCPXKpPMVuFQYwElFwgDv6v6qY4rbymON
 4xuknuGJLsjmCdF3Fy3qsSZd5lrKSfXNYyciGS469qhINr3LRrZV6d8/zXfHn4JP
 1h3rQ9W3DNrE
 =ZpxU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180719' into staging

don't segfault when trying to baseline an odd cpu model

# gpg: Signature made Thu 19 Jul 2018 12:39:05 BST
# gpg:                using RSA key DECF6B93C6F02FAF
# 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-20180719:
  s390x/cpumodel: fix segmentation fault when baselining models

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-19 13:12:47 +01:00
Yaowei Bai
db817b8c50 tracing: Use double-dash spelling for trace option
The '-trace' and '--trace' spellings are only both supported in qemu
binary, while for qemu-nbd or qemu-img only '--trace' spelling is
supported. So for the consistency of trace option invocation, we
should use double-dash spelling in our documentation.

This's also mentioned in
https://wiki.qemu.org/BiteSizedTasks#Consistent_option_usage_in_documentation
.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1530674247-31200-1-git-send-email-baiyaowei@cmss.chinamobile.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-07-19 13:09:04 +01:00
Stefan Hajnoczi
6fccbb475b throttle-groups: fix hang when group member leaves
Throttle groups consist of members sharing one throttling state
(including bps/iops limits).  Round-robin scheduling is used to ensure
fairness.  If a group member already has a timer pending then other
groups members do not schedule their own timers.  The next group member
will have its turn when the existing timer expires.

A hang may occur when a group member leaves while it had a timer
scheduled.  Although the code carefully removes the group member from
the round-robin list, it does not schedule the next member.  Therefore
remaining members continue to wait for the removed member's timer to
expire.

This patch schedules the next request if a timer is pending.
Unfortunately the actual bug is a race condition that I've been unable
to capture in a test case.

Sometimes drive2 hangs when drive1 is removed from the throttling group:

  $ qemu ... -drive if=none,id=drive1,cache=none,format=qcow2,file=data1.qcow2,iops=100,group=foo \
             -device virtio-blk-pci,id=virtio-blk-pci0,drive=drive1 \
             -drive if=none,id=drive2,cache=none,format=qcow2,file=data2.qcow2,iops=10,group=foo \
             -device virtio-blk-pci,id=virtio-blk-pci1,drive=drive2
  (guest-console1)# fio -filename /dev/vda 4k-seq-read.job
  (guest-console2)# fio -filename /dev/vdb 4k-seq-read.job
  (qmp) {"execute": "block_set_io_throttle", "arguments": {"device": "drive1","bps": 0,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0}}

Reported-by: Nini Gu <ngu@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20180704145410.794-1-stefanha@redhat.com
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1535914
Cc: Alberto Garcia <berto@igalia.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-07-19 13:08:26 +01:00
David Hildenbrand
677ff32db1 s390x/cpumodel: fix segmentation fault when baselining models
Usually, when baselining two CPU models, whereby one of them has base
CPU features disabled (e.g. z14-base,msa=off), we fallback to an older
model that did not have these features in the base model. We always try to
create a "sane" CPU model (as far as possible), and one part of it is that
removing base features is no good and to be avoided.

Now, if we disable base features that were part of a z900, we're out of
luck. We won't find a CPU model and QEMU will segfault. This is a
scenario that should never happen in real life, but it can be used to
crash QEMU.

So let's properly report an error if we baseline e.g.:

{ "execute": "query-cpu-model-baseline",
  "arguments" : { "modela": { "name": "z14-base", "props": {"esan3" : false}},
                  "modelb": { "name": "z14"}} }

Instead of segfaulting.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180718092330.19465-1-david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-07-18 14:20:02 +02:00
Peter Maydell
ea6abffa8a Update version for v3.0.0-rc1 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-17 18:15:19 +01:00
Peter Maydell
59b5552f02 Bug fixes.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJbTgXfAAoJEL/70l94x66DTbYH/3NutBAkNZKX7EImj/d0I1O8
 nERMVH1R70KBcugdsjhaBfTRoATDXdrBng4MBqloIK9dEMT3g6D4TFZJLU+WAjOc
 8sItx0BrUR7Sl8SnAvWNFoqVtvVancFiLnu11DsFGM0l8mJHRlZSkQZ0Fd0FL2W/
 OPnW7t6F7B2bc1VlPfSs093FVCoD3S+lJmbj64dwNrn8+fOX918V6gSaYQe92aIY
 pSbJjkRDx2iULmzMY8QH4OQiHgnd/Pijj+D628DMrUc0iW1Rsw5V2Yq7SMY6zoa8
 MoI/YDwX6eRMU2mq74BrKlULZrpmQn+6ZCdZTvXzLwc2zpKD4puO4FuMBOA7yx4=
 =GcxI
 -----END PGP SIGNATURE-----

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

Bug fixes.

# gpg: Signature made Tue 17 Jul 2018 16:06:07 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# 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:
  Document command line options with single dash
  opts: remove redundant check for NULL parameter
  i386: only parse the initrd_filename once for multiboot modules
  i386: fix regression parsing multiboot initrd modules
  virtio-scsi: fix hotplug ->reset() vs event race
  qdev: add HotplugHandler->post_plug() callback
  hw/char/serial: retry write if EAGAIN
  PC Chipset: Improve serial divisor calculation
  vhost-user-test: added proper TestServer *dest initialization in test_migrate()
  hyperv: ensure VP index equal to QEMU cpu_index
  hyperv: rename vcpu_id to vp_index
  accel: Fix typo and grammar in comment
  dump: add kernel_gs_base to QEMU CPU state

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-17 17:06:32 +01:00
BALATON Zoltan
dfaa7d50b0 Document command line options with single dash
QEMU options have a single dash (but also work as double dash for
convenience and compatibility). Most options are listed with single
dash in command line help but some were listed with two dashes.
Normalize these to have the same format as the others.

Left --preconfig as that is mentioned as double dash everywhere so I
assume that is the preferred form for that.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20180716193312.A5BA17456B9@zero.eik.bme.hu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-17 16:24:50 +02:00
Daniel P. Berrangé
0c2f6e7ee9 opts: remove redundant check for NULL parameter
No callers of get_opt_value() pass in a NULL for the "value" parameter,
so the check is redundant.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180514171913.17664-4-berrange@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-17 16:24:50 +02:00
Daniel P. Berrangé
f8da93a0ff i386: only parse the initrd_filename once for multiboot modules
The multiboot code parses the initrd_filename twice, first to count how
many entries there are, and second to process each entry. This changes
the first loop to store the parse module names in a list, and the second
loop can now use these names. This avoids having to pass NULL to the
get_opt_value() method which means it can safely assume a non-NULL param.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180514171913.17664-3-berrange@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-17 16:24:50 +02:00
Daniel P. Berrangé
6e3ad3f0e3 i386: fix regression parsing multiboot initrd modules
The logic for parsing the multiboot initrd modules was messed up in

  commit 950c4e6c94
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon Apr 16 12:17:43 2018 +0100

    opts: don't silently truncate long option values

Causing the length to be undercounter, and the number of modules over
counted. It also passes NULL to get_opt_value() which was not robust
at accepting a NULL value.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180514171913.17664-2-berrange@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Tested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-17 16:24:49 +02:00
Thomas Huth
ccf02d73d1 hw/arm/xlnx-zynqmp: Fix crash when introspecting the "xlnx, zynqmp" device
QEMU currently crashes when e.g. doing something like this:

echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
 "'arguments':{'typename':'xlnx,zynqmp'}}" \
 "{'execute': 'human-monitor-command', " \
 "'arguments': {'command-line': 'info qtree'}}" \
 |  aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp stdio

Use the new object_initialize_child() and sysbus_init_child_obj()
functions to get the refernce counting of the child objects right, so
that they are properly cleaned up when the parent gets destroyed.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 1531745974-17187-18-git-send-email-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-17 13:12:49 +01:00
Paolo Bonzini
fe04f0b4a1 hw/display/xlnx_dp: Move problematic code from instance_init to realize
aux_create_slave() calls qdev_init_nofail() which in turn "realizes"
the corresponding object. This is unlike qdev_create(), and it is wrong
because qdev_init_nofail() must not be called from an instance_init
function.  Move qdev_init_nofail() and the subsequent aux_map_slave into
the caller's realize function.

There are two more bugs that needs to be fixed here, too, where the
objects are created but not added as children.  Therefore when
you call object_unparent on them, nothing happens.

In particular dpcd and edid give you an infinite loop in bus_unparent,
because device_unparent is not called and does not remove them from
the list of devices on the bus.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1531745974-17187-17-git-send-email-thuth@redhat.com
[thuth: Added Paolo's fixup for the dpcd and edid unparenting]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-07-17 13:12:49 +01:00