Commit Graph

79223 Commits

Author SHA1 Message Date
Thomas Huth
699616db64 gitlab-ci.yml: Add build-system-debian and build-system-centos jobs
We were missing the two new targets avr-softmmu and rx-softmmu in the
gitlab-CI so far, and did not add some of the "other endianess" targets
like sh4eb-softmmu yet.
Since the current build-system-* jobs run already for a very long time,
let's do not add these missing targets there, but introduce two new
additional build jobs, one running with Debian and one running with
CentOS, and add the new targets there. Also move some targets from
the old build-system-* jobs to these new targets, to distribute the
load and reduce the runtime of the CI.

Message-Id: <20200730141326.8260-4-thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-08-05 10:39:21 +02:00
Thomas Huth
4d6862ffc7 tests/acceptance: Disable the rx sash and arm cubieboard replay test on Gitlab
These tests always time out on Gitlab, not sure what's happening here.
Let's disable them until somebody has enough spare time to debug the
issues.

Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20200730141326.8260-3-thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-08-05 10:38:27 +02:00
Thomas Huth
1caac1c0e4 tests/docker: Add python3-venv and netcat to the debian-amd64 container
Without python3-venv, I get the following message when trying to
run the acceptance tests within the debian container:

 The virtual environment was not created successfully because ensurepip is not
 available.  On Debian/Ubuntu systems, you need to install the python3-venv
 package using the following command.
    apt-get install python3-venv
 You may need to use sudo with that command.  After installing the python3-venv
 package, recreate your virtual environment.

Let's do it as the message suggests.

And while we're at it, also add netcat here since it is required for
some of the acceptance tests.

Message-Id: <20200730141326.8260-2-thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-08-05 10:37:42 +02:00
Peter Maydell
fd3cd581f9 target-arm queue:
* Fix decode of LDRA[AB] instructions
  * docs/devel: Document decodetree no-overlap groups
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAl8ph+sZHHBldGVyLm1h
 eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3oRAD/9nb9PN+k3KxfYWPIoub4dQ
 /UMgCz3gF97NlAfOAXvzQxZmWqxYedFwTOueKQmwMTcTe7csmRd6DlXvcOzFILq1
 ISid0FJZNovOl6sJQ8GhddeX121FKAqpTlKR8NsEWaIT/X6XvOGwz1C/yYaur/Qg
 fcoozKZNZtlFwKytpREXxHlvSQMGW4d87SSqPzd4AynfS+jS+RCMn8I84yDS7rtw
 hfEp/Brc/r7CmDdW8Xwhse2EkL3UfE7FoDv103qE7yoh16XNX14DYc7n+9Z3e6U2
 iag3ApxQEUwxhKfz9I54XpW657IL2ifbxr3yawlZ5az/JaTq0iSdIBziUPWf2ARB
 lCKJdTCVHX9ZP6X8mZ0RiXFDUSImhayneel37arN2m2+DM+cx3C4PFV1uoEUC1b8
 +mwcjqk1zfYjtex2lfYwOBJIUJBqH3gi4hHNODC7P7Ey/SAYP0spVmAl2FfgSzR6
 bddIW5rYUEMpYrGIdjnr2Hvcz1/Xps/PbjvaQN3hiQq1i80Cqd1R7u+5zOI5vf+T
 cH6Fjxoi+WiJIWU64ebrsPcN1kkOYokOHIimQWqFgQ3Fx+8JsdIlbdwI5l1yZzsd
 uePABLrNIUi/l8H1lJ+ZG9nrcyiPQgvaRKYip35wnpru74G/zK+GfYPPRrRscHnD
 37Wl5PCxe1MwOgX0HENYlQ==
 =oaoB
 -----END PGP SIGNATURE-----

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

target-arm queue:
 * Fix decode of LDRA[AB] instructions
 * docs/devel: Document decodetree no-overlap groups

# gpg: Signature made Tue 04 Aug 2020 17:08:11 BST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20200804:
  target/arm: Fix decode of LDRA[AB] instructions
  docs/devel: Document decodetree no-overlap groups

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 18:20:32 +01:00
Peter Maydell
881419b711 virtio: bugfix
A last minute bugfix.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAl8pg1UPHG1zdEByZWRo
 YXQuY29tAAoJECgfDbjSjVRpyYoIAKqpru6aEh24IdZq4d3J/fNkjYBmeQDF4zOo
 PRh9Czw6IlcmtEI1cjjoSqltq+NARYh+x2aYQoFptF60pbcJNXkP62iK2flVqRiy
 A9TTKgs8LarPvtiTedOHDs+N6dZj5S1IJOmbhnni1X+KJMYDK7MRtl7PRbdC+ZkW
 A2ULGYZJrQkePzSIweHmj8O52hnrfBY7P+A2ijYGhrk5zxgTvKfziR2GrWjVy4Rm
 tvm2gX9Bhy61cNXAJx8IIfyZ9BW7qLAu8deh0lm+J0M6Va1EzntuC3IkwqiO6Cfh
 JaRU6Qb2h8dGJPV7ozsxnSlXlmFoI+7bXsxdCl46m0NTQTmr3oo=
 =PHh3
 -----END PGP SIGNATURE-----

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

virtio: bugfix

A last minute bugfix.

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

# gpg: Signature made Tue 04 Aug 2020 16:48:37 BST
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# 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

* remotes/mst/tags/for_upstream:
  virtio-mem: Correct format specifier mismatch for RISC-V

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 16:51:32 +01:00
Bruce Rogers
facc68516a virtio-mem: Correct format specifier mismatch for RISC-V
This likely affects other, less popular host architectures as well.
Less common host architectures under linux get QEMU_VMALLOC_ALIGN (from
which VIRTIO_MEM_MIN_BLOCK_SIZE is derived) define to a variable of
type uintptr, which isn't compatible with the format specifier used to
print a user message. Since this particular usage of the underlying data
seems unique to this file, the simple fix is to just cast
QEMU_VMALLOC_ALIGN to uint32_t, which corresponds to the format specifier
used.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Message-Id: <20200730130519.168475-1-brogers@suse.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
2020-08-04 11:48:17 -04:00
Peter Collingbourne
d250bb19ce target/arm: Fix decode of LDRA[AB] instructions
These instructions use zero as the discriminator, not SP.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Message-id: 20200804002849.30268-1-pcc@google.com
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 16:40:19 +01:00
Richard Henderson
ffdfca6fac docs/devel: Document decodetree no-overlap groups
When support for this feature went in, the update to the
documentation was forgotten.

Fixes: 067e8b0f45
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200803205708.315829-1-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 16:33:47 +01:00
Peter Maydell
d15532d91b xen patch
Bug fix.
 -----BEGIN PGP SIGNATURE-----
 
 iQFOBAABCgA4FiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAl8pKWMaHGFudGhvbnku
 cGVyYXJkQGNpdHJpeC5jb20ACgkQDPVXL9f7Va8RCwgA/OzCAiKdyKGk/nSkS9IX
 e5xfxa216uxbBMzXH+OmrvrmJeYfktd+sl6oSAxZVwg9IlEHyzy+TpA23uWwx685
 CDi7CEpTUaufIfbw69yrQCJK67MchrzA2rwkA/J3X8uqrE6kuvGoWJ6SbHdrgirU
 wwY+9Y7srSwsi4OBcov6BcJ4yHmF0IEw8M7gNDY2nvxwPirlALy3L1Dmv/QWa69Y
 vk4zW9LbVnIJvlhCb03OFDH7W91h7C8oj8W9f7lGa94Gf2HC3AkVnUQPWSKKHoZV
 fxaFmeNp2igDEj0rtZXzfMuQuLvSrz7vDdFPegiM5RdN1BaR83dDvS9XVuDjlZHQ
 aQ==
 =4x1i
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20200804' into staging

xen patch

Bug fix.

# gpg: Signature made Tue 04 Aug 2020 10:24:51 BST
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg:                issuer "anthony.perard@citrix.com"
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal]
# 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: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20200804:
  accel/xen: Fix xen_enabled() behavior on target-agnostic objects

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 11:53:20 +01:00
Philippe Mathieu-Daudé
8e0ef06894 accel/xen: Fix xen_enabled() behavior on target-agnostic objects
CONFIG_XEN is generated by configure and stored in "config-target.h",
which is (obviously) only include for target-specific objects.
This is a problem for target-agnostic objects as CONFIG_XEN is never
defined and xen_enabled() is always inlined as 'false'.

Fix by following the KVM schema, defining CONFIG_XEN_IS_POSSIBLE
when we don't know to force the call of the non-inlined function,
returning the xen_allowed boolean.

Fixes: da278d58a0 ("accel: Move Xen accelerator code under accel/xen/")
Reported-by: Paul Durrant <pdurrant@amazon.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20200804074930.13104-2-philmd@redhat.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
2020-08-04 10:21:35 +01:00
Peter Maydell
bcc983234b -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJfKPzsAAoJEO8Ells5jWIRT4sIAKTPaDXkQDXsmM7iQOcj9sn6
 rDvoGdKUb+BfTSCv8sietApiOLWVoDqsCmR6TH8HyaJIrlncu/8tRUMIRTTTaLx+
 P+fP2kV546j4R/gt0WU/S8c3YOQgN2skUK8/Xy/ePPzUZ/Ya6XXfI6IPBB+YcsUd
 COmiOHPehnS7EqVxGVDXr+G3iAZLkUZ1KrQZI5Kgd96HRPzrqDzNri7CzOFLrTpO
 CJGr1N+j+g8frcsOjFjoI9JqjmtB6xjvUGkbyQFryvYxNp5z+mJGM8DQFg61qDdE
 ROuuBRtMkEjlWDsz349S74czNpNYKzBLgeyIGTvahXIqnVBguHks6DKB8umeK20=
 =9r05
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Tue 04 Aug 2020 07:15:08 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal]
# 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:
  hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
  colo-compare: Remove superfluous NULL-pointer checks for s->iothread

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-04 10:20:08 +01:00
Mauro Matteo Cascella
035e69b063 hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
An assertion failure issue was found in the code that processes network packets
while adding data fragments into the packet context. It could be abused by a
malicious guest to abort the QEMU process on the host. This patch replaces the
affected assert() with a conditional statement, returning false if the current
data fragment exceeds max_raw_frags.

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Ziming Zhang <ezrakiez@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2020-08-04 14:14:48 +08:00
Lukas Straub
f81cddfe8a colo-compare: Remove superfluous NULL-pointer checks for s->iothread
s->iothread is checked for NULL on object creation in colo_compare_complete,
so it's guaranteed not to be NULL.
This resolves a false alert from Coverity (CID 1429969).

Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2020-08-04 14:14:48 +08:00
Peter Maydell
5c1c3e4f02 target-arm queue:
* hw/timer/imx_epit: Avoid assertion when CR.SWR is written
  * netduino2, netduinoplus2, microbit: set system_clock_scale so that
    SysTick running on the CPU clock works
  * target/arm: Avoid maybe-uninitialized warning with gcc 4.9
  * target/arm: Fix AddPAC error indication
  * Make AIRCR.SYSRESETREQ actually reset the system for the
    microbit, mps2-*, musca-*, netduino* boards
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAl8oZY0ZHHBldGVyLm1h
 eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3sTUEACS3UqFckeYDzXP/bu3LiLd
 e3WTL01deQhICriUn/SRyeMlOMzNfzEqMQgQlTceEsW3a+a9hC5EwScnfhBGbTJh
 ZDCiKxyqypsK5Bx6W1QyY4fKjnqaxuUm42211NX+lCyR2U6/xZcFaWTPZ2Q+qgDD
 +c7Fl1emla3IAFKqGhyYCdDKN2IWr4qt24VJUrXf6r67CH2EAd8K2sTtglbyL4wf
 0siI/PhXfJeKoAKtpuM5TQqfrez/0P1m89Uvu1ciV9nwQ594Qw8U1WkYq3hW1rdj
 JuC4ddtMY/cMXtzcCOwtLVbE8t/0OuS+yx6Mfntp4tNiX0lvY8K9eIDMrx6+gCpf
 3Q9o5RqiJZ8i5kJ1rGrtW+kQ1Seq2KrpJRqwXoqgXvK4CcltgCdRsUgSkwHi/ARp
 WD5B/YuKdgs2zD96mSTPrNfliKwUSm9B8/WgSkFEID00oxVy2SdeygAmHm1OgbDZ
 6607mwkJvMNlHyqH8/SCJHie4Uy0qcmXP03YWv8sABV0OkVmxqHphuT3x8/i1VLc
 jPEsmaySeZjUo4GSagvC7AlXSpMalnFINRz59RKmIhe02HFC3LBIMUOPHLtLHrtQ
 wOJeS0oYlJu9Qd7MGcqO/CSk2DJY/DVcN/A3cMy+dkUZr0ITi9K1Ot23+teqZbvX
 52/56FgOPI3HFQqwLqlh+Q==
 =0X/M
 -----END PGP SIGNATURE-----

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

target-arm queue:
 * hw/timer/imx_epit: Avoid assertion when CR.SWR is written
 * netduino2, netduinoplus2, microbit: set system_clock_scale so that
   SysTick running on the CPU clock works
 * target/arm: Avoid maybe-uninitialized warning with gcc 4.9
 * target/arm: Fix AddPAC error indication
 * Make AIRCR.SYSRESETREQ actually reset the system for the
   microbit, mps2-*, musca-*, netduino* boards

# gpg: Signature made Mon 03 Aug 2020 20:29:17 BST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20200803:
  hw/timer/imx_epit: Avoid assertion when CR.SWR is written
  hw/arm/nrf51_soc: Set system_clock_scale
  target/arm: Avoid maybe-uninitialized warning with gcc 4.9
  target/arm: Fix AddPAC error indication
  msf2-soc, stellaris: Don't wire up SYSRESETREQ
  hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ
  include/hw/irq.h: New function qemu_irq_is_connected()
  hw/arm/netduino2, netduinoplus2: Set system_clock_scale

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 20:34:26 +01:00
Peter Maydell
13557fd392 hw/timer/imx_epit: Avoid assertion when CR.SWR is written
The imx_epit device has a software-controllable reset triggered by
setting the SWR bit in the CR register. An error in commit cc2722ec83
means that we will end up assert()ing if the guest does this, because
the code in imx_epit_write() starts ptimer transactions, and then
imx_epit_reset() also starts ptimer transactions, triggering
"ptimer_transaction_begin: Assertion `!s->in_transaction' failed".

The cleanest way to avoid this double-transaction is to move the
start-transaction for the CR write handling down below the check of
the SWR bit.

Fixes: https://bugs.launchpad.net/qemu/+bug/1880424
Fixes: cc2722ec83
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20200727154550.3409-1-peter.maydell@linaro.org
2020-08-03 17:56:11 +01:00
Peter Maydell
ce4f70e81e hw/arm/nrf51_soc: Set system_clock_scale
The nrf51 SoC model wasn't setting the system_clock_scale
global.which meant that if guest code used the systick timer in "use
the processor clock" mode it would hang because time never advances.

Set the global to match the documented CPU clock speed for this SoC.

This SoC in fact doesn't have a SysTick timer (which is the only thing
currently that cares about the system_clock_scale), because it's
a configurable option in the Cortex-M0. However our Cortex-M0 and
thus our nrf51 and our micro:bit board do provide a SysTick, so
we ought to provide a functional one rather than a broken one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20200727193458.31250-1-peter.maydell@linaro.org
2020-08-03 17:55:31 +01:00
Kaige Li
88a90e3de6 target/arm: Avoid maybe-uninitialized warning with gcc 4.9
GCC version 4.9.4 isn't clever enough to figure out that all
execution paths in disas_ldst() that use 'fn' will have initialized
it first, and so it warns:

/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
     ^
/home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
     AtomicThreeOpFn *fn;
                      ^

Make it happy by initializing the variable to NULL.

Signed-off-by: Kaige Li <likaige@loongson.cn>
Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Clean up commit message and note which gcc version this was]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 17:55:04 +01:00
Richard Henderson
8796fe40dd target/arm: Fix AddPAC error indication
The definition of top_bit used in this function is one higher
than that used in the Arm ARM psuedo-code, which put the error
indication at top_bit - 1 at the wrong place, which meant that
it wasn't visible to Auth.

Fixing the definition of top_bit requires more changes, because
its most common use is for the count of bits in top_bit:bot_bit,
which would then need to be computed as top_bit - bot_bit + 1.

For now, prefer the minimal fix to the error indication alone.

Fixes: 63ff0ca94c
Reported-by: Derrick McKee <derrick.mckee@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200728195706.11087-1-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: added comment about the divergence from the pseudocode]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 17:55:03 +01:00
Peter Maydell
fc6bb6e67e msf2-soc, stellaris: Don't wire up SYSRESETREQ
The MSF2 SoC model and the Stellaris board code both wire
SYSRESETREQ up to a function that just invokes
    qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
This is now the default action that the NVIC does if the line is
not connected, so we can delete the handling code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200728103744.6909-4-peter.maydell@linaro.org
2020-08-03 17:55:03 +01:00
Peter Maydell
9e60d759d3 hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ
The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
when the guest sets the SYSRESETREQ bit in the AIRCR register.  This
matches the hardware design (where the CPU has a signal of this name
and it is up to the SoC to connect that up to an actual reset
mechanism), but in QEMU it mostly results in duplicated code in SoC
objects and bugs where SoC model implementors forget to wire up the
SYSRESETREQ line.

Provide a default behaviour for the case where SYSRESETREQ is not
actually connected to anything: use qemu_system_reset_request() to
perform a system reset.  This will allow us to remove the
implementations of SYSRESETREQ handling from the boards where that's
exactly what it does, and also fixes the bugs in the board models
which forgot to wire up the signal:

 * microbit
 * mps2-an385
 * mps2-an505
 * mps2-an511
 * mps2-an521
 * musca-a
 * musca-b1
 * netduino
 * netduinoplus2

We still allow the board to wire up the signal if it needs to, in case
we need to model more complicated reset controller logic or to model
buggy SoC hardware which forgot to wire up the line itself. But
defaulting to "reset the system" is more often going to be correct
than defaulting to "do nothing".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
2020-08-03 17:55:03 +01:00
Peter Maydell
faf7c6de34 include/hw/irq.h: New function qemu_irq_is_connected()
Mostly devices don't need to care whether one of their output
qemu_irq lines is connected, because functions like qemu_set_irq()
silently do nothing if there is nothing on the other end.  However
sometimes a device might want to implement default behaviour for the
case where the machine hasn't wired the line up to anywhere.

Provide a function qemu_irq_is_connected() that devices can use for
this purpose.  (The test is trivial but encapsulating it in a
function makes it easier to see where we're doing it in case we need
to change the implementation later.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200728103744.6909-2-peter.maydell@linaro.org
2020-08-03 17:55:03 +01:00
Peter Maydell
e7e5a9595a hw/arm/netduino2, netduinoplus2: Set system_clock_scale
The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale
global, which meant that if guest code used the systick timer in "use
the processor clock" mode it would hang because time never advances.

Set the global to match the documented CPU clock speed of these boards.
Judging by the data sheet this is slightly simplistic because the
SoC allows configuration of the SYSCLK source and frequency via the
RCC (reset and clock control) module, but we don't model that.

Fixes: https://bugs.launchpad.net/qemu/+bug/1876187
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200727162617.26227-1-peter.maydell@linaro.org
2020-08-03 17:55:03 +01:00
Peter Maydell
45a150aa2b bitmaps patches for 2020-08-03
- fix bitmap migration involving read-only bitmap from backing chain
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl8oGfsACgkQp6FrSiUn
 Q2qKAQgAkVeF6qtNPeznmy0iyQcYmdNASqes3TgjJ74LqVqNZF9tDrYRF6Ap1/SO
 j2IUM6sdK7g72l5oZuOCCQ90X0p0S2eyI3FBFGgulTfoKC5CmceQCqMvTSvYu/xi
 br3ScJyV2eolX6/W+fNoFkxscOatpAYMRnq7qDVpahIYsuZpN2VBdbJRFZpeaGWz
 XTHjz0uWjRrWRiq7zVhHviB/vaYKGk4KTKjUIHI9yW2mQIGQ16r9oSYoaIR8B2eP
 EPWesqx1m4F+lPAL3Zjkew1yAxZFJrDQkfhGzxs4I4yWiBG1QH/pjcgPM2CR/K+F
 JNPMBIUmVoSwhx8c51hzrmLep096mQ==
 =E47r
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging

bitmaps patches for 2020-08-03

- fix bitmap migration involving read-only bitmap from backing chain

# gpg: Signature made Mon 03 Aug 2020 15:06:51 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-bitmaps-2020-08-03:
  iotests/169: Test source cont with backing bmap
  qcow2: Release read-only bitmaps when inactivated

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 15:13:49 +01:00
Max Reitz
edadc99a2e iotests/169: Test source cont with backing bmap
Test migrating from a VM with a persistent bitmap in the backing chain,
and then continuing that VM after the migration

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200730120234.49288-3-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-08-03 08:59:37 -05:00
Max Reitz
fe16c7ddf8 qcow2: Release read-only bitmaps when inactivated
During migration, we release all bitmaps after storing them on disk, as
long as they are (1) stored on disk, (2) not read-only, and (3)
consistent.

(2) seems arbitrary, though.  The reason we do not release them is
because we do not write them, as there is no need to; and then we just
forget about all bitmaps that we have not written to the file.  However,
read-only persistent bitmaps are still in the file and in sync with
their in-memory representation, so we may as well release them just like
any R/W bitmap that we have updated.

It leads to actual problems, too: After migration, letting the source
continue may result in an error if there were any bitmaps on read-only
nodes (such as backing images), because those have not been released by
bdrv_inactive_all(), but bdrv_invalidate_cache_all() attempts to reload
them (which fails, because they are still present in memory).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200730120234.49288-2-mreitz@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-08-03 08:59:37 -05:00
Peter Maydell
6c5dfc9ccb QAPI patches patches for 2020-08-03
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAl8n1A4SHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZTI1IP/ApVO+eAp1TUIXUoVHThWS+ZRp7Do13p
 wbdbgDu8h3mOvudtpsG1+AyLOdBVtuudckWWwRjLrrcjxTlQjNEUqdloAOoDg42w
 g+FiS0REliq1ofW591Z3OICmYAOBNvECWobeKO1rSrp7uaExc/+rtQ7IMrGZuJ/O
 4161WIXiuvAzSz4XkUqxiLvR76CUzFEZpQw8IROeHSPEWTWrMrwFae4cVz+7dYp+
 sEyg6yf08PH6uoROIMhQQOXrzOJDjyP6FF4WxM5H/eRRJOLTsIc/25xfjMJF2OJv
 DVBlxf72AQ+r3woYbSajdqtKKQdWwaUtqCCLvANTgpz7wdZScsoicGoGjsEcqk5W
 KZRCjk+JbFd57gJ0QKEh3esf27WC3qKr7+ILZufJtBAQbeDeZB0vEx0tQveBeOlt
 yvR/gnT7UO6DFtAsvF+62Ml5TI9BI31Rk8Qa40+P+SwOgBwAHzVuEDu76ERHuKau
 16wQnk5w3NxQsH9sPtIt0GRVka0eYgGXgssXR/PDMR5zfBHihUWtRT3EXb58u9G/
 oRAt64uZws0wLP/7Xq0LMwEoMCqoMwEdEblLxiZpymVJ/yC8RawkS+ZWGKmuIwHA
 VSXGyMMV8Z0z/JmwCiZODBrRzQHF8RJUgwmJFmmoFHHU1CfjumXKl0iVZ6VRguhu
 jqTxyBBFFfj0
 =/1gu
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-08-03' into staging

QAPI patches patches for 2020-08-03

# gpg: Signature made Mon 03 Aug 2020 10:08:30 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2020-08-03:
  schemas: Add vim modeline
  qapi: Delete unwanted indentation of top-level expressions
  qapi/machine.json: Fix missing newline in doc comment

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 12:21:57 +01:00
Peter Maydell
92a95ab446 seabios: update to master snapshot
seabios master branch got a few bugfixes, so update
 to a newer snapshot to pick them up for 5.1-rc3.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCgAGBQJfJ5+BAAoJEEy22O7T6HE4Sr4QAKp5ntfbpsFfVj4HfGm1443Q
 4kxCmIiGH+vSbTQqSziannwvdRgbxzZemnc2GTWhOFixp+jP7eY2U3/5mHG4Gx4O
 EOHCjTCfhCdEn3Enn9tXKL10GTY28BrYbPdbfPOqcyV5G3fIpQ/4nmodIwn7uOfB
 wh1zIWeYQKKXy+w7plzM4GKBhRSvmBNfPbZRMSe125ojoPF3lEnLlOqQeQTqbNaK
 PKKenlbgJpV+fATPwCSO6nGiAfO69kKAu6UHR//4Dm867vT9npIkIwyiS5+Ietzw
 0n6xZh8SNncT0++wKSnVb4z5ITETm8RrLvn/b8CkvnH/rQXBxzPZ/MrviFdwgrbt
 GV4GrrCLE+ApRDOurZsObbHX6Us/5bY1t2trPfXdwDlPASbearvkwBgqZiCIiz0N
 gTsEPhiNLPHNjpVKb0snONNyyUvO/nhELoVQXKcJDxQ+uFxUutd7eefcz5ET4ETj
 I9tZxIHQIt7MyGbaIc2gFl83y9wOJTsMhGsVmLMGgbz/qnE0rQj2ZndBnoN+7AiL
 T/Nh+QWKEI+DUv5htm6GaLidAvIrfj2Y1X33nLRzjPlfK076vSA86KFvN7TA+rBO
 No15Vw1D8/Rwz18QLXoP4D1r0fDYlF8rI0+CXFrEpe/1u1QS9kteruVRZnaW46Zb
 gyv5UgLJGj1DnmoO21At
 =2oht
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/seabios-20200803-pull-request' into staging

seabios: update to master snapshot

seabios master branch got a few bugfixes, so update
to a newer snapshot to pick them up for 5.1-rc3.

# gpg: Signature made Mon 03 Aug 2020 06:24:17 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/seabios-20200803-pull-request:
  seabios: update to master snapshot

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-08-03 09:54:58 +01:00
Andrea Bolognani
f7160f3218 schemas: Add vim modeline
The various schemas included in QEMU use a JSON-based format which
is, however, strictly speaking not valid JSON.

As a consequence, when vim tries to apply syntax highlight rules
for JSON (as guessed from the file name), the result is an unreadable
mess which mostly consist of red markers pointing out supposed errors
in, well, pretty much everything.

Using Python syntax highlighting produces much better results, and
in fact these files already start with specially-formatted comments
that instruct Emacs to process them as if they were Python files.

This commit adds the equivalent special comments for vim.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Message-Id: <20200729185024.121766-1-abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-08-03 08:28:08 +02:00
Markus Armbruster
fbeed19761 qapi: Delete unwanted indentation of top-level expressions
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200730091656.2633334-1-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[One more line de-indented]
2020-08-03 08:28:08 +02:00
Peter Maydell
6ac3f1e799 qapi/machine.json: Fix missing newline in doc comment
In commit 176d2cda0d we added the @die-id field
to the CpuInstanceProperties struct, but in the process
accidentally removed the newline between the doc-comment
lines for @core-id and @thread-id.

Put the newline back in; this fixes a misformatting in the
generated HTML QMP reference manual.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200729191019.19168-1-peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-08-03 08:28:08 +02:00
Gerd Hoffmann
1f42e24699 seabios: update to master snapshot
seabios master branch got a few bugfixes, so update
to a newer snapshot to pick them up for 5.1-rc3.

shortlog
========

Kevin O'Connor (2):
      vgabios: Fix preserve memory flag in handle_1000
      ldnoexec: Add script to remove ET_EXEC flag from intermediate build objects

Paul Menzel (1):
      nvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5

Stefan Reiter (1):
      virtio-scsi: fix boot prio detection by using correct lun

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-08-03 07:01:02 +02:00
Peter Maydell
d74824cf7c Fix a problem introduced in a recent fix.
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAl8j21QSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+vSmsP/RPTakpLdYcBFuXcVHYivloRWWuFyiFR
 X4EkjuybJYmAXEWFhg0tFAdjqf/u9f9GIDoFlTreMm+qknh49TgYtT/HcemnR2lL
 lp6Tgv3Z7mw6ZD0dHm+hn9IjFegEaAB5ucehV3fxBxXgamdUKeOKx9z8fMlorsQW
 fxmLupeeBzc+IJgaY7UG1ZwY0aJ0vQ7u2PjDVnRu6HXUVHQaSDUlSVzzr/0I/Drl
 IMGsOJdnlrytVvNG/UvuXTpCvIbvbfPpNM9kB+CzgSrYi4nO3l0wC1d+OA+lVPur
 ypK7qmP4d9QX9iU4vw26ZajjjXLv1kSoTQcAJc3Lm5u3uoUe9QAmM62Vz3HJx1C7
 Y74mjBVTscKhWzurvGGseTLg06r4IDyNAffh+iZYYlX6FFKuEORLpbyaf3+SpS/e
 hTndK7kvX3lvd0BpaFAp+qTug2kQy0Z/zTtsnuxDhGFLJiddYbqSX3HnK1OGwO4h
 hbojjqc+SSCTOq2dx3nFSzUZm4AeJVb5ZudW4uw0jGZAnNIHYsAeS/pPDSo8vo2H
 3SvFU5vmNY7pyFGMUMN6PEDd7MAc67YWQytt1Q34CWr13JPT4Cq+RZhoWA0tDH4/
 5TcWfsP3cqqxFsp/f2u023NGDQ6AMm2Sni3rhIfljUHfe2qw0xLvXppJK6D3Pb9q
 5pS2WoqG8Tmb
 =zfTJ
 -----END PGP SIGNATURE-----

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

Fix a problem introduced in a recent fix.

# gpg: Signature made Fri 31 Jul 2020 09:50:28 BST
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "cohuck@redhat.com"
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [marginal]
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [marginal]
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [marginal]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20200731:
  s390x/s390-virtio-ccw: fix off-by-one in loadparm getter

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-31 10:28:13 +01:00
Peter Maydell
1448629751 Pull request
A build fix and a 'simple' trace backend regression fix.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl8jDbYACgkQnKSrs4Gr
 c8gn2wgAlPr1Tf3BvIvXWb7PBKFkgY21Ctr5BhcheQrsDC4RwqFHAJbhzRjN3LyN
 E6i0mVe5cl9ufAtCNoMDQ293mbqfFVbz6gK9X+rwyY2iXPQ0Nvl5Z7IwLfB2WN/9
 fvGtFbiiaJ/Vm52eOzEFmogAUqmdSzVl3xLer6zwXB08q2Owq/esH02pNSkainBT
 3mGK8ePZH6+kigojR1FC0BTCs0QRoVRvXBIE90b8bjmzAGYUQbrTqXizDUAjJHd0
 V8jcGJLFO2l0GQ9lSia04lkrosKVcmRW3TvkXtkDd754wtz9Wtqv+rwL5MVcwScs
 x50DKh27+/QyA8ByBFByPeIrtvlqVw==
 =pvlB
 -----END PGP SIGNATURE-----

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

Pull request

A build fix and a 'simple' trace backend regression fix.

# gpg: Signature made Thu 30 Jul 2020 19:13:10 BST
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  tracetool: carefully define SDT_USE_VARIADIC
  trace/simple: Allow enabling simple traces from command line

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-30 20:02:26 +01:00
Stefan Hajnoczi
000822441e tracetool: carefully define SDT_USE_VARIADIC
The dtrace backend defines SDT_USE_VARIADIC as a workaround for a
conflict with a LTTng UST header file, which requires SDT_USE_VARIADIC
to be defined.

LTTng UST <lttng/tracepoint.h> breaks if included after generated dtrace
headers because SDT_USE_VARIADIC will already be defined:

  #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION
  #define SDT_USE_VARIADIC <-- error, it's already defined
  #include <sys/sdt.h>

Be more careful when defining SDT_USE_VARIADIC. This fixes the build
when both the dtrace and ust tracers are enabled at the same time.

Fixes: 27e08bab94 ("tracetool: work around ust <sys/sdt.h> include conflict")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200729153926.127083-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-07-30 16:02:38 +01:00
Halil Pasic
148d25e0f6 s390x/s390-virtio-ccw: fix off-by-one in loadparm getter
As pointed out by Peter, g_memdup(ms->loadparm, sizeof(ms->loadparm) + 1)
reads one past of the end of ms->loadparm, so g_memdup() can not be used
here.

Let's use g_strndup instead!

Fixes: d664548328 ("s390x/s390-virtio-ccw: fix loadparm property getter")
Fixes: Coverity CID 1431058
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200730130156.35063-1-pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2020-07-30 16:53:34 +02:00
Josh DuBois
1b7157be3a trace/simple: Allow enabling simple traces from command line
The simple trace backend is enabled / disabled with a call
to st_set_trace_file_enabled().  When initializing tracing
from the command-line, this must be enabled on startup.
(Prior to db25d56c01, command-line initialization of
simple trace worked because every call to st_set_trace_file
enabled tracing.)

Fixes: db25d56c01
Signed-off-by: Josh DuBois <josh@joshdubois.com>
Message-id: 20200723053359.256928-1-josh@joshdubois.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-07-29 16:39:56 +01:00
Peter Maydell
5772f2b1fc Update version for v5.1.0-rc2 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 21:51:03 +01:00
Peter Maydell
5045be872d nbd patches for 2020-07-28
- fix NBD handling of trim/zero requests larger than 2G
 - allow no-op resizes on NBD (in turn fixing qemu-img convert -c into NBD)
 - several deadlock fixes when using NBD reconnect
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAl8gPV4ACgkQp6FrSiUn
 Q2ozdQgAiDHaHG2NX4jmduID7677/XhsLoVl1MV7UZnU+y9qQ2p+Mbsw1oMneu8P
 Dtfgx/mlWVGu68gn31f4xVq74VTZH6p3IGV7PMcYZ50xbESoFs6CYUwUWUp1GeC3
 +kPOl0EpLvm1W/V93sKmg8FflGmNiJHNkfl/ddfk0gs6Z3EfjkmGJt7IP/pv1UCs
 4icWvCJsqw2z8TnEwtTpMX5HZlWth1x37lUOShlPL5kA5hZqU+zYU/bYB5iKx+16
 MebYg7C7CXYCCtH9cDH/swUWhOdQLkywA6yBAwc1zENsKy84aIAJIUls/Ji0q6CY
 A4s5c0FovLBuMDd9oLr0kJbkJQeVZA==
 =DD6l
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-07-28' into staging

nbd patches for 2020-07-28

- fix NBD handling of trim/zero requests larger than 2G
- allow no-op resizes on NBD (in turn fixing qemu-img convert -c into NBD)
- several deadlock fixes when using NBD reconnect

# gpg: Signature made Tue 28 Jul 2020 15:59:42 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2020-07-28:
  block/nbd: nbd_co_reconnect_loop(): don't sleep if drained
  block/nbd: on shutdown terminate connection attempt
  block/nbd: allow drain during reconnect attempt
  block/nbd: split nbd_establish_connection out of nbd_client_connect
  iotests: Test convert to qcow2 compressed to NBD
  iotests: Add more qemu_img helpers
  iotests: Make qemu_nbd_popen() a contextmanager
  block: nbd: Fix convert qcow2 compressed to nbd
  nbd: Fix large trim/zero requests

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 20:43:03 +01:00
Peter Maydell
b1753831b0 slirp: update to latest stable-4.2 branch
-----BEGIN PGP SIGNATURE-----
 
 iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAl8gNnEcHG1hcmNhbmRy
 ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5cSVD/9qQaONy0CMABgYpIlK
 VwhArWfHhphxQvB8ozH0mu+B5GbYaAfoDU5KAplL/+y88SwYTYwAz99XJm4e8lCp
 ahZ6ng1T9vTV0DIB1KkWYaVznXx1U7U3lLIlVZyFLGZXxYZbCmV+bjwNxegjgh+R
 2htRCrJVHOUNpGS8i8rZQagosC4q9YYF+wgsSumEVBOVqVDPnoXLKgL4UJJV6s8o
 fG1LjRNU3IZkZpCXu7vhXl/YQgFv8k9Wx5RDfdfbL+GFZuHNE75y9t55xwS6kCoY
 2TXWJbibnYhBSpoOUQjEDNl+VXLjjdO4T9aQHZnqbVUNMB2l7f/5ZwT7BFJfgrIp
 WoahoKgdZlcfy2bLb/t0G3nrJLAhFdMSbilos3CAcky5izdR5PoIC1Rjf1LUrdbq
 DYbAkrbmYdhcNm+Kk9hTGMAS2xwO3ZZzYyIt8nExtrsVm9eKcGgLV/9OkI1Q7jUW
 R8Qab2WbUiFC9E5t7GG1wuczjNZBwcBkuR74FTX0VdXW+YGOfTiJjtNLQAc3OqYT
 CuUK5+BJtqh65xF3WIRktWjsdk+PDvV/H4CNHTDh8J4+JjyhGs176xkQnb4KRetw
 1JL0F1Mvm/7G939fBaRnI3+/yg7MyeOPNhSFDYLosPi+2XPSL1u+KbXN+F7mrjds
 kRu+pANaMFtDHxbgF3tB+MNG+w==
 =kTid
 -----END PGP SIGNATURE-----

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

slirp: update to latest stable-4.2 branch

# gpg: Signature made Tue 28 Jul 2020 15:30:09 BST
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/slirp-pull-request:
  slirp: update to latest stable-4.2 branch
  test-char: abort on serial test error

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 19:44:03 +01:00
Peter Maydell
3461487523 target-arm queue:
* ACPI: Assert that we don't run out of the preallocated memory
  * hw/misc/aspeed_sdmc: Fix incorrect memory size
  * target/arm: Always pass cacheattr in S1_ptw_translate
  * docs/system/arm/virt: Document 'mte' machine option
  * hw/arm/boot: Fix PAUTH, MTE for EL3 direct kernel boot
  * target/arm: Improve IMPDEF algorithm for IRG
 -----BEGIN PGP SIGNATURE-----
 
 iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAl8e8E4ZHHBldGVyLm1h
 eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3gw8D/9FeK7g1aFnqpAw5Ynar2Wa
 0nBv2p1QPMXkGecR9FlPxvLKRO6AF1twQha+9tz+nNFTmYkfJ+VGcuk6P9NJMj5M
 pYzF/hbvI7Q8sK88bNmtrkvQYL/EoSHAJSFRxPDErA9pLU1I72sTqP7m2ZLLX6P7
 LA0hys0U2lEHVwyCJ+u7uSnyr6vMpaNoq69PRYJScbk5NRY3EQ2cDCwn9DCBAZN1
 hpT/kBzJTFikf8JcxcAo6fVAgV5Uhqw6HcXu9iohDm3OFswpX4xJnV3xBzc4821A
 DmNSIYOANYNqSdQ2Q8XSKY2YBeVfay2GeQ44Xiv4nG37XdOMWf1Nlvnnz1co4JLf
 jiuYzjOmAC3Ix0D3nWi0foI3l51vOZzgPpMvY8vyXmjzs+ter8o3BKrHMcj2JM2c
 ODRUJNJ8NU1HtOL1rm+jW+tQcdiJ/fQjQ0OD42GxGOVnPJ39R8KaShIyL5q5f/Nt
 X0a5O8BcOkre5IwiasSI7HpOK6E+vofZXPPElz4tqtPuE/k/E6EuU4/dI8pygVZL
 jvBcM7qWnzqAVPC4C2RTFvQVI3PPQRaFwEwKtNu8CEMiu47DvIOtM4U0WyYIr3uN
 nsCmPEjcfNV3yq0z77w+102Ay0QQVCxaSiekCoCVF8eKjlRghGQnpBddBQL8VrNQ
 meeBVABBOVtmD8Fjq7yhHA==
 =s8n/
 -----END PGP SIGNATURE-----

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

target-arm queue:
 * ACPI: Assert that we don't run out of the preallocated memory
 * hw/misc/aspeed_sdmc: Fix incorrect memory size
 * target/arm: Always pass cacheattr in S1_ptw_translate
 * docs/system/arm/virt: Document 'mte' machine option
 * hw/arm/boot: Fix PAUTH, MTE for EL3 direct kernel boot
 * target/arm: Improve IMPDEF algorithm for IRG

# gpg: Signature made Mon 27 Jul 2020 16:18:38 BST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20200727:
  target/arm: Improve IMPDEF algorithm for IRG
  hw/arm/boot: Fix MTE for EL3 direct kernel boot
  hw/arm/boot: Fix PAUTH for EL3 direct kernel boot
  docs/system/arm/virt: Document 'mte' machine option
  target/arm: Always pass cacheattr in S1_ptw_translate
  hw/misc/aspeed_sdmc: Fix incorrect memory size
  ACPI: Assert that we don't run out of the preallocated memory

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 18:43:48 +01:00
Peter Maydell
0c4fa5bc1a Block patches for 5.1.0:
- Fix block I/O for split transfers
 - Fix iotest 197 for non-qcow2 formats
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAl8gK/gSHG1yZWl0ekBy
 ZWRoYXQuY29tAAoJEPQH2wBh1c9AR+kIALv+Z/A6SPpsAHjpyuRbluuhznfqPuiX
 mIVX0qNhsFBDAUVw1tOkMtfxOIvuaQW/QWzM0UPaHqB/I4ckzE6Dp98ys9uwHPdq
 ez23blWvBuB3P3y2ZBAYhhRlCqt3w4uI/lIJMu7VZBghXxj3fGcuTnLlWx8gb1IH
 74MiBX8XPt532FiFTnpzxgns8NYkZY8mF6zduGqBPx6bPmdNdDfqAhL68Fv8uKJA
 k4dVH6ffPLZD+RrCz9GL5rsYQ6NR6tfyEoRMPqtJznhtzWwu5h5EF3p46VkcKheI
 k0axygEBAr9JbeCwbIK3a4hjQ7eaFQ6j9JR+lPZBRaDbLHv/xGNNuvw=
 =C4Lq
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-07-28' into staging

Block patches for 5.1.0:
- Fix block I/O for split transfers
- Fix iotest 197 for non-qcow2 formats

# gpg: Signature made Tue 28 Jul 2020 14:45:28 BST
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2020-07-28:
  iotests/197: Fix for non-qcow2 formats
  iotests/028: Add test for cross-base-EOF reads
  block: Fix bdrv_aligned_p*v() for qiov_offset != 0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 18:00:21 +01:00
Peter Maydell
0a58e39fe9 linux-user 20200728
Fix "pgb_reserved_va: Assertion `guest_base != 0' failed." error
 Fix rt_sigtimedwait() errno
 Fix getcwd() errno
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl8gG0MSHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L748hzEP/iAqiBXXZAZMSSk2HeVw1sTLufHxcBCJ
 lRN5UFrb4nuK9e0gHHKuWUN3H5RM/IQiPqtxLfyZTcYrR2o+7UqsJhY39NV+yPpV
 lI+QmqNPRxhXYoq8JZ/Ok3dxgSLulehsVe3Y9UKf0VwzLMlQn9ZVgMrRCtJMydMJ
 pKIvddTyk0Dy+Kwxn6cXm9ewxpy48KzcCJswuZMaT+WzS4ybkq9kJwuKm5mdCdra
 kR069o23ft9eJ+0BjgHraFLErsZeB6rjkGf2ej6pG0JYsqZhXwy5XAR+uyyTHlgP
 m4lXYpJjQJrSuHVbiDSzBE8opxNbnWwUmnjUaE3C5v0nwa4Q1+BO08xfgxjU4ShX
 H5LLh5teGvLUc3NviUKuuJgps171kxLCAc2sjCbcraJhiB/ohg56CF0drY4CGetp
 CgHlN9ig3oEMu+ZKVr4bj/BNbp/wA+kP9SGP4dKj6v2c5AKexNhk59vm5lQ1A9sp
 54p12tafVclkv80yDHI4jB79pSsDO+6g0yIfwq+DIPdvBsjPKuLXVefqWq5M/Auz
 9sIyV2076mGE3r9tn57ah1tnz7BoUALO3v8D4gqnNx37JEiv9Wd2Wn/7FFdJuoPP
 GaVRhfCWMGxkQaAs1UnhWdV69ETfIpyJkoT8scEa34AQUhjM7vibp/NKOGR844tG
 0d3paBzubA1K
 =0GzB
 -----END PGP SIGNATURE-----

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

linux-user 20200728

Fix "pgb_reserved_va: Assertion `guest_base != 0' failed." error
Fix rt_sigtimedwait() errno
Fix getcwd() errno

# gpg: Signature made Tue 28 Jul 2020 13:34:11 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.1-pull-request:
  linux-user: Use getcwd syscall directly
  linux-user: Fix syscall rt_sigtimedwait() implementation
  linux-user: Ensure mmap_min_addr is non-zero

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 17:15:09 +01:00
Peter Maydell
a466dd084f Want to send earlier but most patches just come.
- fix vhost-vdpa issues when no peer
 - fix virtio-pci queue enabling index value
 - forbid reentrant RX
 
 Changes from V1:
 
 - drop the patch that has been merged
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJfH+j9AAoJEO8Ells5jWIRwyUH/jE7GTnTVh+NY5ymMMKPLMEO
 TRWRwtbTzOyTokQWtfQ954/twMbgE6RvR3sN6ahOSHbfARwMRa8nSqymyZptdbq6
 N9K9ZBb9Ns7zBxHQhvz7iUL/Jdjaw5rQ/29gCCnMqHx9J9Fi1dAy8vMGXbpx/H+N
 1AcoMGFU/ShBMuFp7UI6MX/HRaWHzyUSfhHuQmfb9XmwzdLyd22UY2g9f1UMscNz
 MHhUcOuGmEpmijIA5XXOzMIOTYgPoUBoAzfYEIYk3ROerdgUJbcmCAkIFgScoRDM
 +kBwb+G1oFeOcYVfR3Cn1wRL0CQoVxv3gQd3Q9hKNKQd16WNmWCG3C/q2WD/n1w=
 =kMUN
 -----END PGP SIGNATURE-----

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

Want to send earlier but most patches just come.

- fix vhost-vdpa issues when no peer
- fix virtio-pci queue enabling index value
- forbid reentrant RX

Changes from V1:

- drop the patch that has been merged

# gpg: Signature made Tue 28 Jul 2020 09:59:41 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal]
# 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:
  net: forbid the reentrant RX
  virtio-net: check the existence of peer before accessing vDPA config
  virtio-pci: fix wrong index in virtio_pci_queue_enabled

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-07-28 16:28:22 +01:00
Vladimir Sementsov-Ogievskiy
12c75e20a2 block/nbd: nbd_co_reconnect_loop(): don't sleep if drained
We try to go to wakeable sleep, so that, if drain begins it will break
the sleep. But what if nbd_client_co_drain_begin() already called and
s->drained is already true? We'll go to sleep, and drain will have to
wait for the whole timeout. Let's improve it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200727184751.15704-5-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Vladimir Sementsov-Ogievskiy
fbeb3e63b3 block/nbd: on shutdown terminate connection attempt
On shutdown nbd driver may be in a connecting state. We should shutdown
it as well, otherwise we may hang in
nbd_teardown_connection, waiting for conneciton_co to finish in
BDRV_POLL_WHILE(bs, s->connection_co) loop if remote server is down.

How to reproduce the dead lock:

1. Create nbd-fault-injector.conf with the following contents:

[inject-error "mega1"]
event=data
io=readwrite
when=before

2. In one terminal run nbd-fault-injector in a loop, like this:

n=1; while true; do
    echo $n; ((n++));
    ./nbd-fault-injector.py 127.0.0.1:10000 nbd-fault-injector.conf;
done

3. In another terminal run qemu-io in a loop, like this:

n=1; while true; do
    echo $n; ((n++));
    ./qemu-io -c 'read 0 512' nbd://127.0.0.1:10000;
done

After some time, qemu-io will hang. Note, that this hang may be
triggered by another bug, so the whole case is fixed only together with
commit "block/nbd: allow drain during reconnect attempt".

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200727184751.15704-4-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Vladimir Sementsov-Ogievskiy
dd1ec1a4af block/nbd: allow drain during reconnect attempt
It should be safe to reenter qio_channel_yield() on io/channel read/write
path, so it's safe to reduce in_flight and allow attaching new aio
context. And no problem to allow drain itself: connection attempt is
not a guest request. Moreover, if remote server is down, we can hang
in negotiation, blocking drain section and provoking a dead lock.

How to reproduce the dead lock:

1. Create nbd-fault-injector.conf with the following contents:

[inject-error "mega1"]
event=data
io=readwrite
when=before

2. In one terminal run nbd-fault-injector in a loop, like this:

n=1; while true; do
    echo $n; ((n++));
    ./nbd-fault-injector.py 127.0.0.1:10000 nbd-fault-injector.conf;
done

3. In another terminal run qemu-io in a loop, like this:

n=1; while true; do
    echo $n; ((n++));
    ./qemu-io -c 'read 0 512' nbd://127.0.0.1:10000;
done

After some time, qemu-io will hang trying to drain, for example, like
this:

 #3 aio_poll (ctx=0x55f006bdd890, blocking=true) at
    util/aio-posix.c:600
 #4 bdrv_do_drained_begin (bs=0x55f006bea710, recursive=false,
    parent=0x0, ignore_bds_parents=false, poll=true) at block/io.c:427
 #5 bdrv_drained_begin (bs=0x55f006bea710) at block/io.c:433
 #6 blk_drain (blk=0x55f006befc80) at block/block-backend.c:1710
 #7 blk_unref (blk=0x55f006befc80) at block/block-backend.c:498
 #8 bdrv_open_inherit (filename=0x7fffba1563bc
    "nbd+tcp://127.0.0.1:10000", reference=0x0, options=0x55f006be86d0,
    flags=24578, parent=0x0, child_class=0x0, child_role=0,
    errp=0x7fffba154620) at block.c:3491
 #9 bdrv_open (filename=0x7fffba1563bc "nbd+tcp://127.0.0.1:10000",
    reference=0x0, options=0x0, flags=16386, errp=0x7fffba154620) at
    block.c:3513
 #10 blk_new_open (filename=0x7fffba1563bc "nbd+tcp://127.0.0.1:10000",
    reference=0x0, options=0x0, flags=16386, errp=0x7fffba154620) at
    block/block-backend.c:421

And connection_co stack like this:

 #0 qemu_coroutine_switch (from_=0x55f006bf2650, to_=0x7fe96e07d918,
    action=COROUTINE_YIELD) at util/coroutine-ucontext.c:302
 #1 qemu_coroutine_yield () at util/qemu-coroutine.c:193
 #2 qio_channel_yield (ioc=0x55f006bb3c20, condition=G_IO_IN) at
    io/channel.c:472
 #3 qio_channel_readv_all_eof (ioc=0x55f006bb3c20, iov=0x7fe96d729bf0,
    niov=1, errp=0x7fe96d729eb0) at io/channel.c:110
 #4 qio_channel_readv_all (ioc=0x55f006bb3c20, iov=0x7fe96d729bf0,
    niov=1, errp=0x7fe96d729eb0) at io/channel.c:143
 #5 qio_channel_read_all (ioc=0x55f006bb3c20, buf=0x7fe96d729d28
    "\300.\366\004\360U", buflen=8, errp=0x7fe96d729eb0) at
    io/channel.c:247
 #6 nbd_read (ioc=0x55f006bb3c20, buffer=0x7fe96d729d28, size=8,
    desc=0x55f004f69644 "initial magic", errp=0x7fe96d729eb0) at
    /work/src/qemu/master/include/block/nbd.h:365
 #7 nbd_read64 (ioc=0x55f006bb3c20, val=0x7fe96d729d28,
    desc=0x55f004f69644 "initial magic", errp=0x7fe96d729eb0) at
    /work/src/qemu/master/include/block/nbd.h:391
 #8 nbd_start_negotiate (aio_context=0x55f006bdd890,
    ioc=0x55f006bb3c20, tlscreds=0x0, hostname=0x0,
    outioc=0x55f006bf19f8, structured_reply=true,
    zeroes=0x7fe96d729dca, errp=0x7fe96d729eb0) at nbd/client.c:904
 #9 nbd_receive_negotiate (aio_context=0x55f006bdd890,
    ioc=0x55f006bb3c20, tlscreds=0x0, hostname=0x0,
    outioc=0x55f006bf19f8, info=0x55f006bf1a00, errp=0x7fe96d729eb0) at
    nbd/client.c:1032
 #10 nbd_client_connect (bs=0x55f006bea710, errp=0x7fe96d729eb0) at
    block/nbd.c:1460
 #11 nbd_reconnect_attempt (s=0x55f006bf19f0) at block/nbd.c:287
 #12 nbd_co_reconnect_loop (s=0x55f006bf19f0) at block/nbd.c:309
 #13 nbd_connection_entry (opaque=0x55f006bf19f0) at block/nbd.c:360
 #14 coroutine_trampoline (i0=113190480, i1=22000) at
    util/coroutine-ucontext.c:173

Note, that the hang may be
triggered by another bug, so the whole case is fixed only together with
commit "block/nbd: on shutdown terminate connection attempt".

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200727184751.15704-3-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Vladimir Sementsov-Ogievskiy
fa35591b9c block/nbd: split nbd_establish_connection out of nbd_client_connect
We are going to implement non-blocking version of
nbd_establish_connection, which for a while will be used only for
nbd_reconnect_attempt, not for nbd_open, so we need to call it
separately.

Refactor nbd_reconnect_attempt in a way which makes next commit
simpler.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200727184751.15704-2-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Nir Soffer
03a970bb6f iotests: Test convert to qcow2 compressed to NBD
Add test for "qemu-img convert -O qcow2 -c" to NBD target. The tests    
create a OVA file and write compressed qcow2 disk content directly into
the OVA file via qemu-nbd.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20200727215846.395443-5-nsoffer@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Nir Soffer
4b914b01cd iotests: Add more qemu_img helpers
Add 2 helpers for measuring and checking images:
- qemu_img_measure()
- qemu_img_check()

Both use --output-json and parse the returned json to make easy to use
in other tests. I'm going to use them in a new test, and I hope they
will be useful in may other tests.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20200727215846.395443-4-nsoffer@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00
Nir Soffer
b7719bcad2 iotests: Make qemu_nbd_popen() a contextmanager
Instead of duplicating the code to wait until the server is ready and
remember to terminate the server and wait for it, make it possible to
use like this:

    with qemu_nbd_popen('-k', sock, image):
        # Access image via qemu-nbd socket...

Only test 264 used this helper, but I had to modify the output since it
did not consistently when starting and stopping qemu-nbd.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20200727215846.395443-3-nsoffer@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2020-07-28 09:54:43 -05:00