Commit Graph

68388 Commits (dd154c4d9f48a44ad24e13f46033d0f10a05c923)

Author SHA1 Message Date
Kevin Wolf a6aeca0ca5 file-posix: Lock new fd in raw_reopen_prepare()
There is no reason why we can take locks on the new file descriptor only
in raw_reopen_commit() where error handling isn't possible any more.
Instead, we can already do this in raw_reopen_prepare().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf e0c9cf3a48 file-posix: Store BDRVRawState.reopen_state during reopen
We'll want to access the file descriptor in the reopen_state while
processing permission changes in the context of the repoen.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf 5cec287025 file-posix: Factor out raw_reconfigure_getfd()
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf 3085513778 file-posix: Fix bdrv_open_flags() for snapshot=on
Using a different read-only setting for bs->open_flags than for the
flags to the driver's open function is just inconsistent and a bad idea.
After this patch, the temporary snapshot keeps being opened read-only if
read-only=on,snapshot=on is passed.

If we wanted to change this behaviour to make only the orginal image
file read-only, but the temporary overlay read-write (as the comment in
the removed code suggests), that change would have to be made in
bdrv_temp_snapshot_options() (where the comment suggests otherwise).

Addressing this inconsistency before introducing dynamic auto-read-only
is important because otherwise we would immediately try to reopen the
temporary overlay even though the file is already unlinked.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf 69b736e765 block: Make permission changes in reopen less wrong
The way that reopen interacts with permission changes has one big
problem: Both operations are recursive, and the permissions are changes
for each node in the reopen queue.

For a simple graph that consists just of parent and child,
.bdrv_check_perm will be called twice for the child, once recursively
when adjusting the permissions of parent, and once again when the child
itself is reopened.

Even worse, the first .bdrv_check_perm call happens before
.bdrv_reopen_prepare was called for the child and the second one is
called afterwards.

Making sure that .bdrv_check_perm (and the other permission callbacks)
are called only once is hard. We can cope with multiple calls right now,
but as soon as file-posix gets a dynamic auto-read-only that may need to
open a new file descriptor, we get the additional requirement that all
of them are after the .bdrv_reopen_prepare call.

So reorder things in bdrv_reopen_multiple() to first call
.bdrv_reopen_prepare for all involved nodes and only then adjust
permissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf a4615ab31c block: Avoid useless local_err
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf 12efe428c9 qemu-iotests: commit to backing file with auto-read-only
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-12 20:30:14 +01:00
Kevin Wolf 70304118bb tests/virtio-blk-test: Disable auto-read-only
tests/virtio-blk-test uses a temporary image file that it deletes while
QEMU is still running, so it can't be reopened when writers are
attached or detached. Disable auto-read-only to keep it always writable.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-12 20:30:13 +01:00
Vladimir Sementsov-Ogievskiy cb8aac3783 qapi: drop x- from x-block-latency-histogram-set
Drop x- and x_ prefixes for latency histograms and update version to
4.0

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2019-03-12 20:30:08 +01:00
John Snow e2ec4119dc tests/qemu-iotests: add bitmap resize test 246
Test that we can actually resize qcow2 images with persistent bitmaps
correctly. Throw some other goofy stuff at the test while we're at it,
like adding bitmaps of different granularities and at different times.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Tested-by: Eric Blake <eblake@redhat.com>
Message-id: 20190311185147.52309-5-vsementsov@virtuozzo.com
   [vsmentsov: drop \n from the end of test output,
      test output changed a bit: some bitmaps goes in other order
      int the output]
Signed-off-by: John Snow <jsnow@redhat.com>
2019-03-12 15:00:48 -04:00
John Snow d19c6b36ff block/qcow2-bitmap: Allow resizes with persistent bitmaps
Since we now load all bitmaps into memory anyway, we can just truncate
them in-memory and then flush them back to disk. Just in case, we will
still check and enforce that this shortcut is valid -- i.e. that any
bitmap described on-disk is indeed in-memory and can be modified.

If there are any inconsistent bitmaps, we refuse to allow the truncate
as we do not actually load these bitmaps into memory, and it isn't safe
or reasonable to attempt to truncate corrupted data.

Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190311185147.52309-4-vsementsov@virtuozzo.com
  [vsementsov: drop bitmap flushing, fix block comments style]
Signed-off-by: John Snow <jsnow@redhat.com>
2019-03-12 14:57:38 -04:00
Vladimir Sementsov-Ogievskiy bf5f0cf5d8 block/qcow2-bitmap: Don't check size for IN_USE bitmap
We are going to allow image resize when there are persistent bitmaps.
It may lead to appearing of inconsistent bitmaps (IN_USE=1) with
inconsistent size. But we still want to load them as inconsistent.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190311185147.52309-3-vsementsov@virtuozzo.com
Signed-off-by: John Snow <jsnow@redhat.com>
2019-03-12 14:50:28 -04:00
Peter Maydell 9d86712365 qmp-shell: fix nested json regression
One small bug fix.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJchxZ4AAoJECgHk2+YTcWmFicP/2FldAN4G5RWP17k6EK8QB6Z
 zn2708JmtDrTXiVbkhfG+o7d3QxD5uzPFFvN+NLc/fX+pHC5z5NOpIc/Qbqy323J
 GTuonkoUlIRTvWAd4dGV7Q5ZRaCUQjSVk2Jkx1fbnKNKKRNMNibZTzmGPavF5DSg
 nwDZnibrD/OLwM8GWFgwnbrPJywIzhd6m1jw9Bfou3dQ3HU0B3jJxb1m8ptDEarH
 pzrBg6m345+CKRvSfLfdjTRBUTcjPi6rwcmUR2GZE1rIEh9WbFRyz0WxewKLfNbV
 G0F0TQ50J6RAvfiWuZqIqXsMXYnVs35maiN4n/C+FhU4N0zv1OfCg5f9xeCgQYwQ
 WJvqeQpEkeJVoDY/wypmEhuxE+2ykZh6vkqmMIBUbaC+EGaZmBiEuso921s5Lnn+
 qB5nOkdY8qQ6YNi9sxLrJzF74epJgwsR+an9nb9Gzh3+pNCn8XmX+oSSTR16igmM
 7BHloeENOYiOeT89VM0iOk+oBJfFK+7Ed71/e12B/EmwAIJG3JUW/xIqXuv6l0pC
 t60HSjcA/WXMAjH7UNPG1IvQOne/yA1loLbhVo05bvHMaubKcYp4JJ9Kea8pLuxf
 I57k3OfEF0OwsFOS3G8jVbh6wn5zbx9eelyY9q5ELGRbTwCFfJSUU+PuMJRztlfr
 CXBOEqaKfqaRqw79LlCc
 =ivLG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

qmp-shell: fix nested json regression

One small bug fix.

# gpg: Signature made Tue 12 Mar 2019 02:16:24 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  qmp-shell: fix nested json regression

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-03-12 18:31:56 +00:00
Alex Bennée dab3a7c0f5 .travis.yml: add softmmu check-tcg tests
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée df2bb38eda .travis.yml: separate softfloat from check-tcg
While used by TCG it is not explicitly part of TCG and the tests can
be run standalone in a minimal build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée b640728151 tests/tcg/arm: account for pauth randomness
Pointer authentication isn't guaranteed to always detect a clash
between different keys. Take this into account in the test by running
several times and checking the percentage hit rate of the test.

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 8a2af7a70c tests/tcg/i386: add memory test to exercise softmmu
This is a simple test to check various access patterns to memory
including unaligned access.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 40d6ee9450 tests/tcg/i386: add system mode Hello World test
This introduces the build framework for simple i386 system tests. The
first test is the eponymous "Hello World" which simply outputs the
text on the serial port and then exits.

I've included the framework for x86_64 but it is not in this series as
it is a work in progress.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée a113ec989b tests/tcg: provide a minilib for system tests
We will likely want a few common functions to make up for the fact we
don't have a libc and we don't want to feel like we are programming by
banging rocks together.

I've purloined the printf function from:

  https://git.virtualopensystems.com/dev/tcg_baremetal_tests

Although I have tweaked the names to avoid confusing GCC about clashing
with builtins.

Cc: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée d72132c02e tests/tcg: enable cris base user-mode tests
This converts the existing Makefile into a Makefile.target and updates
it so it can be called by the tcg build system. The original Makefile
didn't set -cpu except for the v17 tests however that has broken (I
assume because linux-user is a "max" cpu) so here I force it to be
crisv17.

I've also replicated the GNU simulator targets (run-FOO-on-sim).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée f17365f518 tests/tcg/cris: align mul operations
To avoid:

  Error: dangerous MULS/MULU location; give it higher alignment

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 0056cb5790 tests/tcg/cris: comment out the ccs test
Evidently upstream gcc doesn't like this opcode.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée d4f6e58fcb tests/tcg: split cris tests into bare and libc directories
Bare tests are standalone assembly tests that don't require linking to
any libc and hence can be built with kernel only compilers. The libc
tests need a compiler capable of building properly linked userspace
binaries. As we don't have such a cross compiler at the moment we
won't be building those tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 6b970dd62c tests/tcg/cris: cleanup sys.c
This is a mini library which provides helper functions to the tests
which are all currently written in assembly. A bunch of minor changes:

      - removed libc related headers (fedora-cris-cross is a system compiler)
      - re-organised the functions to avoid forward declarations
      - cleaned up brace usage
      - restored exit for _fail case
      - removed tabs and fixed indentation

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 824ad15f1c tests/docker: add fedora-cris-cross compilers
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Stefan Hajnoczi 647aee9ba2 tests/tcg/arm: add ARMv6-M UNDEFINED 32-bit instruction test
Test that 32-bit instructions declared UNDEFINED in the ARMv6-M
Reference Manual really do raise an exception.  Also test that the 6
32-bit instructions defined in the ARMv6-M Reference Manual do not raise
an exception.

Based-on: <20181029194519.15628-1-stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20181129185113.30353-1-stefanha@redhat.com>
[AJB: integrated into system tests]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée be5cac175a tests/tcg/xtensa: enable system tests
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Philippe Mathieu-Daudé c72d9df181 tests/docker: add debian-xtensa-cross image
Xtensa cpu supported:
- dc232b
- dc233c
- csp

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée b4f396151b tests/tcg/mips: fix hello-mips compilation
The compilation flags for proper building are in the source tree. We
also fix exit to 0 so the result is counted as a success.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée d0ce6257c6 tests/tcg: add gdb runner variant
With this you can launch a test in gdb with:

  cd $(BUILD)/tests
  make -f $(SRC)/tests/tcg/Makefile gdb-$(TEST_NAME)

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée fdfda70e28 tests/tcg: split run-test into user and system variants
We can't rely on shell redirect magic to get things right so lets
setup a common output chardev that is expecting to write to files. As
we have split run-test up we might as well move the default monitor
bits into the call.

Finally a little make sophistry is required to correctly quote
$(COMMA) and as we don't inherit common rules we have our own little
copy here.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 3d55c02624 tests/tcg: add QEMU_OPT option for test runner
This will allow tests to modify the QEMU invocation with for example
different -cpu stazas without having to define a whole new set of
runner types.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée e24e66f06d tests/tcg: enable tcg tests for softmmu
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée bd15e6e004 tests/tcg: add softmmu awareness to Makefile
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 337f2311f9 Makefile: explicitly pass $(BUILD_DIR) to gcovr
Best to be explicit about where to find things.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-03-12 17:05:21 +00:00
Alex Bennée 08a742c89c Makefile: explicitly pass $(SRC_PATH) to gcovr
In an out-of-tree build gcovr can get quite confused about what is
going on otherwise.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-03-12 17:05:21 +00:00
Alex Bennée 2f6c252628 .travis.yml: reduce the module builds to major architectures
The --enable-modules build is consistently tripping the time limit so
reduce our target list to the "major" architectures.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Alex Bennée 956d450673 .travis.yml: combine docs and tools build with out-of-tree
We will be moving all builds out of tree eventually but for now we
need to for building the docs as sphinx requires an out-of-tree build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Philippe Mathieu-Daudé cd7507cbfe travis: Bump Xcode 10 image to 10.2
Travis enforce the use of the git protocol v2 on their images,
but the 'xcode10' image doesn't handle this correctly, resulting
in the brew packages installation failing:

  $ git config protocol.version
  2
  $ rvm $brew_ruby do brew bundle --verbose --global
  /usr/local/bin/brew tap homebrew/bundle
  ==> Tapping homebrew/bundle
  Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'...
  fatal: unknown value for config 'protocol.version': 2
  Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-bundle /usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle --depth=1` exited with 128.
  Error: Failure while executing; `/usr/local/bin/brew tap homebrew/bundle` exited with 1.

The newer 'xcode10.2' beta [*] image doesn't have this limitation.

This image comes with the following brew packages pre-installed,
which extend the current code coverage:
 - libffi
 - libpng
 - libtasn1
 - gnutls
 - jpeg
 - nettle

[*] https://blog.travis-ci.com/2019-02-12-xcode-10-2-beta-2-is-now-available

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190220193541.24419-1-philmd@redhat.com>
[AJB: re-enabled MacOS build first]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2019-03-12 17:05:21 +00:00
Richard Henderson 2decfc9558 decodetree: Properly diagnose fields overflowing an insn
Previously this would result in an exception for shifting
the field mask by a negative number.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 71ecf79bf4 decodetree: Prefix extract function names with decode_function
This makes it easier to name Formats within multiple decode files.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 263ac638a7 decodetree: Allow +- to begin a number initializing a field
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 82bfac1c06 decodetree: Produce clean output for an empty input file
This is interesting for bisection, where an output file is plumbed,
but does not yet have patterns.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson cd3e7fc18d decodetree: Add --static-decode option
Like --decode, but do not drop 'static' qualifier.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Bastian Koppelmann bf92118fa9 test/decode: Add tests for PatternGroups
This adds one test that supposed to succeed to test deep nesting
of pattern groups which is rarely exercised by targets using decode
tree. The remaining tests exercise various fail conditions.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20190227120217.20794-1-kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 0eff2df4a2 decodetree: Allow grouping of overlapping patterns
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson eb6b87fac7 decodetree: Do not unconditionaly return from Pattern.output_code
As a consequence, the 'return false' gets pushed up one level.

This will allow us to perform some other action when the
translator returns failure.

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Philippe Mathieu-Daudé 9b3186e38f decodetree: Ensure build_tree does not include values outside insnmask
Reproduced with "scripts/decodetree.py /dev/null".

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 5d53b0f5d3 decodetree: Document the usefulness of argument sets
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00
Richard Henderson 3fdbf5d679 decodetree: Move documentation to docs/devel/decodetree.rst
One great big block comment isn't the best way to document
the syntax of a language.

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-03-12 09:46:58 -07:00