]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
4 years agocurl: Report only ready sockets
Max Reitz [Tue, 10 Sep 2019 12:41:34 +0000 (14:41 +0200)]
curl: Report only ready sockets

Instead of reporting all sockets to cURL, only report the one that has
caused curl_multi_do_locked() to be called.  This lets us get rid of the
QLIST_FOREACH_SAFE() list, which was actually wrong: SAFE foreaches are
only safe when the current element is removed in each iteration.  If it
possible for the list to be concurrently modified, we cannot guarantee
that only the current element will be removed.  Therefore, we must not
use QLIST_FOREACH_SAFE() here.

Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190910124136.10565-6-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agocurl: Pass CURLSocket to curl_multi_do()
Max Reitz [Tue, 10 Sep 2019 12:41:33 +0000 (14:41 +0200)]
curl: Pass CURLSocket to curl_multi_do()

curl_multi_do_locked() currently marks all sockets as ready.  That is
not only inefficient, but in fact unsafe (the loop is).  A follow-up
patch will change that, but to do so, curl_multi_do_locked() needs to
know exactly which socket is ready; and that is accomplished by this
patch here.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190910124136.10565-5-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agocurl: Check completion in curl_multi_do()
Max Reitz [Tue, 10 Sep 2019 12:41:32 +0000 (14:41 +0200)]
curl: Check completion in curl_multi_do()

While it is more likely that transfers complete after some file
descriptor has data ready to read, we probably should not rely on it.
Better be safe than sorry and call curl_multi_check_completion() in
curl_multi_do(), too, just like it is done in curl_multi_read().

With this change, curl_multi_do() and curl_multi_read() are actually the
same, so drop curl_multi_read() and use curl_multi_do() as the sole FD
handler.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190910124136.10565-4-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agocurl: Keep *socket until the end of curl_sock_cb()
Max Reitz [Tue, 10 Sep 2019 12:41:31 +0000 (14:41 +0200)]
curl: Keep *socket until the end of curl_sock_cb()

This does not really change anything, but it makes the code a bit easier
to follow once we use @socket as the opaque pointer for
aio_set_fd_handler().

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190910124136.10565-3-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agocurl: Keep pointer to the CURLState in CURLSocket
Max Reitz [Tue, 10 Sep 2019 12:41:30 +0000 (14:41 +0200)]
curl: Keep pointer to the CURLState in CURLSocket

A follow-up patch will make curl_multi_do() and curl_multi_read() take a
CURLSocket instead of the CURLState.  They still need the latter,
though, so add a pointer to it to the former.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20190910124136.10565-2-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agotests/qemu-iotests: Fix qemu-io related output in 026.out.nocache
Vladimir Sementsov-Ogievskiy [Fri, 16 Aug 2019 15:30:11 +0000 (18:30 +0300)]
tests/qemu-iotests: Fix qemu-io related output in 026.out.nocache

qemu-io now prefixes its error and warnings with "qemu-io:".
36b9986b08787019e fixed a lot of iotests output but forget about
026.out.nocache. Fix it too.

Fixes: 99e98d7c9fc1a1639fad ("qemu-io: Use error_[gs]et_progname()")
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190816153015.447957-2-vsementsov@virtuozzo.com
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agotests/Makefile: Do not print the name of the check-block.sh shell script
Thomas Huth [Fri, 6 Sep 2019 11:35:34 +0000 (13:35 +0200)]
tests/Makefile: Do not print the name of the check-block.sh shell script

The check script is already printing out which iotest is currently
running, so printing out the name of the check-block.sh shell script
looks superfluous here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 20190906113534.10907-1-thuth@redhat.com
Acked-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agotests/qemu-iotests/check: Replace "tests" with "iotests" in final status text
Thomas Huth [Fri, 6 Sep 2019 11:39:20 +0000 (13:39 +0200)]
tests/qemu-iotests/check: Replace "tests" with "iotests" in final status text

When running "make check -j8" or something similar, the iotests are
running in parallel with the other tests. So when they are printing
out "Passed all xx tests" or a similar status message at the end,
it might not be quite clear that this message belongs to the iotests,
since the output might be mixed with the other tests. Thus change the
word "tests" here to "iotests" instead to avoid confusion.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 20190906113920.11271-1-thuth@redhat.com
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agoblock: Remove unused masks
Nir Soffer [Tue, 27 Aug 2019 18:59:13 +0000 (21:59 +0300)]
block: Remove unused masks

Replace confusing usage:

    ~BDRV_SECTOR_MASK

With more clear:

    (BDRV_SECTOR_SIZE - 1)

Remove BDRV_SECTOR_MASK and the unused BDRV_BLOCK_OFFSET_MASK which was
it's last user.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-id: 20190827185913.27427-3-nsoffer@redhat.com
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agoblock: Use QEMU_IS_ALIGNED
Nir Soffer [Tue, 27 Aug 2019 18:59:12 +0000 (21:59 +0300)]
block: Use QEMU_IS_ALIGNED

Replace instances of:

    (n & (BDRV_SECTOR_SIZE - 1)) == 0

And:

   (n & ~BDRV_SECTOR_MASK) == 0

With:

    QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE)

Which reveals the intent of the code better, and makes it easier to
locate the code checking alignment.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-id: 20190827185913.27427-2-nsoffer@redhat.com
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190913' into...
Peter Maydell [Mon, 16 Sep 2019 09:15:15 +0000 (10:15 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190913' into staging

target-arm queue:
 * aspeed: add a GPIO controller to the SoC
 * aspeed: Various refactorings
 * aspeed: Improve DMA controller modelling
 * atomic_template: fix indentation in GEN_ATOMIC_HELPER
 * qemu-ga: Convert invocation documentation to rST

# gpg: Signature made Fri 13 Sep 2019 16:49:05 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-20190913:
  qemu-ga: Convert invocation documentation to rST
  atomic_template: fix indentation in GEN_ATOMIC_HELPER
  aspeed/scu: Introduce a aspeed_scu_get_apb_freq() routine
  aspeed/scu: Introduce per-SoC SCU types
  aspeed/smc: Calculate checksum on normal DMA
  aspeed/smc: Inject errors in DMA checksum
  aspeed/smc: Add DMA calibration settings
  aspeed/smc: Add support for DMAs
  aspeed: Use consistent typenames
  aspeed: Remove unused SoC definitions
  aspeed: add a GPIO controller to the SoC
  hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoqemu-ga: Convert invocation documentation to rST
Peter Maydell [Thu, 5 Sep 2019 13:10:40 +0000 (14:10 +0100)]
qemu-ga: Convert invocation documentation to rST

The qemu-ga documentation is currently in qemu-ga.texi in
Texinfo format, which we present to the user as:
 * a qemu-ga manpage
 * a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to
the user as:
 * a qemu-ga manpage
 * part of the interop/ Sphinx manual

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 20190905131040.8350-1-peter.maydell@linaro.org

4 years agoatomic_template: fix indentation in GEN_ATOMIC_HELPER
Emilio G. Cota [Fri, 6 Sep 2019 20:26:35 +0000 (21:26 +0100)]
atomic_template: fix indentation in GEN_ATOMIC_HELPER

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/scu: Introduce a aspeed_scu_get_apb_freq() routine
Cédric Le Goater [Wed, 4 Sep 2019 07:05:06 +0000 (09:05 +0200)]
aspeed/scu: Introduce a aspeed_scu_get_apb_freq() routine

The APB frequency can be calculated directly when needed from the
HPLL_PARAM and CLK_SEL register values. This removes useless state in
the model.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-11-clg@kaod.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/scu: Introduce per-SoC SCU types
Cédric Le Goater [Wed, 4 Sep 2019 07:05:05 +0000 (09:05 +0200)]
aspeed/scu: Introduce per-SoC SCU types

and use a class AspeedSCUClass to define each SoC characteristics.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-10-clg@kaod.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/smc: Calculate checksum on normal DMA
Christian Svensson [Wed, 4 Sep 2019 07:05:04 +0000 (09:05 +0200)]
aspeed/smc: Calculate checksum on normal DMA

This patch adds the missing checksum calculation on normal DMA transfer.
According to the datasheet this is how the SMC should behave.

Verified on AST1250 that the hardware matches the behaviour.

Signed-off-by: Christian Svensson <bluecmd@google.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-9-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/smc: Inject errors in DMA checksum
Cédric Le Goater [Wed, 4 Sep 2019 07:05:03 +0000 (09:05 +0200)]
aspeed/smc: Inject errors in DMA checksum

Emulate read errors in the DMA Checksum Register for high frequencies
and optimistic settings of the Read Timing Compensation Register. This
will help in tuning the SPI timing calibration algorithm. Errors are
only injected when the property "inject_failure" is set to true as
suggested by Philippe.

The values below are those to expect from the first flash device of
the FMC controller of a palmetto-bmc machine.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Message-id: 20190904070506.1052-8-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/smc: Add DMA calibration settings
Cédric Le Goater [Wed, 4 Sep 2019 07:05:02 +0000 (09:05 +0200)]
aspeed/smc: Add DMA calibration settings

When doing calibration, the SPI clock rate in the CE0 Control Register
and the read delay cycles in the Read Timing Compensation Register are
set using bit[11:4] of the DMA Control Register.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190904070506.1052-7-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed/smc: Add support for DMAs
Cédric Le Goater [Wed, 4 Sep 2019 07:05:01 +0000 (09:05 +0200)]
aspeed/smc: Add support for DMAs

The FMC controller on the Aspeed SoCs support DMA to access the flash
modules. It can operate in a normal mode, to copy to or from the flash
module mapping window, or in a checksum calculation mode, to evaluate
the best clock settings for reads.

The model introduces two custom address spaces for DMAs: one for the
AHB window of the FMC flash devices and one for the DRAM. The latter
is populated using a "dram" link set from the machine with the RAM
container region.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Joel Stanley <joel@jms.id.au>
Message-id: 20190904070506.1052-6-clg@kaod.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed: Use consistent typenames
Cédric Le Goater [Wed, 4 Sep 2019 07:05:00 +0000 (09:05 +0200)]
aspeed: Use consistent typenames

Improve the naming of the different controller models to ease their
generation when initializing the SoC. The rename of the SMC types is
breaking migration compatibility.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-5-clg@kaod.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed: Remove unused SoC definitions
Cédric Le Goater [Wed, 4 Sep 2019 07:04:59 +0000 (09:04 +0200)]
aspeed: Remove unused SoC definitions

There are no QEMU Aspeed machines using the SoCs "ast2400-a0" or
"ast2400".

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-4-clg@kaod.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoaspeed: add a GPIO controller to the SoC
Rashmica Gupta [Wed, 4 Sep 2019 07:04:58 +0000 (09:04 +0200)]
aspeed: add a GPIO controller to the SoC

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-3-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500
Rashmica Gupta [Wed, 4 Sep 2019 07:04:57 +0000 (09:04 +0200)]
hw/gpio: Add basic Aspeed GPIO model for AST2400 and AST2500

GPIO pins are arranged in groups of 8 pins labeled A,B,..,Y,Z,AA,AB,AC.
(Note that the ast2400 controller only goes up to group AB).
A set has four groups (except set AC which only has one) and is
referred to by the groups it is composed of (eg ABCD,EFGH,...,YZAAAB).
Each set is accessed and controlled by a bank of 14 registers.

These registers operate on a per pin level where each bit in the register
corresponds to a pin, except for the command source registers. The command
source registers operate on a per group level where bits 24, 16, 8 and 0
correspond to each group in the set.

 eg. registers for set ABCD:
 |D7...D0|C7...C0|B7...B0|A7...A0| <- GPIOs
 |31...24|23...16|15....8|7.....0| <- bit position

Note that there are a couple of groups that only have 4 pins.

There are two ways that this model deviates from the behaviour of the
actual controller:
(1) The only control source driving the GPIO pins in the model is the ARM
model (as there currently aren't models for the LPC or Coprocessor).

(2) None of the registers in the model are reset tolerant (needs
integration with the watchdog).

Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Tested-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20190904070506.1052-2-clg@kaod.org
[clg: fixed missing header files
      made use of HWADDR_PRIx to fix compilation on windows ]
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-sep-12-2019' into...
Peter Maydell [Fri, 13 Sep 2019 15:04:46 +0000 (16:04 +0100)]
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-sep-12-2019' into staging

MIPS queue for September 12th, 2019

# gpg: Signature made Thu 12 Sep 2019 17:26:10 BST
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-sep-12-2019:
  target/mips: gdbstub: Revert commit 8e0b373
  hw/mips/mips_jazz: Remove no-longer-necessary override of do_unassigned_access
  target/mips: Switch to do_transaction_failed() hook
  hw/mips/mips_jazz: Override do_transaction_failed hook

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190912a' into...
Peter Maydell [Fri, 13 Sep 2019 13:37:48 +0000 (14:37 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20190912a' into staging

Migration pull 2019-09-12

New feature:
  UUID validation check from Yury Kotov

plus a bunch of fixes.

# gpg: Signature made Thu 12 Sep 2019 14:48:28 BST
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20190912a:
  migration: fix one typo in comment of function migration_total_bytes()
  migration/qemu-file: fix potential buf waste for extra buf_index adjustment
  migration/qemu-file: remove check on writev_buffer in qemu_put_compression_data
  migration: Fix postcopy bw for recovery
  tests/migration: Add a test for validate-uuid capability
  tests/libqtest: Allow setting expected exit status
  migration: Add validate-uuid capability
  qemu-file: Rework old qemu_fflush comment
  migration: register_savevm_live doesn't need dev
  hw/net/vmxnet3: Fix leftover unregister_savevm
  migration: cleanup check on ops in savevm.handlers iterations
  migration: multifd_send_thread always post p->sem_sync when error happen

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 13 Sep 2019 12:43:42 +0000 (13:43 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- qcow2: Allow overwriting multiple compressed clusters at once for
  better performance
- nfs: add support for nfs_umount
- file-posix: write_zeroes fixes
- qemu-io, blockdev-create, pr-manager: Fix crashes and memory leaks
- qcow2: Fix the calculation of the maximum L2 cache size
- vpc: Fix return code for vpc_co_create()
- blockjob: Code cleanup
- iotests improvements (e.g. for use with valgrind)

# gpg: Signature made Fri 13 Sep 2019 11:19:19 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (23 commits)
  qcow2: Stop overwriting compressed clusters one by one
  block/create: Do not abort if a block driver is not available
  qemu-io: Don't leak pattern file in error path
  iotests: extend sleeping time under Valgrind
  iotests: extended timeout under Valgrind
  iotests: Valgrind fails with nonexistent directory
  iotests: Add casenotrun report to bash tests
  iotests: exclude killed processes from running under Valgrind
  iotests: allow Valgrind checking all QEMU processes
  block/nfs: add support for nfs_umount
  block/nfs: tear down aio before nfs_close
  iotests: skip 232 when run tests as root
  iotests: Test blockdev-create for vpc
  iotests: Restrict nbd Python tests to nbd
  iotests: Restrict file Python tests to file
  iotests: Add supported protocols to execute_test()
  vpc: Return 0 from vpc_co_create() on success
  file-posix: Fix has_write_zeroes after NO_FALLBACK
  pr-manager: Fix invalid g_free() crash bug
  iotests: Test reverse sub-cluster qcow2 writes
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Fri, 13 Sep 2019 10:52:11 +0000 (11:52 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Wed 11 Sep 2019 15:36:02 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/block-pull-request:
  virtio-blk: Cancel the pending BH when the dataplane is reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoqcow2: Stop overwriting compressed clusters one by one
Alberto Garcia [Wed, 11 Sep 2019 15:16:26 +0000 (18:16 +0300)]
qcow2: Stop overwriting compressed clusters one by one

handle_alloc() tries to find as many contiguous clusters that need
copy-on-write as possible in order to allocate all of them at the same
time.

However, compressed clusters are only overwritten one by one, so let's
say that we have an image with 1024 consecutive compressed clusters:

   qemu-img create -f qcow2 hd.qcow2 64M
   for f in `seq 0 64 65472`; do
      qemu-io -c "write -c ${f}k 64k" hd.qcow2
   done

In this case trying to overwrite the whole image with one large write
request results in 1024 separate allocations:

   qemu-io -c "write 0 64M" hd.qcow2

This restriction comes from commit 095a9c58ce12afeeb90c2 from 2008.
Nowadays QEMU can overwrite multiple compressed clusters just fine,
and in fact it already does: as long as the first cluster that
handle_alloc() finds is not compressed, all other compressed clusters
in the same batch will be overwritten in one go:

   qemu-img create -f qcow2 hd.qcow2 64M
   qemu-io -c "write -z 0 64k" hd.qcow2
   for f in `seq 64 64 65472`; do
      qemu-io -c "write -c ${f}k 64k" hd.qcow2
   done

Compared to the previous one, overwriting this image on my computer
goes from 8.35s down to 230ms.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: John Snow <jsnow@redhat.com
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoblock/create: Do not abort if a block driver is not available
Philippe Mathieu-Daudé [Wed, 11 Sep 2019 22:08:49 +0000 (00:08 +0200)]
block/create: Do not abort if a block driver is not available

The 'blockdev-create' QMP command was introduced as experimental
feature in commit b0292b851b8, using the assert() debug call.
It got promoted to 'stable' command in 3fb588a0f2c, but the
assert call was not removed.

Some block drivers are optional, and bdrv_find_format() might
return a NULL value, triggering the assertion.

Stable code is not expected to abort, so return an error instead.

This is easily reproducible when libnfs is not installed:

  ./configure
  [...]
  module support    no
  Block whitelist (rw)
  Block whitelist (ro)
  libiscsi support  yes
  libnfs support    no
  [...]

Start QEMU:

  $ qemu-system-x86_64 -S -qmp unix:/tmp/qemu.qmp,server,nowait

Send the 'blockdev-create' with the 'nfs' driver:

  $ ( cat << 'EOF'
  {'execute': 'qmp_capabilities'}
  {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': {'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': '::1', 'type': 'inet'}}}}, 'id': 'x'}
  EOF
  ) | socat STDIO UNIX:/tmp/qemu.qmp
  {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, "package": "v4.1.0-733-g89ea03a7dc"}, "capabilities": ["oob"]}}
  {"return": {}}

QEMU crashes:

  $ gdb qemu-system-x86_64 core
  Program received signal SIGSEGV, Segmentation fault.
  (gdb) bt
  #0  0x00007ffff510957f in raise () at /lib64/libc.so.6
  #1  0x00007ffff50f3895 in abort () at /lib64/libc.so.6
  #2  0x00007ffff50f3769 in _nl_load_domain.cold.0 () at /lib64/libc.so.6
  #3  0x00007ffff5101a26 in .annobin_assert.c_end () at /lib64/libc.so.6
  #4  0x0000555555d7e1f1 in qmp_blockdev_create (job_id=0x555556baee40 "x", options=0x555557666610, errp=0x7fffffffc770) at block/create.c:69
  #5  0x0000555555c96b52 in qmp_marshal_blockdev_create (args=0x7fffdc003830, ret=0x7fffffffc7f8, errp=0x7fffffffc7f0) at qapi/qapi-commands-block-core.c:1314
  #6  0x0000555555deb0a0 in do_qmp_dispatch (cmds=0x55555645de70 <qmp_commands>, request=0x7fffdc005c70, allow_oob=false, errp=0x7fffffffc898) at qapi/qmp-dispatch.c:131
  #7  0x0000555555deb2a1 in qmp_dispatch (cmds=0x55555645de70 <qmp_commands>, request=0x7fffdc005c70, allow_oob=false) at qapi/qmp-dispatch.c:174

With this patch applied, QEMU returns a QMP error:

  {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': {'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': '::1', 'type': 'inet'}}}}, 'id': 'x'}
  {"id": "x", "error": {"class": "GenericError", "desc": "Block driver 'nfs' not found or not supported"}}

Cc: qemu-stable@nongnu.org
Reported-by: Xu Tian <xutian@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoqemu-io: Don't leak pattern file in error path
Kevin Wolf [Tue, 10 Sep 2019 07:03:06 +0000 (09:03 +0200)]
qemu-io: Don't leak pattern file in error path

qemu_io_alloc_from_file() needs to close the pattern file even if some
error occurred.

Setting f = NULL in the success path and checking it for NULL in the
error path isn't strictly necessary at this point, but let's do it
anyway in case someone later adds a 'goto error' after closing the file.

Coverity: CID 1405303
Fixes: 4d731510d34f280ed45a6de621d016f67a49ea48
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
4 years agoiotests: extend sleeping time under Valgrind
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:24 +0000 (12:11 +0300)]
iotests: extend sleeping time under Valgrind

To synchronize the time when QEMU is running longer under the Valgrind,
increase the sleeping time in the test 247.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoiotests: extended timeout under Valgrind
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:23 +0000 (12:11 +0300)]
iotests: extended timeout under Valgrind

As the iotests run longer under the Valgrind, the QEMU_COMM_TIMEOUT is
to be increased in the test cases 028, 183 and 192 when running under
the Valgrind.

Suggested-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoiotests: Valgrind fails with nonexistent directory
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:22 +0000 (12:11 +0300)]
iotests: Valgrind fails with nonexistent directory

The Valgrind uses the exported variable TMPDIR and fails if the
directory does not exist. Let us exclude such a test case from
being run under the Valgrind and notify the user of it.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoiotests: Add casenotrun report to bash tests
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:21 +0000 (12:11 +0300)]
iotests: Add casenotrun report to bash tests

The new function _casenotrun() is to be invoked if a test case cannot
be run for some reason. The user will be notified by a message passed
to the function. It is the caller's responsibility to make skipped a
particular test.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoiotests: exclude killed processes from running under Valgrind
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:20 +0000 (12:11 +0300)]
iotests: exclude killed processes from running under Valgrind

 The Valgrind tool fails to manage its termination in multi-threaded
 processes when they raise the signal SIGKILL. The bug has been reported
 to the Valgrind maintainers and was registered as the bug #409141:
 https://bugs.kde.org/show_bug.cgi?id=409141
 Let's exclude such test cases from running under the Valgrind until a
 new version with the bug fix is released because checking for the
 memory issues is covered by other test cases.

Suggested-by: John Snow <jsnow@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoiotests: allow Valgrind checking all QEMU processes
Andrey Shinkevich [Wed, 4 Sep 2019 09:11:19 +0000 (12:11 +0300)]
iotests: allow Valgrind checking all QEMU processes

With the '-valgrind' option, let all the QEMU processes be run under
the Valgrind tool. The Valgrind own parameters may be set with its
environment variable VALGRIND_OPTS, e.g.
$ VALGRIND_OPTS="--leak-check=yes" ./check -valgrind <test#>
or they may be listed in the Valgrind checked file ./.valgrindrc or
~/.valgrindrc like
--memcheck:leak-check=no
--memcheck:track-origins=yes
To exclude a specific process from running under the Valgrind, the
corresponding environment variable VALGRIND_QEMU_<name> is to be set
to the empty string:
$ VALGRIND_QEMU_IO= ./check -valgrind <test#>
When QEMU-IO process is being killed, the shell report refers to the
text of the command in _qemu_io_wrapper(), which was modified with this
patch. So, the benchmark output for the tests 039, 061 and 137 is to be
changed also.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoblock/nfs: add support for nfs_umount
Peter Lieven [Tue, 10 Sep 2019 15:41:10 +0000 (17:41 +0200)]
block/nfs: add support for nfs_umount

libnfs recently added support for unmounting. Add support
in Qemu too.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoblock/nfs: tear down aio before nfs_close
Peter Lieven [Tue, 10 Sep 2019 15:41:09 +0000 (17:41 +0200)]
block/nfs: tear down aio before nfs_close

nfs_close is a sync call from libnfs and has its own event
handler polling on the nfs FD. Avoid that both QEMU and libnfs
are intefering here.

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/berrange/tags/filemon-test-pull-request' into...
Peter Maydell [Fri, 13 Sep 2019 09:20:28 +0000 (10:20 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/filemon-test-pull-request' into staging

Fix filemonitor test broken with newest Linux kernel

# gpg: Signature made Wed 11 Sep 2019 10:31:05 BST
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/filemon-test-pull-request:
  tests: make filemonitor test more robust to event ordering

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/mips: gdbstub: Revert commit 8e0b373
Libo Zhou [Wed, 11 Sep 2019 13:19:26 +0000 (15:19 +0200)]
target/mips: gdbstub: Revert commit 8e0b373

Multiple reports from users were received regarding failures of
packet 'g' communication with gdb for some MIPS configurations.
It was found out (by bisecting) that the problematic commit is
8e0b373. Revert that commit until a better solution is developed.

Suggested-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Libo Zhou <zhlb29@foxmail.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1568207966-25202-1-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agohw/mips/mips_jazz: Remove no-longer-necessary override of do_unassigned_access
Peter Maydell [Fri, 2 Aug 2019 16:04:58 +0000 (17:04 +0100)]
hw/mips/mips_jazz: Remove no-longer-necessary override of do_unassigned_access

Now that the MIPS CPU implementation uses the new
do_transaction_failed hook, we can remove the old code that handled
the do_unassigned_access hook.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <20190802160458.25681-4-peter.maydell@linaro.org>

4 years agotarget/mips: Switch to do_transaction_failed() hook
Peter Maydell [Fri, 2 Aug 2019 16:04:57 +0000 (17:04 +0100)]
target/mips: Switch to do_transaction_failed() hook

Switch the MIPS target from the old unassigned_access hook to the new
do_transaction_failed hook.

Unlike the old hook, do_transaction_failed is only ever called from
the TCG memory access paths, so there is no need for the "ignore this
if we're using KVM" hack that we were previously using to work around
the way unassigned_access was called for all kinds of memory accesses
to unassigned physical addresses.

The MIPS target does not ever do direct memory reads by physical
address (via either ldl_phys etc or address_space_ldl etc), so the
only memory accesses this affects are the 'normal' guest loads and
stores, which will be handled by the new hook; their behaviour is
unchanged.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <20190802160458.25681-3-peter.maydell@linaro.org>

4 years agohw/mips/mips_jazz: Override do_transaction_failed hook
Peter Maydell [Fri, 2 Aug 2019 16:04:56 +0000 (17:04 +0100)]
hw/mips/mips_jazz: Override do_transaction_failed hook

The MIPS Jazz ('magnum' and 'pica61') boards have some code which
overrides the CPU's do_unassigned_access hook, so they can intercept
it and not raise exceptions on data accesses to invalid addresses,
only for instruction fetches.

We want to switch MIPS over to using the do_transaction_failed
hook instead, so add an intercept for that as well, and make
the board code install whichever hook the CPU is actually using.
Once we've changed the CPU implementation we can remove the
redundant code for the old hook.

Note: I am suspicious that the behaviour as implemented here may not
be what the hardware really does.  It was added in commit
54e755588cf1e90f0b14 to restore the behaviour that was broken by
commit c658b94f6e8c206c59d.  But prior to commit c658b94f6e8c206c59d
every MIPS board generated exceptions for instruction access to
invalid addresses but not for data accesses; and other boards,
notably Malta, were fixed by making all invalid accesses behave as
reads-as-zero (see the call to empty_slot_init() in
mips_malta_init()).  Hardware that raises exceptions for instruction
access and not data access seems to me to be an unlikely design, and
it's possible that the right way to emulate this is to make the Jazz
boards do what we did with Malta (or some variation of that).
Nonetheless, since I don't have access to real hardware to test
against I have taken the approach of "make QEMU continue to behave
the same way it did before this commit".  I have updated the comment
to correct the parts that are no longer accurate and note that
the hardware might behave differently.

The test case for the need for the hook-hijacking is in
https://bugs.launchpad.net/qemu/+bug/1245924 That BIOS will boot OK
either with this overriding of both hooks, or with a simple "global
memory region to ignore bad accesses of all types", so it doesn't
provide evidence either way, unfortunately.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <20190802160458.25681-2-peter.maydell@linaro.org>

4 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.2-pull-request...
Peter Maydell [Thu, 12 Sep 2019 15:17:26 +0000 (16:17 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.2-pull-request' into staging

Add several floppy drive ioctl,
xtensa call0 ABI support, arm MAX_RESERVED_VA for M-profile,
aarch64 AT_HWCAP2, qOffsets' query for ELF, memfd_create,
and some code cleanup

# gpg: Signature made Wed 11 Sep 2019 07:48:45 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-4.2-pull-request:
  linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls
  linux-user: Add support for FDMSGON and FDMSGOFF ioctls
  linux-user: Add support for FDFLUSH ioctl
  linux-user: Add support for FIOGETOWN and FIOSETOWN ioctls
  linux-user: Add support for RNDRESEEDCRNG ioctl
  linux-user: drop redundant handling of environment variables
  target/xtensa: linux-user: add call0 ABI support
  linux-user: Support gdb 'qOffsets' query for ELF
  linux-user/arm: Adjust MAX_RESERVED_VA for M-profile
  linux-user: Pass CPUState to MAX_RESERVED_VA
  linux-user: add memfd_create
  linux-user: fail and report on bad dfilter specs
  linux-user: erroneous fd_trans_unregister call
  linux-user: Add AT_HWCAP2 for aarch64-linux-user
  linux-user: remove useless variable

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agomigration: fix one typo in comment of function migration_total_bytes()
Wei Yang [Thu, 12 Sep 2019 02:49:57 +0000 (10:49 +0800)]
migration: fix one typo in comment of function migration_total_bytes()

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190912024957.11780-1-richardw.yang@linux.intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration/qemu-file: fix potential buf waste for extra buf_index adjustment
Wei Yang [Wed, 11 Sep 2019 13:28:39 +0000 (13:28 +0000)]
migration/qemu-file: fix potential buf waste for extra buf_index adjustment

In add_to_iovec(), qemu_fflush() will be called if iovec is full. If
this happens, buf_index is reset. Currently, this is not checked and
buf_index would always been adjust with buf size.

This is not harmful, but will waste some space in file buffer.

This patch make add_to_iovec() return 1 when it has flushed the file.
Then the caller could check the return value to see whether it is
necessary to adjust the buf_index any more.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190911132839.23336-3-richard.weiyang@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration/qemu-file: remove check on writev_buffer in qemu_put_compression_data
Wei Yang [Wed, 11 Sep 2019 13:28:38 +0000 (13:28 +0000)]
migration/qemu-file: remove check on writev_buffer in qemu_put_compression_data

The check of writev_buffer is in qemu_fflush, which means it is not
harmful if it is NULL.

And removing it will make the code consistent since all other
add_to_iovec() is called without the check.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190911132839.23336-2-richard.weiyang@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration: Fix postcopy bw for recovery
Peter Xu [Fri, 6 Sep 2019 13:01:03 +0000 (21:01 +0800)]
migration: Fix postcopy bw for recovery

We've got max-postcopy-bandwidth parameter but it's not applied
correctly after a postcopy recovery so the recovered migration stream
will still eat the whole net bandwidth.  Fix that up.

Reported-by: Xiaohui Li <xiaohli@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190906130103.20961-1-peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agotests/migration: Add a test for validate-uuid capability
Yury Kotov [Tue, 3 Sep 2019 16:22:46 +0000 (19:22 +0300)]
tests/migration: Add a test for validate-uuid capability

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Message-Id: <20190903162246.18524-4-yury-kotov@yandex-team.ru>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agotests/libqtest: Allow setting expected exit status
Yury Kotov [Tue, 3 Sep 2019 16:22:45 +0000 (19:22 +0300)]
tests/libqtest: Allow setting expected exit status

Add qtest_set_expected_status function to set expected exit status of
child process. By default expected exit status is 0.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Message-Id: <20190903162246.18524-3-yury-kotov@yandex-team.ru>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration: Add validate-uuid capability
Yury Kotov [Tue, 3 Sep 2019 16:22:44 +0000 (19:22 +0300)]
migration: Add validate-uuid capability

This capability realizes simple source validation by UUID.
It's useful for live migration between hosts.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Message-Id: <20190903162246.18524-2-yury-kotov@yandex-team.ru>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agoqemu-file: Rework old qemu_fflush comment
Dr. David Alan Gilbert [Fri, 23 Aug 2019 10:39:46 +0000 (11:39 +0100)]
qemu-file: Rework old qemu_fflush comment

Commit 11808bb removed the non-iovec based write support,
the comment hung on.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190823103946.7388-1-dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration: register_savevm_live doesn't need dev
Dr. David Alan Gilbert [Thu, 22 Aug 2019 11:54:33 +0000 (12:54 +0100)]
migration: register_savevm_live doesn't need dev

Commit 78dd48df3 removed the last caller of register_savevm_live for an
instantiable device (rather than a single system wide device);
so trim out the parameter.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190822115433.12070-1-dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agohw/net/vmxnet3: Fix leftover unregister_savevm
Dr. David Alan Gilbert [Thu, 22 Aug 2019 11:12:18 +0000 (12:12 +0100)]
hw/net/vmxnet3: Fix leftover unregister_savevm

Commit 78dd48df3 reworked vmxnet3's live migration but left a straggling
unregister_savevm call.  Remove it, although it doesn't seem to have
any bad effect.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190822111218.12079-1-dgilbert@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration: cleanup check on ops in savevm.handlers iterations
Wei Yang [Mon, 19 Aug 2019 03:28:04 +0000 (11:28 +0800)]
migration: cleanup check on ops in savevm.handlers iterations

During migration, there are several places to iterate on
savevm.handlers. And on each iteration, we need to check its ops and
related callbacks before invoke it.

Generally, ops is the first element to check, and it is only necessary
to check it once.

This patch clean all the related part in savevm.c to check ops only once
in those iterations.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190819032804.8579-1-richardw.yang@linux.intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agomigration: multifd_send_thread always post p->sem_sync when error happen
Ivan Ren [Thu, 29 Aug 2019 02:16:36 +0000 (10:16 +0800)]
migration: multifd_send_thread always post p->sem_sync when error happen

When encounter error, multifd_send_thread should always notify who pay
attention to it before exit. Otherwise it may block migration_thread
at multifd_send_sync_main forever.

Error as follow:
-------------------------------------------------------------------------------
 (gdb) bt
 #0  0x00007f4d669dfa0b in do_futex_wait.constprop.1 () from /lib64/libpthread.so.0
 #1  0x00007f4d669dfa9f in __new_sem_wait_slow.constprop.0 () from /lib64/libpthread.so.0
 #2  0x00007f4d669dfb3b in sem_wait@@GLIBC_2.2.5 () from /lib64/libpthread.so.0
 #3  0x0000562ccf0a5614 in qemu_sem_wait (sem=sem@entry=0x562cd1b698e8) at util/qemu-thread-posix.c:319
 #4  0x0000562ccecb4752 in multifd_send_sync_main (rs=<optimized out>) at /qemu/migration/ram.c:1099
 #5  0x0000562ccecb95f4 in ram_save_iterate (f=0x562cd0ecc000, opaque=<optimized out>) at /qemu/migration/ram.c:3550
 #6  0x0000562ccef43c23 in qemu_savevm_state_iterate (f=0x562cd0ecc000, postcopy=false) at migration/savevm.c:1189
 #7  0x0000562ccef3dcf3 in migration_iteration_run (s=0x562cd09fabf0) at migration/migration.c:3131
 #8  migration_thread (opaque=opaque@entry=0x562cd09fabf0) at migration/migration.c:3258
 #9  0x0000562ccf0a4c26 in qemu_thread_start (args=<optimized out>) at util/qemu-thread-posix.c:502
 #10 0x00007f4d669d9e25 in start_thread () from /lib64/libpthread.so.0
 #11 0x00007f4d6670635d in clone () from /lib64/libc.so.6
 (gdb) f 4
 #4  0x0000562ccecb4752 in multifd_send_sync_main (rs=<optimized out>) at /qemu/migration/ram.c:1099
 1099         qemu_sem_wait(&p->sem_sync);
 (gdb) list
 1094     }
 1095     for (i = 0; i < migrate_multifd_channels(); i++) {
 1096         MultiFDSendParams *p = &multifd_send_state->params[i];
 1097
 1098         trace_multifd_send_sync_main_wait(p->id);
 1099         qemu_sem_wait(&p->sem_sync);
 1100     }
 1101     trace_multifd_send_sync_main(multifd_send_state->packet_num);
 1102 }
 1103
 (gdb) p i
 $1 = 0
 (gdb)  p multifd_send_state->params[0].pending_job
 $2 = 2    //It means the job before MULTIFD_FLAG_SYNC has already fail
 (gdb)  p multifd_send_state->params[0].quit
 $3 = true

Signed-off-by: Ivan Ren <ivanren@tencent.com>
Message-Id: <1567044996-2362-1-git-send-email-ivanren@tencent.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4 years agotests: make filemonitor test more robust to event ordering
Daniel P. Berrangé [Wed, 21 Aug 2019 15:14:27 +0000 (16:14 +0100)]
tests: make filemonitor test more robust to event ordering

The ordering of events that are emitted during the rmdir
test have changed with kernel >= 5.3. Semantically both
new & old orderings are correct, so we must be able to
cope with either.

To cope with this, when we see an unexpected event, we
push it back onto the queue and look and the subsequent
event to see if that matches instead.

Tested-by: Peter Xu <peterx@redhat.com>
Tested-by: Wei Yang <richardw.yang@linux.intel.com>
Tested-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolinux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls
Aleksandar Markovic [Wed, 4 Sep 2019 12:59:26 +0000 (14:59 +0200)]
linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls

FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls are misc commands
for controlling a floppy drive.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1567601968-26946-7-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Add support for FDMSGON and FDMSGOFF ioctls
Aleksandar Markovic [Wed, 4 Sep 2019 12:59:25 +0000 (14:59 +0200)]
linux-user: Add support for FDMSGON and FDMSGOFF ioctls

FDMSGON and FDMSGOFF switch informational messages of floppy drives
on and off.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1567601968-26946-6-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Add support for FDFLUSH ioctl
Yunqiang Su [Wed, 4 Sep 2019 12:59:24 +0000 (14:59 +0200)]
linux-user: Add support for FDFLUSH ioctl

FDFLUSH is used for flushing buffers of floppy drives. Support in
QEMU is needed because some of Debian packages use this ioctl while
running post-build tests. One such example is 'tar' package.

Signed-off-by: Yunqiang Su <ysu@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1567601968-26946-5-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Add support for FIOGETOWN and FIOSETOWN ioctls
Aleksandar Markovic [Wed, 4 Sep 2019 12:59:23 +0000 (14:59 +0200)]
linux-user: Add support for FIOGETOWN and FIOSETOWN ioctls

FIOGETOWN and FIOSETOWN ioctls have platform-specific definitions,
hence non-standard definition in QEMU too.

Other than that, they both have a single integer argument, and their
functionality is emulated in a straightforward way.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1567601968-26946-4-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Add support for RNDRESEEDCRNG ioctl
Aleksandar Markovic [Wed, 4 Sep 2019 12:59:22 +0000 (14:59 +0200)]
linux-user: Add support for RNDRESEEDCRNG ioctl

RNDRESEEDCRNG is a newer ioctl (added in kernel 4.17), and an
"ifdef" guard is used for that reason in this patch.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1567601968-26946-3-git-send-email-aleksandar.markovic@rt-rk.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: drop redundant handling of environment variables
Max Filippov [Fri, 6 Sep 2019 16:57:36 +0000 (09:57 -0700)]
linux-user: drop redundant handling of environment variables

QEMU_STRACE and QEMU_RAND_SEED are handled by the parse_args, no need to
do it again in main.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190906165736.5612-1-jcmvbkbc@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agotarget/xtensa: linux-user: add call0 ABI support
Max Filippov [Fri, 6 Sep 2019 16:57:13 +0000 (09:57 -0700)]
target/xtensa: linux-user: add call0 ABI support

Xtensa binaries built for call0 ABI don't rotate register window on
function calls and returns. Invocation of signal handlers from the
kernel is therefore different in windowed and call0 ABIs.
There's currently no way to determine xtensa ELF binary ABI from the
binary itself. Add handler for the -xtensa-abi-call0 command line
parameter/QEMU_XTENSA_ABI_CALL0 envitonment variable to the qemu-user
and record ABI choice. Use it to initialize PS.WOE in xtensa_cpu_reset.
Check PS.WOE in setup_rt_frame to determine how a signal should be
delivered.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20190906165713.5558-1-jcmvbkbc@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Support gdb 'qOffsets' query for ELF
Josh Kunz [Fri, 16 Aug 2019 23:34:22 +0000 (16:34 -0700)]
linux-user: Support gdb 'qOffsets' query for ELF

This is needed to support debugging PIE ELF binaries running under QEMU
user mode. Currently, `code_offset` and `data_offset` remain unset for
all ELF binaries, so GDB is unable to correctly locate the position of
the binary's text and data.

The fields `code_offset`, and `data_offset` were originally added way
back in 2006 to support debugging of bFMT executables (978efd6aac6),
and support was just never added for ELF. Since non-PIE binaries are
loaded at exactly the address specified in the binary, GDB does not need
to relocate any symbols, so the buggy behavior is not normally observed.

http://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#index-qOffsets-packet

Buglink: https://bugs.launchpad.net/qemu/+bug/1528239
Signed-off-by: Josh Kunz <jkz@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190816233422.16715-1-jkz@google.com>
[lv: added link to documentation]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user/arm: Adjust MAX_RESERVED_VA for M-profile
Richard Henderson [Thu, 22 Aug 2019 18:59:29 +0000 (11:59 -0700)]
linux-user/arm: Adjust MAX_RESERVED_VA for M-profile

Limit the virtual address space for M-profile cpus to 2GB,
so that we avoid all of the magic addresses in the top half
of the M-profile system map.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190822185929.16891-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: Pass CPUState to MAX_RESERVED_VA
Richard Henderson [Thu, 22 Aug 2019 18:59:28 +0000 (11:59 -0700)]
linux-user: Pass CPUState to MAX_RESERVED_VA

Turn the scalar macro into a functional macro.  Move the creation
of the cpu up a bit within main() so that we can pass it to the
invocation of MAX_RESERVED_VA.  Delay the validation of the -R
parameter until MAX_RESERVED_VA is computed.

So far no changes to any of the MAX_RESERVED_VA macros to actually
use the cpu in any way, but ARM will need it.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190822185929.16891-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: add memfd_create
Shu-Chun Weng [Mon, 19 Aug 2019 18:09:47 +0000 (11:09 -0700)]
linux-user: add memfd_create

Add support for the memfd_create syscall. If the host does not have the
libc wrapper, translate to a direct syscall with NC-macro.

Buglink: https://bugs.launchpad.net/qemu/+bug/1734792
Signed-off-by: Shu-Chun Weng <scw@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190819180947.180725-1-scw@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: fail and report on bad dfilter specs
Alex Bennée [Fri, 30 Aug 2019 14:36:48 +0000 (15:36 +0100)]
linux-user: fail and report on bad dfilter specs

Just passing NULL means we end up ignoring the bad dfilter spec
instead of reporting it and exiting as we should.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190830143648.2967-1-alex.bennee@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agolinux-user: erroneous fd_trans_unregister call
Shu-Chun Weng [Mon, 19 Aug 2019 18:53:48 +0000 (11:53 -0700)]
linux-user: erroneous fd_trans_unregister call

timer_getoverrun returns the "overrun count" for the timer, which is not
a file descriptor and thus should not call fd_trans_unregister on it.

Signed-off-by: Shu-Chun Weng <scw@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190819185348.221825-1-scw@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-100919-2' into...
Peter Maydell [Tue, 10 Sep 2019 13:52:09 +0000 (14:52 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-100919-2' into staging

Testing fixes:

  - podman cleanups
  - docker.py python3 fixes (encode)
  - DEF_TARGET_LIST applied to cross build images
  - move a bunch to Buster based images
  - enable Travis caching
  - more common objs for faster builds
  - stable URLs for acceptance tests
  - additional travis dependencies
  - work around ppc64abi32 linux-test breakage [v2]

# gpg: Signature made Tue 10 Sep 2019 14:16:00 BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-next-100919-2: (46 commits)
  tests/tcg: fix typo when calling clean-tcg
  travis.yml: Install libcap-dev for testing virito-9p
  Fedora images: use URLs from stable "archives.fedoraproject.org"
  .travis.yml: Cache Linux/Clang jobs together
  .travis.yml: Cache Linux/GCC 'non-debug profile' jobs together
  .travis.yml: Cache Linux/GCC 'debug profile' jobs together
  .travis.yml: Document how the build matrix use caches
  .travis.yml: Enable ccache on OSX
  .travis.yml: Improve ccache use
  .travis.yml: Cache Avocado cache
  .travis.yml: Cache Python PIP packages
  .travis.yml: Increase cache timeout from 3min to 20min
  .travis.yml: Enable multiple caching features
  configure: check if --no-pie is supported first
  tests/docker: --disable-libssh on ubuntu1804 builds
  tests/docker: add more images to PARTIAL_IMAGES when not on x86_64
  tests/docker: use --arch-only for installing deps
  tests/docker: add debian-amd64-cross for non-x86 hosts
  tests/docker: avoid $SHELL invoke bash directly
  tests/docker: add debian9-mxe to DEBIAN_PARTIAL_IMAGES
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotests/tcg: fix typo when calling clean-tcg
Alex Bennée [Tue, 10 Sep 2019 12:09:31 +0000 (13:09 +0100)]
tests/tcg: fix typo when calling clean-tcg

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotravis.yml: Install libcap-dev for testing virito-9p
Thomas Huth [Thu, 5 Sep 2019 11:33:46 +0000 (13:33 +0200)]
travis.yml: Install libcap-dev for testing virito-9p

So far we were not testing virtio-9p in Travis yet, since we forgot to
install libcap-devel. Do it now to get some more test coverage.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Greg Kurz <groug@kaod.org>
Tested-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190905113346.2473-1-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agoFedora images: use URLs from stable "archives.fedoraproject.org"
Cleber Rosa [Wed, 4 Sep 2019 00:52:18 +0000 (20:52 -0400)]
Fedora images: use URLs from stable "archives.fedoraproject.org"

The LinuxInitrd.test_with_2gib_file_should_work_with_linux_v4_16 test,
from tests/acceptance/linux_initrd.py, is currently failing to fetch
the "vmlinuz" file.  The reason for the failure is that the Fedora
project retires older versions from the "dl.fedoraproject.org" URL,
and keeps them in "archives.fedoraproject.org".  As an added note,
that test uses a Fedora 28 image, because of the specific Linux kernel
version requirements of the test.

For the sake of stability, let's use URLs from the archived and
supposedely ever stable URLs.  The good news is that the currently
supported versions are also hosted on the later.  This change limits
itself to change the URLs, while keeping the fetched files the same
(as can be evidenced by the unchanged hashes).

Documentation and the "vm tests" fedora definition were also updated.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Yash Mankad <ymankad@redhat.com>
Message-Id: <20190904005218.12536-1-crosa@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Cache Linux/Clang jobs together
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:49 +0000 (15:26 +0200)]
.travis.yml: Cache Linux/Clang jobs together

These jobs build different components but use the same
host features. Put them in the same cache bucket.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Cache Linux/GCC 'non-debug profile' jobs together
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:48 +0000 (15:26 +0200)]
.travis.yml: Cache Linux/GCC 'non-debug profile' jobs together

These jobs build different components but use the same
host features. Put them in the same cache bucket.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Cache Linux/GCC 'debug profile' jobs together
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:47 +0000 (15:26 +0200)]
.travis.yml: Cache Linux/GCC 'debug profile' jobs together

These jobs build different components but use the same
host features. Put them in the same cache bucket.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Document how the build matrix use caches
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:46 +0000 (15:26 +0200)]
.travis.yml: Document how the build matrix use caches

We will set the CACHE_NAME variable to improve the caching
of various jobs using the same characteristics. Document it
first.

See https://docs.travis-ci.com/user/caching/#caches-and-build-matrices

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Enable ccache on OSX
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:45 +0000 (15:26 +0200)]
.travis.yml: Enable ccache on OSX

By default, ccache is not installed on macOS environments.

See https://docs.travis-ci.com/user/caching/#ccache-on-macos

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Improve ccache use
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:44 +0000 (15:26 +0200)]
.travis.yml: Improve ccache use

Per https://ccache.dev/manual/latest.html:

  By default, ccache tries to give as few false cache hits as
  possible. However, in certain situations it’s possible that
  you know things that ccache can’t take for granted.

  [The CCACHE_SLOPINESS environment variable] makes it possible
  to tell ccache to relax some checks in order to increase the
  hit rate.

We can relax the ctime/mtime header checks:

  - include_file_ctime

    By default, ccache also will not cache a file if it
    includes a header whose ctime is too new. This option
    disables that check.

  - include_file_mtime

    By default, ccache will not cache a file if it includes
    a header whose mtime is too new. This option disables
    that check.

We also add a call to clear the cache statistics before running
the build, and display them when the build finishes.

See https://docs.travis-ci.com/user/caching/#ccache-cache

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Cache Avocado cache
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:43 +0000 (15:26 +0200)]
.travis.yml: Cache Avocado cache

Avocado tests download artifacts from various sources.
These sources sometime have network issues resulting in build
failures. Cache Avocado cache to reduce build failure.

See https://docs.travis-ci.com/user/caching/#arbitrary-directories

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Cache Python PIP packages
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:42 +0000 (15:26 +0200)]
.travis.yml: Cache Python PIP packages

We always install the same packages ever and ever, cache them.

See https://docs.travis-ci.com/user/caching/#pip-cache

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Increase cache timeout from 3min to 20min
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:41 +0000 (15:26 +0200)]
.travis.yml: Increase cache timeout from 3min to 20min

We are going to cache few gigabytes, increase the cache timeout
to avoid build failures when uploading our cache.

See https://docs.travis-ci.com/user/caching/#setting-the-timeout

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years ago.travis.yml: Enable multiple caching features
Philippe Mathieu-Daudé [Tue, 3 Sep 2019 13:26:40 +0000 (15:26 +0200)]
.travis.yml: Enable multiple caching features

Using the 'multiple caching features' means explode the YAML array,
thus it eases the git workflow (it is easier to move patches around).

See https://docs.travis-ci.com/user/caching#enabling-multiple-caching-features

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20170809202712.6951-4-f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agoconfigure: check if --no-pie is supported first
Alex Bennée [Thu, 15 Aug 2019 19:41:51 +0000 (19:41 +0000)]
configure: check if --no-pie is supported first

For whatever reason this doesn't trigger normally but because
compile_prog uses QEMU_CFLAGS we end up trying to build a -pie
--no-pie build which confuses compilers on some non-x86 hosts.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotests/docker: --disable-libssh on ubuntu1804 builds
Alex Bennée [Wed, 4 Sep 2019 18:07:14 +0000 (19:07 +0100)]
tests/docker: --disable-libssh on ubuntu1804 builds

Currently this stops the mega:

  make docker-test-build

from working. Once the source is patched to deal with the case this
workaround can be removed.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: add more images to PARTIAL_IMAGES when not on x86_64
Alex Bennée [Thu, 15 Aug 2019 19:40:48 +0000 (19:40 +0000)]
tests/docker: add more images to PARTIAL_IMAGES when not on x86_64

This prevents us trying to do builds which we can't complete.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotests/docker: use --arch-only for installing deps
Alex Bennée [Thu, 15 Aug 2019 19:39:16 +0000 (19:39 +0000)]
tests/docker: use --arch-only for installing deps

The Debian QEMU packages require a bunch of cross compilers for
building firmware which aren't available on all host architectures.
Using --arch-only skips this particular requirement and allows us to
install just the dependencies we need.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: add debian-amd64-cross for non-x86 hosts
Alex Bennée [Wed, 14 Aug 2019 15:25:50 +0000 (15:25 +0000)]
tests/docker: add debian-amd64-cross for non-x86 hosts

When building on a non-x86 host we need to setup the x86 build like
any other cross compiler.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotests/docker: avoid $SHELL invoke bash directly
Alex Bennée [Wed, 14 Aug 2019 09:54:26 +0000 (10:54 +0100)]
tests/docker: avoid $SHELL invoke bash directly

On some images SHELL is pointing at a limited /bin/sh which doesn't
understand noprofile/norc. Given the run script is running bash just
invoke it directly.

This fixes:

  $ make docker-test-build@IMAGE DEBUG=1
  [...]
  + echo '  ./test-build'
  ./test-build
  + echo '* Hit Ctrl-D to continue, or type '\''exit 1'\'' to abort'
  * Hit Ctrl-D to continue, or type 'exit 1' to abort
  + echo
  + /bin/sh --noprofile --norc
  /bin/sh: 0: Illegal option --

Fixes: 2b0c4fa13f3
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: add debian9-mxe to DEBIAN_PARTIAL_IMAGES
Alex Bennée [Wed, 14 Aug 2019 11:06:31 +0000 (12:06 +0100)]
tests/docker: add debian9-mxe to DEBIAN_PARTIAL_IMAGES

Another image that can't be used directly to build QEMU.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: add debian-xtensa-cross to DEBIAN_PARTIAL_IMAGES
Alex Bennée [Tue, 13 Aug 2019 16:09:43 +0000 (17:09 +0100)]
tests/docker: add debian-xtensa-cross to DEBIAN_PARTIAL_IMAGES

This should have been marked when the docker recipe was added to
prevent it being used for cross compiling QEMU. Sort the
DEBIAN_PARTIAL_IMAGE list while we are at it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: pin powerpc-user-cross to a snapshot
Alex Bennée [Mon, 9 Sep 2019 10:11:49 +0000 (11:11 +0100)]
tests/docker: pin powerpc-user-cross to a snapshot

Now Jessie has entered LTS the powerpc architecture has been dropped
so we can no longer build the image from scratch. However we can use
the snapshot archive to build the last working version.

This now only lives on an example of setting up a user-cross image as
at least on x86-64 we can use the Buster packaged cross compiler for
building test images.

Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotests/docker: update Debian Sid image
Alex Bennée [Mon, 9 Sep 2019 09:43:46 +0000 (10:43 +0100)]
tests/docker: update Debian Sid image

While we are not currently using it we might as well keep the image
for later usage. So:

  - update to a more recent snapshot
  - clean up verbiage in commentary
  - remove duplicate shell from a merge failure

Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our ppc64 cross compile to Buster
Alex Bennée [Tue, 13 Aug 2019 14:57:39 +0000 (15:57 +0100)]
tests/docker: move our ppc64 cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our riscv64 cross compile to Buster
Alex Bennée [Tue, 13 Aug 2019 14:53:46 +0000 (15:53 +0100)]
tests/docker: move our riscv64 cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our mips64 cross compile to Buster
Alex Bennée [Tue, 13 Aug 2019 14:47:50 +0000 (15:47 +0100)]
tests/docker: move our mips64 cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our sh4 cross compile to Buster
Alex Bennée [Tue, 13 Aug 2019 14:24:32 +0000 (15:24 +0100)]
tests/docker: move our sh4 cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our sparc64 cross compile to Buster
Alex Bennée [Tue, 13 Aug 2019 14:16:48 +0000 (15:16 +0100)]
tests/docker: move our sparc64 cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: move our m68k cross compile to Buster
Alex Bennée [Mon, 12 Aug 2019 16:07:37 +0000 (17:07 +0100)]
tests/docker: move our m68k cross compile to Buster

Now Buster is released we can stop relying on the movable feast that
is Sid for our cross-compiler for building tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>