Testing and plugin updates:

- custom runner playbooks for configuring GitLab runners
   - integrate Cirrus jobs into GitLab via cirrus-run
   - clean-up docker package lists
   - bump NetBSD to 9.2
   - bump OpenBSD to 6.9
   - make test-mmap more hexagon friendly
   - fixup handling of hostaddr for plugins
   - disallow some incompatible plugin configurations
   - fix handling of -ldl for BSDs
   - remove some old unused symbols from the plugin symbol map
   - enable plugins by default for most TCG builds
   - honour main build -Wall settings for plugins
   - new execlog plugin
   - new cache modelling plugin
   - fix io_uring build regression
   - disable modular TCG on Darwin
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmDu+xsACgkQ+9DbCVqe
 KkQ2XAf+MRBeSMX9J091iloiqSjpuobAcVuoIFciG7gEqWd2iTQVPDqJNgBJUANQ
 vTA7f89ljxj/FZjSZwLgR6cqY6X0ufXI1BLEIt7s78LJtVp14sHVo89GwNBzmRwo
 615T49KG8b5EBBU5YlVcAW/m8DlfgI4b1ufS/qHldOukKegu+haoCDjGG6RNpYNx
 mmXgLOBJiB/p2u2S73KTIa+3AEIIlsTJZpdLPus8hby+/Q4qB9t8YbdHaweyM9qs
 NjiojczvlbHLFd/IQSl6fqBS9QI+KWf4+oFd6ZB4THhr9/GUYTiMeLjRKucBgDQG
 TwGtd1RN3gAPI5aEJ0xlgCL/crz1qg==
 =dQl6
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-plugins-140721-5' into staging

Testing and plugin updates:

  - custom runner playbooks for configuring GitLab runners
  - integrate Cirrus jobs into GitLab via cirrus-run
  - clean-up docker package lists
  - bump NetBSD to 9.2
  - bump OpenBSD to 6.9
  - make test-mmap more hexagon friendly
  - fixup handling of hostaddr for plugins
  - disallow some incompatible plugin configurations
  - fix handling of -ldl for BSDs
  - remove some old unused symbols from the plugin symbol map
  - enable plugins by default for most TCG builds
  - honour main build -Wall settings for plugins
  - new execlog plugin
  - new cache modelling plugin
  - fix io_uring build regression
  - disable modular TCG on Darwin

# gpg: Signature made Wed 14 Jul 2021 15:56:27 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-and-plugins-140721-5: (44 commits)
  MAINTAINERS: Added myself as a reviewer for TCG Plugins
  docs/devel: Added cache plugin to the plugins docs
  plugins/cache: Added FIFO and LRU eviction policies
  plugins/cache: Enable cache parameterization
  plugins: Added a new cache modelling plugin
  docs/devel: tcg-plugins: add execlog plugin description
  contrib/plugins: add execlog to log instruction execution and memory access
  contrib/plugins: enable -Wall for building plugins
  tcg/plugins: enable by default for most TCG builds
  configure: stop user enabling plugins on Windows for now
  configure: add an explicit static and plugins check
  configure: don't allow plugins to be enabled for a non-TCG build
  tcg/plugins: remove some stale entries from the symbol list
  meson.build: relax the libdl test to one for the function dlopen
  meson.build: move TCG plugin summary output
  plugins: fix-up handling of internal hostaddr for 32 bit
  tests/tcg: make test-mmap a little less aggressive
  tests/vm: update openbsd to release 6.9
  tests/vm: update NetBSD to 9.2
  tests/docker: expand opensuse-leap package list
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-07-15 16:06:12 +01:00
commit 438951e883
59 changed files with 2220 additions and 372 deletions

View File

@ -1,61 +1,6 @@
env:
CIRRUS_CLONE_DEPTH: 1
freebsd_12_task:
freebsd_instance:
image_family: freebsd-12-2
cpu: 8
memory: 8G
install_script:
- ASSUME_ALWAYS_YES=yes pkg bootstrap -f ;
- pkg install -y bash curl cyrus-sasl git glib gmake gnutls gsed
nettle perl5 pixman pkgconf png usbredir ninja
script:
- mkdir build
- cd build
# TODO: Enable gnutls again once FreeBSD's libtasn1 got fixed
# See: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71
- ../configure --enable-werror --disable-gnutls
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake -j$(sysctl -n hw.ncpu) check V=1
macos_task:
osx_instance:
image: catalina-base
install_script:
- brew install pkg-config python gnu-sed glib pixman make sdl2 bash ninja
script:
- mkdir build
- cd build
- ../configure --python=/usr/local/bin/python3 --enable-werror
--extra-cflags='-Wno-error=deprecated-declarations'
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake check-unit V=1
- gmake check-block V=1
- gmake check-qapi-schema V=1
- gmake check-softfloat V=1
- gmake check-qtest-x86_64 V=1
macos_xcode_task:
osx_instance:
# this is an alias for the latest Xcode
image: catalina-xcode
install_script:
- brew install pkg-config gnu-sed glib pixman make sdl2 bash ninja
script:
- mkdir build
- cd build
- ../configure --extra-cflags='-Wno-error=deprecated-declarations' --enable-modules
--enable-werror --cc=clang || { cat config.log meson-logs/meson-log.txt; exit 1; }
- gmake -j$(sysctl -n hw.ncpu)
- gmake check-unit V=1
- gmake check-block V=1
- gmake check-qapi-schema V=1
- gmake check-softfloat V=1
- gmake check-qtest-x86_64 V=1
windows_msys2_task:
timeout_in: 90m
windows_container:

View File

@ -354,29 +354,6 @@ build-some-softmmu:
TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
MAKE_CHECK_ARGS: check-tcg
# Run check-tcg against linux-user (with plugins)
# we skip sparc64-linux-user until it has been fixed somewhat
# we skip cris-linux-user as it doesn't use the common run loop
build-user-plugins:
extends: .native_build_job_template
needs:
job: amd64-debian-user-cross-container
variables:
IMAGE: debian-all-test-cross
CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
MAKE_CHECK_ARGS: check-tcg
timeout: 1h 30m
build-some-softmmu-plugins:
extends: .native_build_job_template
needs:
job: amd64-debian-user-cross-container
variables:
IMAGE: debian-all-test-cross
CONFIGURE_ARGS: --disable-tools --disable-user --enable-plugins --enable-debug-tcg
TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
MAKE_CHECK_ARGS: check-tcg
clang-system:
extends: .native_build_job_template
needs:

102
.gitlab-ci.d/cirrus.yml Normal file
View File

@ -0,0 +1,102 @@
# Jobs that we delegate to Cirrus CI because they require an operating
# system other than Linux. These jobs will only run if the required
# setup has been performed on the GitLab account.
#
# The Cirrus CI configuration is generated by replacing target-specific
# variables in a generic template: some of these variables are provided
# when the GitLab CI job is defined, others are taken from a shell
# snippet generated using lcitool.
#
# Note that the $PATH environment variable has to be treated with
# special care, because we can't just override it at the GitLab CI job
# definition level or we risk breaking it completely.
.cirrus_build_job:
stage: build
image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
needs: []
allow_failure: true
script:
- source .gitlab-ci.d/cirrus/$NAME.vars
- sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
-e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
-e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
-e "s|[@]CIRRUS_VM_INSTANCE_TYPE@|$CIRRUS_VM_INSTANCE_TYPE|g"
-e "s|[@]CIRRUS_VM_IMAGE_SELECTOR@|$CIRRUS_VM_IMAGE_SELECTOR|g"
-e "s|[@]CIRRUS_VM_IMAGE_NAME@|$CIRRUS_VM_IMAGE_NAME|g"
-e "s|[@]CIRRUS_VM_CPUS@|$CIRRUS_VM_CPUS|g"
-e "s|[@]CIRRUS_VM_RAM@|$CIRRUS_VM_RAM|g"
-e "s|[@]UPDATE_COMMAND@|$UPDATE_COMMAND|g"
-e "s|[@]INSTALL_COMMAND@|$INSTALL_COMMAND|g"
-e "s|[@]PATH@|$PATH_EXTRA${PATH_EXTRA:+:}\$PATH|g"
-e "s|[@]PKG_CONFIG_PATH@|$PKG_CONFIG_PATH|g"
-e "s|[@]PKGS@|$PKGS|g"
-e "s|[@]MAKE@|$MAKE|g"
-e "s|[@]PYTHON@|$PYTHON|g"
-e "s|[@]PIP3@|$PIP3|g"
-e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
-e "s|[@]CONFIGURE_ARGS@|$CONFIGURE_ARGS|g"
-e "s|[@]TEST_TARGETSS@|$TEST_TARGETSS|g"
<.gitlab-ci.d/cirrus/build.yml >.gitlab-ci.d/cirrus/$NAME.yml
- cat .gitlab-ci.d/cirrus/$NAME.yml
- cirrus-run -v --show-build-log always .gitlab-ci.d/cirrus/$NAME.yml
rules:
- if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"
x64-freebsd-12-build:
extends: .cirrus_build_job
variables:
NAME: freebsd-12
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-12-2
CIRRUS_VM_CPUS: 8
CIRRUS_VM_RAM: 8G
UPDATE_COMMAND: pkg update
INSTALL_COMMAND: pkg install -y
# TODO: Enable gnutls again once FreeBSD's libtasn1 got fixed
# See: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71
CONFIGURE_ARGS: --disable-gnutls
TEST_TARGETS: check
x64-freebsd-13-build:
extends: .cirrus_build_job
variables:
NAME: freebsd-13
CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
CIRRUS_VM_IMAGE_SELECTOR: image_family
CIRRUS_VM_IMAGE_NAME: freebsd-13-0
CIRRUS_VM_CPUS: 8
CIRRUS_VM_RAM: 8G
UPDATE_COMMAND: pkg update
INSTALL_COMMAND: pkg install -y
TEST_TARGETS: check
x64-macos-11-base-build:
extends: .cirrus_build_job
variables:
NAME: macos-11
CIRRUS_VM_INSTANCE_TYPE: osx_instance
CIRRUS_VM_IMAGE_SELECTOR: image
CIRRUS_VM_IMAGE_NAME: big-sur-base
CIRRUS_VM_CPUS: 12
CIRRUS_VM_RAM: 24G
UPDATE_COMMAND: brew update
INSTALL_COMMAND: brew install
PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
x64-macos-11-xcode-build:
extends: .cirrus_build_job
variables:
NAME: macos-11
CIRRUS_VM_INSTANCE_TYPE: osx_instance
CIRRUS_VM_IMAGE_SELECTOR: image
CIRRUS_VM_IMAGE_NAME: big-sur-xcode
CIRRUS_VM_CPUS: 12
CIRRUS_VM_RAM: 24G
UPDATE_COMMAND: brew update
INSTALL_COMMAND: brew install
PATH_EXTRA: /usr/local/opt/ccache/libexec:/usr/local/opt/gettext/bin
PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig
TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64

View File

@ -0,0 +1,54 @@
Cirrus CI integration
=====================
GitLab CI shared runners only provide a docker environment running on Linux.
While it is possible to provide private runners for non-Linux platforms this
is not something most contributors/maintainers will wish to do.
To work around this limitation, we take advantage of `Cirrus CI`_'s free
offering: more specifically, we use the `cirrus-run`_ script to trigger Cirrus
CI jobs from GitLab CI jobs so that Cirrus CI job output is integrated into
the main GitLab CI pipeline dashboard.
There is, however, some one-time setup required. If you want FreeBSD and macOS
builds to happen when you push to your GitLab repository, you need to
* set up a GitHub repository for the project, eg. ``yourusername/qemu``.
This repository needs to exist for cirrus-run to work, but it doesn't need to
be kept up to date, so you can create it and then forget about it;
* enable the `Cirrus CI GitHub app`_ for your GitHub account;
* sign up for Cirrus CI. It's enough to log into the website using your GitHub
account;
* grab an API token from the `Cirrus CI settings`_ page;
* it may be necessary to push an empty ``.cirrus.yml`` file to your github fork
for Cirrus CI to properly recognize the project. You can check whether
Cirrus CI knows about your project by navigating to:
``https://cirrus-ci.com/yourusername/qemu``
* in the *CI/CD / Variables* section of the settings page for your GitLab
repository, create two new variables:
* ``CIRRUS_GITHUB_REPO``, containing the name of the GitHub repository
created earlier, eg. ``yourusername/qemu``;
* ``CIRRUS_API_TOKEN``, containing the Cirrus CI API token generated earlier.
This variable **must** be marked as *Masked*, because anyone with knowledge
of it can impersonate you as far as Cirrus CI is concerned.
Neither of these variables should be marked as *Protected*, because in
general you'll want to be able to trigger Cirrus CI builds from non-protected
branches.
Once this one-time setup is complete, you can just keep pushing to your GitLab
repository as usual and you'll automatically get the additional CI coverage.
.. _Cirrus CI GitHub app: https://github.com/marketplace/cirrus-ci
.. _Cirrus CI settings: https://cirrus-ci.com/settings/profile/
.. _Cirrus CI: https://cirrus-ci.com/
.. _cirrus-run: https://github.com/sio/cirrus-run/

View File

@ -0,0 +1,35 @@
@CIRRUS_VM_INSTANCE_TYPE@:
@CIRRUS_VM_IMAGE_SELECTOR@: @CIRRUS_VM_IMAGE_NAME@
cpu: @CIRRUS_VM_CPUS@
memory: @CIRRUS_VM_RAM@
env:
CIRRUS_CLONE_DEPTH: 1
CI_REPOSITORY_URL: "@CI_REPOSITORY_URL@"
CI_COMMIT_REF_NAME: "@CI_COMMIT_REF_NAME@"
CI_COMMIT_SHA: "@CI_COMMIT_SHA@"
PATH: "@PATH@"
PKG_CONFIG_PATH: "@PKG_CONFIG_PATH@"
PYTHON: "@PYTHON@"
MAKE: "@MAKE@"
CONFIGURE_ARGS: "@CONFIGURE_ARGS@"
build_task:
install_script:
- @UPDATE_COMMAND@
- @INSTALL_COMMAND@ @PKGS@
- if test -n "@PYPI_PKGS@" ; then @PIP3@ install @PYPI_PKGS@ ; fi
clone_script:
- git clone --depth 100 "$CI_REPOSITORY_URL" .
- git fetch origin "$CI_COMMIT_REF_NAME"
- git reset --hard "$CI_COMMIT_SHA"
build_script:
- mkdir build
- cd build
- ../configure --enable-werror $CONFIGURE_ARGS
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
- $MAKE -j$(sysctl -n hw.ncpu)
- for TARGET in $TEST_TARGETS ;
do
$MAKE -j$(sysctl -n hw.ncpu) $TARGET V=1 ;
done

View File

@ -0,0 +1,13 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool variables freebsd-12 qemu
#
# https://gitlab.com/libvirt/libvirt-ci/-/commit/c7e275ab27ac0dcd09da290817b9adeea1fd1eb1
PACKAGING_COMMAND='pkg'
CCACHE='/usr/local/bin/ccache'
MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PYTHON='/usr/local/bin/python3'
PIP3='/usr/local/bin/pip-3.8'
PKGS='alsa-lib bash bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage ctags curl cyrus-sasl dbus diffutils gettext git glib gmake gnutls gsed gtk3 libepoxy libffi libgcrypt libjpeg-turbo libnfs libspice-server libssh libtasn1 libxml2 llvm lttng-ust lzo2 meson ncurses nettle ninja opencv p5-Test-Harness perl5 pixman pkgconf png py38-numpy py38-pillow py38-pip py38-sphinx py38-sphinx_rtd_theme py38-virtualenv py38-yaml python3 rpm2cpio sdl2 sdl2_image snappy spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'

View File

@ -0,0 +1,13 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool variables freebsd-13 qemu
#
# https://gitlab.com/libvirt/libvirt-ci/-/commit/c7e275ab27ac0dcd09da290817b9adeea1fd1eb1
PACKAGING_COMMAND='pkg'
CCACHE='/usr/local/bin/ccache'
MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PYTHON='/usr/local/bin/python3'
PIP3='/usr/local/bin/pip-3.8'
PKGS='alsa-lib bash bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage ctags curl cyrus-sasl dbus diffutils gettext git glib gmake gnutls gsed gtk3 libepoxy libffi libgcrypt libjpeg-turbo libnfs libspice-server libssh libtasn1 libxml2 llvm lttng-ust lzo2 meson ncurses nettle ninja opencv p5-Test-Harness perl5 pixman pkgconf png py38-numpy py38-pillow py38-pip py38-sphinx py38-sphinx_rtd_theme py38-virtualenv py38-yaml python3 rpm2cpio sdl2 sdl2_image snappy spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'

View File

@ -0,0 +1,15 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool variables macos-11 qemu
#
# https://gitlab.com/libvirt/libvirt-ci/-/commit/c7e275ab27ac0dcd09da290817b9adeea1fd1eb1
PACKAGING_COMMAND='brew'
CCACHE='/usr/local/bin/ccache'
MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja'
PYTHON='/usr/local/bin/python3'
PIP3='/usr/local/bin/pip3'
PKGS='bash bc bzip2 capstone ccache cpanminus ctags curl dbus diffutils gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb libxml2 llvm lzo make meson ncurses nettle ninja perl pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract texinfo usbredir vde vte3 zlib zstd'
PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme virtualenv'
CPAN_PKGS='Test::Harness'

View File

@ -0,0 +1,222 @@
# The CI jobs defined here require GitLab runners installed and
# registered on machines that match their operating system names,
# versions and architectures. This is in contrast to the other CI
# jobs that are intended to run on GitLab's "shared" runners.
# Different than the default approach on "shared" runners, based on
# containers, the custom runners have no such *requirement*, as those
# jobs should be capable of running on operating systems with no
# compatible container implementation, or no support from
# gitlab-runner. To avoid problems that gitlab-runner can cause while
# reusing the GIT repository, let's enable the clone strategy, which
# guarantees a fresh repository on each job run.
variables:
GIT_STRATEGY: clone
# All ubuntu-18.04 jobs should run successfully in an environment
# setup by the scripts/ci/setup/build-environment.yml task
# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
ubuntu-18.04-s390x-all-linux-static:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
# --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
# --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
- mkdir build
- cd build
- ../configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
- make --output-sync -j`nproc` check-tcg V=1
ubuntu-18.04-s390x-all:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --disable-libssh
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-18.04-s390x-alldbg:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --enable-debug --disable-libssh
- make clean
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-18.04-s390x-clang:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
when: manual
script:
- mkdir build
- cd build
- ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-18.04-s390x-tci:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --disable-libssh --enable-tcg-interpreter
- make --output-sync -j`nproc`
ubuntu-18.04-s390x-notcg:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_18.04
- s390x
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
when: manual
script:
- mkdir build
- cd build
- ../configure --disable-libssh --disable-tcg
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
# All ubuntu-20.04 jobs should run successfully in an environment
# setup by the scripts/ci/setup/qemu/build-environment.yml task
# "Install basic packages to build QEMU on Ubuntu 18.04/20.04"
ubuntu-20.04-aarch64-all-linux-static:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
# --disable-libssh is needed because of https://bugs.launchpad.net/qemu/+bug/1838763
# --disable-glusterfs is needed because there's no static version of those libs in distro supplied packages
- mkdir build
- cd build
- ../configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
- make --output-sync -j`nproc` check-tcg V=1
ubuntu-20.04-aarch64-all:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --disable-libssh
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-20.04-aarch64-alldbg:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --enable-debug --disable-libssh
- make clean
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-20.04-aarch64-clang:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
when: manual
script:
- mkdir build
- cd build
- ../configure --disable-libssh --cc=clang-10 --cxx=clang++-10 --enable-sanitizers
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1
ubuntu-20.04-aarch64-tci:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
script:
- mkdir build
- cd build
- ../configure --disable-libssh --enable-tcg-interpreter
- make --output-sync -j`nproc`
ubuntu-20.04-aarch64-notcg:
allow_failure: true
needs: []
stage: build
tags:
- ubuntu_20.04
- aarch64
rules:
- if: '$CI_COMMIT_BRANCH =~ /^staging/'
when: manual
script:
- mkdir build
- cd build
- ../configure --disable-libssh --disable-tcg
- make --output-sync -j`nproc`
- make --output-sync -j`nproc` check V=1

View File

@ -9,3 +9,5 @@ include:
- local: '/.gitlab-ci.d/crossbuilds.yml'
- local: '/.gitlab-ci.d/buildtest.yml'
- local: '/.gitlab-ci.d/static_checks.yml'
- local: '/.gitlab-ci.d/custom-runners.yml'
- local: '/.gitlab-ci.d/cirrus.yml'

View File

@ -27,6 +27,7 @@ addons:
- libattr1-dev
- libbrlapi-dev
- libcap-ng-dev
- libcacard-dev
- libgcc-7-dev
- libgnutls28-dev
- libgtk-3-dev
@ -34,7 +35,6 @@ addons:
- liblttng-ust-dev
- libncurses5-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libpng-dev
- librados-dev
@ -129,6 +129,7 @@ jobs:
- libaio-dev
- libattr1-dev
- libbrlapi-dev
- libcacard-dev
- libcap-ng-dev
- libgcrypt20-dev
- libgnutls28-dev
@ -137,7 +138,6 @@ jobs:
- liblttng-ust-dev
- libncurses5-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libpng-dev
- librados-dev
@ -163,6 +163,7 @@ jobs:
- libaio-dev
- libattr1-dev
- libbrlapi-dev
- libcacard-dev
- libcap-ng-dev
- libgcrypt20-dev
- libgnutls28-dev
@ -171,7 +172,6 @@ jobs:
- liblttng-ust-dev
- libncurses5-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libpng-dev
- librados-dev
@ -196,6 +196,7 @@ jobs:
- libaio-dev
- libattr1-dev
- libbrlapi-dev
- libcacard-dev
- libcap-ng-dev
- libgcrypt20-dev
- libgnutls28-dev
@ -204,7 +205,6 @@ jobs:
- liblttng-ust-dev
- libncurses5-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libpng-dev
- librados-dev
@ -238,6 +238,7 @@ jobs:
apt_packages:
- libaio-dev
- libattr1-dev
- libcacard-dev
- libcap-ng-dev
- libgnutls28-dev
- libiscsi-dev
@ -245,7 +246,6 @@ jobs:
- liblzo2-dev
- libncurses-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libsdl2-dev
- libsdl2-image-dev
@ -281,6 +281,7 @@ jobs:
- libaio-dev
- libattr1-dev
- libbrlapi-dev
- libcacard-dev
- libcap-ng-dev
- libgcrypt20-dev
- libgnutls28-dev
@ -289,7 +290,6 @@ jobs:
- liblttng-ust-dev
- libncurses5-dev
- libnfs-dev
- libnss3-dev
- libpixman-1-dev
- libpng-dev
- librados-dev

View File

@ -3016,6 +3016,8 @@ F: include/tcg/
TCG Plugins
M: Alex Bennée <alex.bennee@linaro.org>
R: Alexandre Iooss <erdnaxe@crans.org>
R: Mahmoud Mandour <ma.mandourr@gmail.com>
S: Maintained
F: docs/devel/tcg-plugins.rst
F: plugins/

View File

@ -1728,7 +1728,7 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx,
data->v.io.offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr;
} else {
data->is_io = false;
data->v.ram.hostaddr = addr + tlbe->addend;
data->v.ram.hostaddr = (void *)((uintptr_t)addr + tlbe->addend);
}
return true;
} else {

142
configure vendored
View File

@ -429,7 +429,7 @@ libxml2="auto"
debug_mutex="no"
libpmem="auto"
default_devices="true"
plugins="no"
plugins="$default_feature"
fuzzing="no"
rng_none="no"
secret_keyring="$default_feature"
@ -708,6 +708,7 @@ MINGW32*)
audio_drv_list=""
fi
supported_os="yes"
plugins="no"
pie="no"
;;
GNU/kFreeBSD)
@ -1110,6 +1111,7 @@ for opt do
--enable-cap-ng) cap_ng="enabled"
;;
--disable-tcg) tcg="disabled"
plugins="no"
;;
--enable-tcg) tcg="enabled"
;;
@ -1521,7 +1523,11 @@ for opt do
;;
--disable-xkbcommon) xkbcommon="disabled"
;;
--enable-plugins) plugins="yes"
--enable-plugins) if test "$mingw32" = "yes"; then
error_exit "TCG plugins not currently supported on Windows platforms"
else
plugins="yes"
fi
;;
--disable-plugins) plugins="no"
;;
@ -1575,6 +1581,11 @@ for opt do
esac
done
# test for any invalid configuration combinations
if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
error_exit "Can't enable plugins on non-TCG builds"
fi
case $git_submodules_action in
update|validate)
if test ! -e "$source_path/.git"; then
@ -2191,11 +2202,16 @@ if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
error_exit "Can't enable module-upgrades as Modules are not enabled"
fi
# Static linking is not possible with modules or PIE
# Static linking is not possible with plugins, modules or PIE
if test "$static" = "yes" ; then
if test "$modules" = "yes" ; then
error_exit "static and modules are mutually incompatible"
fi
if test "$plugins" = "yes"; then
error_exit "static and plugins are mutually incompatible"
else
plugins="no"
fi
fi
# Unconditional check for compiler __thread support
@ -3088,6 +3104,69 @@ for drv in $audio_drv_list; do
esac
done
##########################################
# plugin linker support probe
if test "$plugins" != "no"; then
#########################################
# See if --dynamic-list is supported by the linker
ld_dynamic_list="no"
cat > $TMPTXT <<EOF
{
foo;
};
EOF
cat > $TMPC <<EOF
#include <stdio.h>
void foo(void);
void foo(void)
{
printf("foo\n");
}
int main(void)
{
foo();
return 0;
}
EOF
if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
ld_dynamic_list="yes"
fi
#########################################
# See if -exported_symbols_list is supported by the linker
ld_exported_symbols_list="no"
cat > $TMPTXT <<EOF
_foo
EOF
if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then
ld_exported_symbols_list="yes"
fi
if test "$ld_dynamic_list" = "no" &&
test "$ld_exported_symbols_list" = "no" ; then
if test "$plugins" = "yes"; then
error_exit \
"Plugin support requires dynamic linking and specifying a set of symbols " \
"that are exported to plugins. Unfortunately your linker doesn't " \
"support the flag (--dynamic-list or -exported_symbols_list) used " \
"for this purpose."
else
plugins="no"
fi
else
plugins="yes"
fi
fi
##########################################
# glib support probe
@ -3096,7 +3175,7 @@ glib_modules=gthread-2.0
if test "$modules" = yes; then
glib_modules="$glib_modules gmodule-export-2.0"
fi
if test "$plugins" = yes; then
if test "$plugins" = "yes"; then
glib_modules="$glib_modules gmodule-2.0"
fi
@ -3921,61 +4000,6 @@ if compile_prog "" "" ; then
atomic64=yes
fi
#########################################
# See if --dynamic-list is supported by the linker
ld_dynamic_list="no"
if test "$static" = "no" ; then
cat > $TMPTXT <<EOF
{
foo;
};
EOF
cat > $TMPC <<EOF
#include <stdio.h>
void foo(void);
void foo(void)
{
printf("foo\n");
}
int main(void)
{
foo();
return 0;
}
EOF
if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
ld_dynamic_list="yes"
fi
fi
#########################################
# See if -exported_symbols_list is supported by the linker
ld_exported_symbols_list="no"
if test "$static" = "no" ; then
cat > $TMPTXT <<EOF
_foo
EOF
if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then
ld_exported_symbols_list="yes"
fi
fi
if test "$plugins" = "yes" &&
test "$ld_dynamic_list" = "no" &&
test "$ld_exported_symbols_list" = "no" ; then
error_exit \
"Plugin support requires dynamic linking and specifying a set of symbols " \
"that are exported to plugins. Unfortunately your linker doesn't " \
"support the flag (--dynamic-list or -exported_symbols_list) used " \
"for this purpose. You can't build with --static."
fi
########################################
# check if getauxval is available.

View File

@ -13,18 +13,20 @@ include $(BUILD_DIR)/config-host.mak
VPATH += $(SRC_PATH)/contrib/plugins
NAMES :=
NAMES += execlog
NAMES += hotblocks
NAMES += hotpages
NAMES += howvec
NAMES += lockstep
NAMES += hwprofile
NAMES += cache
SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
# The main QEMU uses Glib extensively so it's perfectly fine to use it
# in plugins (which many example do).
CFLAGS = $(GLIB_CFLAGS)
CFLAGS += -fPIC
CFLAGS += -fPIC -Wall $(filter -W%, $(QEMU_CFLAGS))
CFLAGS += $(if $(findstring no-psabi,$(QEMU_CFLAGS)),-Wpsabi)
CFLAGS += -I$(SRC_PATH)/include/qemu

641
contrib/plugins/cache.c Normal file
View File

@ -0,0 +1,641 @@
/*
* Copyright (C) 2021, Mahmoud Mandour <ma.mandourr@gmail.com>
*
* License: GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include <inttypes.h>
#include <stdio.h>
#include <glib.h>
#include <qemu-plugin.h>
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
static enum qemu_plugin_mem_rw rw = QEMU_PLUGIN_MEM_RW;
static GHashTable *miss_ht;
static GMutex mtx;
static GRand *rng;
static int limit;
static bool sys;
static uint64_t dmem_accesses;
static uint64_t dmisses;
static uint64_t imem_accesses;
static uint64_t imisses;
enum EvictionPolicy {
LRU,
FIFO,
RAND,
};
enum EvictionPolicy policy;
/*
* A CacheSet is a set of cache blocks. A memory block that maps to a set can be
* put in any of the blocks inside the set. The number of block per set is
* called the associativity (assoc).
*
* Each block contains the the stored tag and a valid bit. Since this is not
* a functional simulator, the data itself is not stored. We only identify
* whether a block is in the cache or not by searching for its tag.
*
* In order to search for memory data in the cache, the set identifier and tag
* are extracted from the address and the set is probed to see whether a tag
* match occur.
*
* An address is logically divided into three portions: The block offset,
* the set number, and the tag.
*
* The set number is used to identify the set in which the block may exist.
* The tag is compared against all the tags of a set to search for a match. If a
* match is found, then the access is a hit.
*
* The CacheSet also contains bookkeaping information about eviction details.
*/
typedef struct {
uint64_t tag;
bool valid;
} CacheBlock;
typedef struct {
CacheBlock *blocks;
uint64_t *lru_priorities;
uint64_t lru_gen_counter;
GQueue *fifo_queue;
} CacheSet;
typedef struct {
CacheSet *sets;
int num_sets;
int cachesize;
int assoc;
int blksize_shift;
uint64_t set_mask;
uint64_t tag_mask;
} Cache;
typedef struct {
char *disas_str;
const char *symbol;
uint64_t addr;
uint64_t dmisses;
uint64_t imisses;
} InsnData;
void (*update_hit)(Cache *cache, int set, int blk);
void (*update_miss)(Cache *cache, int set, int blk);
void (*metadata_init)(Cache *cache);
void (*metadata_destroy)(Cache *cache);
Cache *dcache, *icache;
static int pow_of_two(int num)
{
g_assert((num & (num - 1)) == 0);
int ret = 0;
while (num /= 2) {
ret++;
}
return ret;
}
/*
* LRU evection policy: For each set, a generation counter is maintained
* alongside a priority array.
*
* On each set access, the generation counter is incremented.
*
* On a cache hit: The hit-block is assigned the current generation counter,
* indicating that it is the most recently used block.
*
* On a cache miss: The block with the least priority is searched and replaced
* with the newly-cached block, of which the priority is set to the current
* generation number.
*/
static void lru_priorities_init(Cache *cache)
{
int i;
for (i = 0; i < cache->num_sets; i++) {
cache->sets[i].lru_priorities = g_new0(uint64_t, cache->assoc);
cache->sets[i].lru_gen_counter = 0;
}
}
static void lru_update_blk(Cache *cache, int set_idx, int blk_idx)
{
CacheSet *set = &cache->sets[set_idx];
set->lru_priorities[blk_idx] = cache->sets[set_idx].lru_gen_counter;
set->lru_gen_counter++;
}
static int lru_get_lru_block(Cache *cache, int set_idx)
{
int i, min_idx, min_priority;
min_priority = cache->sets[set_idx].lru_priorities[0];
min_idx = 0;
for (i = 1; i < cache->assoc; i++) {
if (cache->sets[set_idx].lru_priorities[i] < min_priority) {
min_priority = cache->sets[set_idx].lru_priorities[i];
min_idx = i;
}
}
return min_idx;
}
static void lru_priorities_destroy(Cache *cache)
{
int i;
for (i = 0; i < cache->num_sets; i++) {
g_free(cache->sets[i].lru_priorities);
}
}
/*
* FIFO eviction policy: a FIFO queue is maintained for each CacheSet that
* stores accesses to the cache.
*
* On a compulsory miss: The block index is enqueued to the fifo_queue to
* indicate that it's the latest cached block.
*
* On a conflict miss: The first-in block is removed from the cache and the new
* block is put in its place and enqueued to the FIFO queue.
*/
static void fifo_init(Cache *cache)
{
int i;
for (i = 0; i < cache->num_sets; i++) {
cache->sets[i].fifo_queue = g_queue_new();
}
}
static int fifo_get_first_block(Cache *cache, int set)
{
GQueue *q = cache->sets[set].fifo_queue;
return GPOINTER_TO_INT(g_queue_pop_tail(q));
}
static void fifo_update_on_miss(Cache *cache, int set, int blk_idx)
{
GQueue *q = cache->sets[set].fifo_queue;
g_queue_push_head(q, GINT_TO_POINTER(blk_idx));
}
static void fifo_destroy(Cache *cache)
{
int i;
for (i = 0; i < cache->assoc; i++) {
g_queue_free(cache->sets[i].fifo_queue);
}
}
static inline uint64_t extract_tag(Cache *cache, uint64_t addr)
{
return addr & cache->tag_mask;
}
static inline uint64_t extract_set(Cache *cache, uint64_t addr)
{
return (addr & cache->set_mask) >> cache->blksize_shift;
}
static const char *cache_config_error(int blksize, int assoc, int cachesize)
{
if (cachesize % blksize != 0) {
return "cache size must be divisible by block size";
} else if (cachesize % (blksize * assoc) != 0) {
return "cache size must be divisible by set size (assoc * block size)";
} else {
return NULL;
}
}
static bool bad_cache_params(int blksize, int assoc, int cachesize)
{
return (cachesize % blksize) != 0 || (cachesize % (blksize * assoc) != 0);
}
static Cache *cache_init(int blksize, int assoc, int cachesize)
{
if (bad_cache_params(blksize, assoc, cachesize)) {
return NULL;
}
Cache *cache;
int i;
uint64_t blk_mask;
cache = g_new(Cache, 1);
cache->assoc = assoc;
cache->cachesize = cachesize;
cache->num_sets = cachesize / (blksize * assoc);
cache->sets = g_new(CacheSet, cache->num_sets);
cache->blksize_shift = pow_of_two(blksize);
for (i = 0; i < cache->num_sets; i++) {
cache->sets[i].blocks = g_new0(CacheBlock, assoc);
}
blk_mask = blksize - 1;
cache->set_mask = ((cache->num_sets - 1) << cache->blksize_shift);
cache->tag_mask = ~(cache->set_mask | blk_mask);
if (metadata_init) {
metadata_init(cache);
}
return cache;
}
static int get_invalid_block(Cache *cache, uint64_t set)
{
int i;
for (i = 0; i < cache->assoc; i++) {
if (!cache->sets[set].blocks[i].valid) {
return i;
}
}
return -1;
}
static int get_replaced_block(Cache *cache, int set)
{
switch (policy) {
case RAND:
return g_rand_int_range(rng, 0, cache->assoc);
case LRU:
return lru_get_lru_block(cache, set);
case FIFO:
return fifo_get_first_block(cache, set);
default:
g_assert_not_reached();
}
}
static int in_cache(Cache *cache, uint64_t addr)
{
int i;
uint64_t tag, set;
tag = extract_tag(cache, addr);
set = extract_set(cache, addr);
for (i = 0; i < cache->assoc; i++) {
if (cache->sets[set].blocks[i].tag == tag &&
cache->sets[set].blocks[i].valid) {
return i;
}
}
return -1;
}
/**
* access_cache(): Simulate a cache access
* @cache: The cache under simulation
* @addr: The address of the requested memory location
*
* Returns true if the requsted data is hit in the cache and false when missed.
* The cache is updated on miss for the next access.
*/
static bool access_cache(Cache *cache, uint64_t addr)
{
int hit_blk, replaced_blk;
uint64_t tag, set;
tag = extract_tag(cache, addr);
set = extract_set(cache, addr);
hit_blk = in_cache(cache, addr);
if (hit_blk != -1) {
if (update_hit) {
update_hit(cache, set, hit_blk);
}
return true;
}
replaced_blk = get_invalid_block(cache, set);
if (replaced_blk == -1) {
replaced_blk = get_replaced_block(cache, set);
}
if (update_miss) {
update_miss(cache, set, replaced_blk);
}
cache->sets[set].blocks[replaced_blk].tag = tag;
cache->sets[set].blocks[replaced_blk].valid = true;
return false;
}
static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
uint64_t vaddr, void *userdata)
{
uint64_t effective_addr;
struct qemu_plugin_hwaddr *hwaddr;
InsnData *insn;
g_mutex_lock(&mtx);
hwaddr = qemu_plugin_get_hwaddr(info, vaddr);
if (hwaddr && qemu_plugin_hwaddr_is_io(hwaddr)) {
g_mutex_unlock(&mtx);
return;
}
effective_addr = hwaddr ? qemu_plugin_hwaddr_phys_addr(hwaddr) : vaddr;
if (!access_cache(dcache, effective_addr)) {
insn = (InsnData *) userdata;
insn->dmisses++;
dmisses++;
}
dmem_accesses++;
g_mutex_unlock(&mtx);
}
static void vcpu_insn_exec(unsigned int vcpu_index, void *userdata)
{
uint64_t insn_addr;
InsnData *insn;
g_mutex_lock(&mtx);
insn_addr = ((InsnData *) userdata)->addr;
if (!access_cache(icache, insn_addr)) {
insn = (InsnData *) userdata;
insn->imisses++;
imisses++;
}
imem_accesses++;
g_mutex_unlock(&mtx);
}
static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
{
size_t n_insns;
size_t i;
InsnData *data;
n_insns = qemu_plugin_tb_n_insns(tb);
for (i = 0; i < n_insns; i++) {
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i);
uint64_t effective_addr;
if (sys) {
effective_addr = (uint64_t) qemu_plugin_insn_haddr(insn);
} else {
effective_addr = (uint64_t) qemu_plugin_insn_vaddr(insn);
}
/*
* Instructions might get translated multiple times, we do not create
* new entries for those instructions. Instead, we fetch the same
* entry from the hash table and register it for the callback again.
*/
g_mutex_lock(&mtx);
data = g_hash_table_lookup(miss_ht, GUINT_TO_POINTER(effective_addr));
if (data == NULL) {
data = g_new0(InsnData, 1);
data->disas_str = qemu_plugin_insn_disas(insn);
data->symbol = qemu_plugin_insn_symbol(insn);
data->addr = effective_addr;
g_hash_table_insert(miss_ht, GUINT_TO_POINTER(effective_addr),
(gpointer) data);
}
g_mutex_unlock(&mtx);
qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem_access,
QEMU_PLUGIN_CB_NO_REGS,
rw, data);
qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec,
QEMU_PLUGIN_CB_NO_REGS, data);
}
}
static void insn_free(gpointer data)
{
InsnData *insn = (InsnData *) data;
g_free(insn->disas_str);
g_free(insn);
}
static void cache_free(Cache *cache)
{
for (int i = 0; i < cache->num_sets; i++) {
g_free(cache->sets[i].blocks);
}
if (metadata_destroy) {
metadata_destroy(cache);
}
g_free(cache->sets);
g_free(cache);
}
static int dcmp(gconstpointer a, gconstpointer b)
{
InsnData *insn_a = (InsnData *) a;
InsnData *insn_b = (InsnData *) b;
return insn_a->dmisses < insn_b->dmisses ? 1 : -1;
}
static int icmp(gconstpointer a, gconstpointer b)
{
InsnData *insn_a = (InsnData *) a;
InsnData *insn_b = (InsnData *) b;
return insn_a->imisses < insn_b->imisses ? 1 : -1;
}
static void log_stats()
{
g_autoptr(GString) rep = g_string_new("");
g_string_append_printf(rep,
"Data accesses: %lu, Misses: %lu\nMiss rate: %lf%%\n\n",
dmem_accesses,
dmisses,
((double) dmisses / (double) dmem_accesses) * 100.0);
g_string_append_printf(rep,
"Instruction accesses: %lu, Misses: %lu\nMiss rate: %lf%%\n\n",
imem_accesses,
imisses,
((double) imisses / (double) imem_accesses) * 100.0);
qemu_plugin_outs(rep->str);
}
static void log_top_insns()
{
int i;
GList *curr, *miss_insns;
InsnData *insn;
miss_insns = g_hash_table_get_values(miss_ht);
miss_insns = g_list_sort(miss_insns, dcmp);
g_autoptr(GString) rep = g_string_new("");
g_string_append_printf(rep, "%s", "address, data misses, instruction\n");
for (curr = miss_insns, i = 0; curr && i < limit; i++, curr = curr->next) {
insn = (InsnData *) curr->data;
g_string_append_printf(rep, "0x%" PRIx64, insn->addr);
if (insn->symbol) {
g_string_append_printf(rep, " (%s)", insn->symbol);
}
g_string_append_printf(rep, ", %ld, %s\n", insn->dmisses,
insn->disas_str);
}
miss_insns = g_list_sort(miss_insns, icmp);
g_string_append_printf(rep, "%s", "\naddress, fetch misses, instruction\n");
for (curr = miss_insns, i = 0; curr && i < limit; i++, curr = curr->next) {
insn = (InsnData *) curr->data;
g_string_append_printf(rep, "0x%" PRIx64, insn->addr);
if (insn->symbol) {
g_string_append_printf(rep, " (%s)", insn->symbol);
}
g_string_append_printf(rep, ", %ld, %s\n", insn->imisses,
insn->disas_str);
}
qemu_plugin_outs(rep->str);
g_list_free(miss_insns);
}
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
log_stats();
log_top_insns();
cache_free(dcache);
cache_free(icache);
g_hash_table_destroy(miss_ht);
}
static void policy_init()
{
switch (policy) {
case LRU:
update_hit = lru_update_blk;
update_miss = lru_update_blk;
metadata_init = lru_priorities_init;
metadata_destroy = lru_priorities_destroy;
break;
case FIFO:
update_miss = fifo_update_on_miss;
metadata_init = fifo_init;
metadata_destroy = fifo_destroy;
break;
case RAND:
rng = g_rand_new();
break;
default:
g_assert_not_reached();
}
}
QEMU_PLUGIN_EXPORT
int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
int argc, char **argv)
{
int i;
int iassoc, iblksize, icachesize;
int dassoc, dblksize, dcachesize;
limit = 32;
sys = info->system_emulation;
dassoc = 8;
dblksize = 64;
dcachesize = dblksize * dassoc * 32;
iassoc = 8;
iblksize = 64;
icachesize = iblksize * iassoc * 32;
policy = LRU;
for (i = 0; i < argc; i++) {
char *opt = argv[i];
if (g_str_has_prefix(opt, "iblksize=")) {
iblksize = g_ascii_strtoll(opt + 9, NULL, 10);
} else if (g_str_has_prefix(opt, "iassoc=")) {
iassoc = g_ascii_strtoll(opt + 7, NULL, 10);
} else if (g_str_has_prefix(opt, "icachesize=")) {
icachesize = g_ascii_strtoll(opt + 11, NULL, 10);
} else if (g_str_has_prefix(opt, "dblksize=")) {
dblksize = g_ascii_strtoll(opt + 9, NULL, 10);
} else if (g_str_has_prefix(opt, "dassoc=")) {
dassoc = g_ascii_strtoll(opt + 7, NULL, 10);
} else if (g_str_has_prefix(opt, "dcachesize=")) {
dcachesize = g_ascii_strtoll(opt + 11, NULL, 10);
} else if (g_str_has_prefix(opt, "limit=")) {
limit = g_ascii_strtoll(opt + 6, NULL, 10);
} else if (g_str_has_prefix(opt, "evict=")) {
gchar *p = opt + 6;
if (g_strcmp0(p, "rand") == 0) {
policy = RAND;
} else if (g_strcmp0(p, "lru") == 0) {
policy = LRU;
} else if (g_strcmp0(p, "fifo") == 0) {
policy = FIFO;
} else {
fprintf(stderr, "invalid eviction policy: %s\n", opt);
return -1;
}
} else {
fprintf(stderr, "option parsing failed: %s\n", opt);
return -1;
}
}
policy_init();
dcache = cache_init(dblksize, dassoc, dcachesize);
if (!dcache) {
const char *err = cache_config_error(dblksize, dassoc, dcachesize);
fprintf(stderr, "dcache cannot be constructed from given parameters\n");
fprintf(stderr, "%s\n", err);
return -1;
}
icache = cache_init(iblksize, iassoc, icachesize);
if (!icache) {
const char *err = cache_config_error(iblksize, iassoc, icachesize);
fprintf(stderr, "icache cannot be constructed from given parameters\n");
fprintf(stderr, "%s\n", err);
return -1;
}
qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
miss_ht = g_hash_table_new_full(NULL, g_direct_equal, NULL, insn_free);
return 0;
}

153
contrib/plugins/execlog.c Normal file
View File

@ -0,0 +1,153 @@
/*
* Copyright (C) 2021, Alexandre Iooss <erdnaxe@crans.org>
*
* Log instruction execution with memory access.
*
* License: GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include <glib.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <qemu-plugin.h>
QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
/* Store last executed instruction on each vCPU as a GString */
GArray *last_exec;
/**
* Add memory read or write information to current instruction log
*/
static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t info,
uint64_t vaddr, void *udata)
{
GString *s;
/* Find vCPU in array */
g_assert(cpu_index < last_exec->len);
s = g_array_index(last_exec, GString *, cpu_index);
/* Indicate type of memory access */
if (qemu_plugin_mem_is_store(info)) {
g_string_append(s, ", store");
} else {
g_string_append(s, ", load");
}
/* If full system emulation log physical address and device name */
struct qemu_plugin_hwaddr *hwaddr = qemu_plugin_get_hwaddr(info, vaddr);
if (hwaddr) {
uint64_t addr = qemu_plugin_hwaddr_phys_addr(hwaddr);
const char *name = qemu_plugin_hwaddr_device_name(hwaddr);
g_string_append_printf(s, ", 0x%08"PRIx64", %s", addr, name);
} else {
g_string_append_printf(s, ", 0x%08"PRIx64, vaddr);
}
}
/**
* Log instruction execution
*/
static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
{
GString *s;
/* Find or create vCPU in array */
while (cpu_index >= last_exec->len) {
s = g_string_new(NULL);
g_array_append_val(last_exec, s);
}
s = g_array_index(last_exec, GString *, cpu_index);
/* Print previous instruction in cache */
if (s->len) {
qemu_plugin_outs(s->str);
qemu_plugin_outs("s\n");
}
/* Store new instruction in cache */
/* vcpu_mem will add memory access information to last_exec */
g_string_printf(s, "%u, ", cpu_index);
g_string_append(s, (char *)udata);
}
/**
* On translation block new translation
*
* QEMU convert code by translation block (TB). By hooking here we can then hook
* a callback on each instruction and memory access.
*/
static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
{
struct qemu_plugin_insn *insn;
uint64_t insn_vaddr;
uint32_t insn_opcode;
char *insn_disas;
size_t n = qemu_plugin_tb_n_insns(tb);
for (size_t i = 0; i < n; i++) {
/*
* `insn` is shared between translations in QEMU, copy needed data here.
* `output` is never freed as it might be used multiple times during
* the emulation lifetime.
* We only consider the first 32 bits of the instruction, this may be
* a limitation for CISC architectures.
*/
insn = qemu_plugin_tb_get_insn(tb, i);
insn_vaddr = qemu_plugin_insn_vaddr(insn);
insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn));
insn_disas = qemu_plugin_insn_disas(insn);
char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"",
insn_vaddr, insn_opcode, insn_disas);
/* Register callback on memory read or write */
qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem,
QEMU_PLUGIN_CB_NO_REGS,
QEMU_PLUGIN_MEM_RW, NULL);
/* Register callback on instruction */
qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec,
QEMU_PLUGIN_CB_NO_REGS, output);
}
}
/**
* On plugin exit, print last instruction in cache
*/
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
guint i;
GString *s;
for (i = 0; i < last_exec->len; i++) {
s = g_array_index(last_exec, GString *, i);
if (s->str) {
qemu_plugin_outs(s->str);
qemu_plugin_outs("\n");
}
}
}
/**
* Install the plugin
*/
QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info, int argc,
char **argv)
{
/*
* Initialize dynamic array to cache vCPU instruction. In user mode
* we don't know the size before emulation.
*/
last_exec = g_array_new(FALSE, FALSE, sizeof(GString *));
/* Register translation block and exit callbacks */
qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
return 0;
}

View File

@ -34,15 +34,14 @@ reader and smart card (i.e. not backed by a physical device) using this device.
2. Building
The cryptographic functions and access to the physical card is done via NSS.
Installing NSS:
The cryptographic functions and access to the physical card is done via the
libcacard library, whose development package must be installed prior to
building QEMU:
In redhat/fedora:
yum install nss-devel
In ubuntu/debian:
apt-get install libnss3-dev
(not tested on ubuntu)
yum install libcacard-devel
In ubuntu:
apt-get install libcacard-dev
Configuring and building:
./configure --enable-smartcard && make
@ -51,7 +50,7 @@ Configuring and building:
3. Using ccid-card-emulated with hardware
Assuming you have a working smartcard on the host with the current
user, using NSS, qemu acts as another NSS client using ccid-card-emulated:
user, using libcacard, QEMU acts as another client using ccid-card-emulated:
qemu -usb -device usb-ccid -device ccid-card-emulated

127
docs/devel/ci.rst Normal file
View File

@ -0,0 +1,127 @@
==
CI
==
QEMU has configurations enabled for a number of different CI services.
The most up to date information about them and their status can be
found at::
https://wiki.qemu.org/Testing/CI
Jobs on Custom Runners
======================
Besides the jobs run under the various CI systems listed before, there
are a number additional jobs that will run before an actual merge.
These use the same GitLab CI's service/framework already used for all
other GitLab based CI jobs, but rely on additional systems, not the
ones provided by GitLab as "shared runners".
The architecture of GitLab's CI service allows different machines to
be set up with GitLab's "agent", called gitlab-runner, which will take
care of running jobs created by events such as a push to a branch.
Here, the combination of a machine, properly configured with GitLab's
gitlab-runner, is called a "custom runner".
The GitLab CI jobs definition for the custom runners are located under::
.gitlab-ci.d/custom-runners.yml
Custom runners entail custom machines. To see a list of the machines
currently deployed in the QEMU GitLab CI and their maintainers, please
refer to the QEMU `wiki <https://wiki.qemu.org/AdminContacts>`__.
Machine Setup Howto
-------------------
For all Linux based systems, the setup can be mostly automated by the
execution of two Ansible playbooks. Create an ``inventory`` file
under ``scripts/ci/setup``, such as this::
fully.qualified.domain
other.machine.hostname
You may need to set some variables in the inventory file itself. One
very common need is to tell Ansible to use a Python 3 interpreter on
those hosts. This would look like::
fully.qualified.domain ansible_python_interpreter=/usr/bin/python3
other.machine.hostname ansible_python_interpreter=/usr/bin/python3
Build environment
~~~~~~~~~~~~~~~~~
The ``scripts/ci/setup/build-environment.yml`` Ansible playbook will
set up machines with the environment needed to perform builds and run
QEMU tests. This playbook consists on the installation of various
required packages (and a general package update while at it). It
currently covers a number of different Linux distributions, but it can
be expanded to cover other systems.
The minimum required version of Ansible successfully tested in this
playbook is 2.8.0 (a version check is embedded within the playbook
itself). To run the playbook, execute::
cd scripts/ci/setup
ansible-playbook -i inventory build-environment.yml
Please note that most of the tasks in the playbook require superuser
privileges, such as those from the ``root`` account or those obtained
by ``sudo``. If necessary, please refer to ``ansible-playbook``
options such as ``--become``, ``--become-method``, ``--become-user``
and ``--ask-become-pass``.
gitlab-runner setup and registration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The gitlab-runner agent needs to be installed on each machine that
will run jobs. The association between a machine and a GitLab project
happens with a registration token. To find the registration token for
your repository/project, navigate on GitLab's web UI to:
* Settings (the gears-like icon at the bottom of the left hand side
vertical toolbar), then
* CI/CD, then
* Runners, and click on the "Expand" button, then
* Under "Set up a specific Runner manually", look for the value under
"And this registration token:"
Copy the ``scripts/ci/setup/vars.yml.template`` file to
``scripts/ci/setup/vars.yml``. Then, set the
``gitlab_runner_registration_token`` variable to the value obtained
earlier.
To run the playbook, execute::
cd scripts/ci/setup
ansible-playbook -i inventory gitlab-runner.yml
Following the registration, it's necessary to configure the runner tags,
and optionally other configurations on the GitLab UI. Navigate to:
* Settings (the gears like icon), then
* CI/CD, then
* Runners, and click on the "Expand" button, then
* "Runners activated for this project", then
* Click on the "Edit" icon (next to the "Lock" Icon)
Tags are very important as they are used to route specific jobs to
specific types of runners, so it's a good idea to double check that
the automatically created tags are consistent with the OS and
architecture. For instance, an Ubuntu 20.04 aarch64 system should
have tags set as::
ubuntu_20.04,aarch64
Because the job definition at ``.gitlab-ci.d/custom-runners.yml``
would contain::
ubuntu-20.04-aarch64-all:
tags:
- ubuntu_20.04
- aarch64
It's also recommended to:
* increase the "Maximum job timeout" to something like ``2h``
* give it a better Description

View File

@ -27,6 +27,7 @@ Contents:
migration
atomics
stable-process
ci
qtest
decodetree
secure-coding-practices

View File

@ -71,7 +71,8 @@ API
Usage
=====
The QEMU binary needs to be compiled for plugin support::
Any QEMU binary with TCG support has plugins enabled by default.
Earlier releases needed to be explicitly enabled with::
configure --enable-plugins
@ -319,3 +320,86 @@ the user to see what hardware is accessed how often. It has a number of options:
off:0000001c, 1, 2
off:00000020, 1, 2
...
- contrib/plugins/execlog.c
The execlog tool traces executed instructions with memory access. It can be used
for debugging and security analysis purposes.
Please be aware that this will generate a lot of output.
The plugin takes no argument::
qemu-system-arm $(QEMU_ARGS) \
-plugin ./contrib/plugins/libexeclog.so -d plugin
which will output an execution trace following this structure::
# vCPU, vAddr, opcode, disassembly[, load/store, memory addr, device]...
0, 0xa12, 0xf8012400, "movs r4, #0"
0, 0xa14, 0xf87f42b4, "cmp r4, r6"
0, 0xa16, 0xd206, "bhs #0xa26"
0, 0xa18, 0xfff94803, "ldr r0, [pc, #0xc]", load, 0x00010a28, RAM
0, 0xa1a, 0xf989f000, "bl #0xd30"
0, 0xd30, 0xfff9b510, "push {r4, lr}", store, 0x20003ee0, RAM, store, 0x20003ee4, RAM
0, 0xd32, 0xf9893014, "adds r0, #0x14"
0, 0xd34, 0xf9c8f000, "bl #0x10c8"
0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM
- contrib/plugins/cache
Cache modelling plugin that measures the performance of a given cache
configuration when a given working set is run::
qemu-x86_64 -plugin ./contrib/plugins/libcache.so \
-d plugin -D cache.log ./tests/tcg/x86_64-linux-user/float_convs
will report the following::
Data accesses: 996479, Misses: 507
Miss rate: 0.050879%
Instruction accesses: 2641737, Misses: 18617
Miss rate: 0.704726%
address, data misses, instruction
0x424f1e (_int_malloc), 109, movq %rax, 8(%rcx)
0x41f395 (_IO_default_xsputn), 49, movb %dl, (%rdi, %rax)
0x42584d (ptmalloc_init.part.0), 33, movaps %xmm0, (%rax)
0x454d48 (__tunables_init), 20, cmpb $0, (%r8)
...
address, fetch misses, instruction
0x4160a0 (__vfprintf_internal), 744, movl $1, %ebx
0x41f0a0 (_IO_setb), 744, endbr64
0x415882 (__vfprintf_internal), 744, movq %r12, %rdi
0x4268a0 (__malloc), 696, andq $0xfffffffffffffff0, %rax
...
The plugin has a number of arguments, all of them are optional:
* arg="limit=N"
Print top N icache and dcache thrashing instructions along with their
address, number of misses, and its disassembly. (default: 32)
* arg="icachesize=N"
* arg="iblksize=B"
* arg="iassoc=A"
Instruction cache configuration arguments. They specify the cache size, block
size, and associativity of the instruction cache, respectively.
(default: N = 16384, B = 64, A = 8)
* arg="dcachesize=N"
* arg="dblksize=B"
* arg="dassoc=A"
Data cache configuration arguments. They specify the cache size, block size,
and associativity of the data cache, respectively.
(default: N = 16384, B = 64, A = 8)
* arg="evict=POLICY"
Sets the eviction policy to POLICY. Available policies are: :code:`lru`,
:code:`fifo`, and :code:`rand`. The plugin will use the specified policy for
both instruction and data caches. (default: POLICY = :code:`lru`)

View File

@ -18,7 +18,7 @@ struct qemu_plugin_hwaddr {
hwaddr offset;
} io;
struct {
uint64_t hostaddr;
void *hostaddr;
} ram;
} v;
};

View File

@ -92,7 +92,11 @@ if cpu in ['x86', 'x86_64']
}
endif
modular_tcg = ['i386-softmmu', 'x86_64-softmmu']
modular_tcg = []
# Darwin does not support references to thread-local variables in modules
if targetos != 'darwin'
modular_tcg = ['i386-softmmu', 'x86_64-softmmu']
endif
edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ]
install_edk2_blobs = false
@ -451,7 +455,10 @@ endif
rt = cc.find_library('rt', required: false)
libdl = not_found
if 'CONFIG_PLUGIN' in config_host
libdl = cc.find_library('dl', required: true)
libdl = cc.find_library('dl', required: false)
if not cc.has_function('dlopen', dependencies: libdl)
error('dlopen not found')
endif
endif
libiscsi = not_found
if not get_option('libiscsi').auto() or have_block
@ -1653,6 +1660,19 @@ if capstone_opt in ['enabled', 'auto', 'system']
kwargs: static_kwargs, method: 'pkg-config',
required: capstone_opt == 'system' or
capstone_opt == 'enabled' and not have_internal)
# Some versions of capstone have broken pkg-config file
# that reports a wrong -I path, causing the #include to
# fail later. If the system has such a broken version
# do not use it.
if capstone.found() and not cc.compiles('#include <capstone.h>',
dependencies: [capstone])
capstone = not_found
if capstone_opt == 'system'
error('system capstone requested, it does not appear to work')
endif
endif
if capstone.found()
capstone_opt = 'system'
elif have_internal
@ -2816,7 +2836,6 @@ summary_info += {'module support': config_host.has_key('CONFIG_MODULES')}
if config_host.has_key('CONFIG_MODULES')
summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
endif
summary_info += {'plugin support': config_host.has_key('CONFIG_PLUGIN')}
summary_info += {'fuzzing support': config_host.has_key('CONFIG_FUZZ')}
if have_system
summary_info += {'Audio drivers': config_host['CONFIG_AUDIO_DRIVERS']}
@ -2932,6 +2951,7 @@ if config_all.has_key('CONFIG_TCG')
else
summary_info += {'TCG backend': 'native (@0@)'.format(cpu)}
endif
summary_info += {'TCG plugins': config_host.has_key('CONFIG_PLUGIN')}
summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
endif
summary_info += {'target list': ' '.join(target_dirs)}

View File

@ -308,11 +308,11 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
if (!haddr->is_io) {
RAMBlock *block;
ram_addr_t offset;
void *hostaddr = (void *) haddr->v.ram.hostaddr;
void *hostaddr = haddr->v.ram.hostaddr;
block = qemu_ram_block_from_host(hostaddr, false, &offset);
if (!block) {
error_report("Bad ram pointer %"PRIx64"", haddr->v.ram.hostaddr);
error_report("Bad host ram pointer %p", haddr->v.ram.hostaddr);
abort();
}

View File

@ -8,9 +8,7 @@
qemu_plugin_register_vcpu_insn_exec_cb;
qemu_plugin_register_vcpu_insn_exec_inline;
qemu_plugin_register_vcpu_mem_cb;
qemu_plugin_register_vcpu_mem_haddr_cb;
qemu_plugin_register_vcpu_mem_inline;
qemu_plugin_ram_addr_from_host;
qemu_plugin_register_vcpu_tb_trans_cb;
qemu_plugin_register_vcpu_tb_exec_cb;
qemu_plugin_register_vcpu_tb_exec_inline;
@ -32,7 +30,6 @@
qemu_plugin_mem_is_store;
qemu_plugin_get_hwaddr;
qemu_plugin_hwaddr_is_io;
qemu_plugin_hwaddr_to_raddr;
qemu_plugin_vcpu_for_each;
qemu_plugin_n_vcpus;
qemu_plugin_n_max_vcpus;

2
scripts/ci/setup/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
inventory
vars.yml

View File

@ -0,0 +1,116 @@
# Copyright (c) 2021 Red Hat, Inc.
#
# Author:
# Cleber Rosa <crosa@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
#
# This is an ansible playbook file. Run it to set up systems with the
# environment needed to build QEMU.
---
- name: Installation of basic packages to build QEMU
hosts: all
tasks:
- name: Check for suitable ansible version
delegate_to: localhost
assert:
that:
- '((ansible_version.major == 2) and (ansible_version.minor >= 8)) or (ansible_version.major >= 3)'
msg: "Unsuitable ansible version, please use version 2.8.0 or later"
- name: Update apt cache / upgrade packages via apt
apt:
update_cache: yes
upgrade: yes
when:
- ansible_facts['distribution'] == 'Ubuntu'
- name: Install basic packages to build QEMU on Ubuntu 18.04/20.04
package:
name:
# Originally from tests/docker/dockerfiles/ubuntu1804.docker
- ccache
- gcc
- gettext
- git
- glusterfs-common
- libaio-dev
- libattr1-dev
- libbrlapi-dev
- libbz2-dev
- libcacard-dev
- libcap-ng-dev
- libcurl4-gnutls-dev
- libdrm-dev
- libepoxy-dev
- libfdt-dev
- libgbm-dev
- libgtk-3-dev
- libibverbs-dev
- libiscsi-dev
- libjemalloc-dev
- libjpeg-turbo8-dev
- liblzo2-dev
- libncurses5-dev
- libncursesw5-dev
- libnfs-dev
- libnss3-dev
- libnuma-dev
- libpixman-1-dev
- librados-dev
- librbd-dev
- librdmacm-dev
- libsasl2-dev
- libsdl2-dev
- libseccomp-dev
- libsnappy-dev
- libspice-protocol-dev
- libssh-dev
- libusb-1.0-0-dev
- libusbredirhost-dev
- libvdeplug-dev
- libvte-2.91-dev
- libzstd-dev
- make
- python3-yaml
- python3-sphinx
- python3-sphinx-rtd-theme
- ninja-build
- sparse
- xfslibs-dev
state: present
when:
- ansible_facts['distribution'] == 'Ubuntu'
- name: Install packages to build QEMU on Ubuntu 18.04/20.04 on non-s390x
package:
name:
- libspice-server-dev
- libxen-dev
state: present
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['architecture'] != 's390x'
- name: Install basic packages to build QEMU on Ubuntu 18.04
package:
name:
# Originally from tests/docker/dockerfiles/ubuntu1804.docker
- clang
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['distribution_version'] == '18.04'
- name: Install basic packages to build QEMU on Ubuntu 20.04
package:
name:
# Originally from tests/docker/dockerfiles/ubuntu2004.docker
- clang-10
- genisoimage
- liblttng-ust-dev
- libslirp-dev
- netcat-openbsd
when:
- ansible_facts['distribution'] == 'Ubuntu'
- ansible_facts['distribution_version'] == '20.04'

View File

@ -0,0 +1,71 @@
# Copyright (c) 2021 Red Hat, Inc.
#
# Author:
# Cleber Rosa <crosa@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
#
# This is an ansible playbook file. Run it to set up systems with the
# gitlab-runner agent.
---
- name: Installation of gitlab-runner
hosts: all
vars_files:
- vars.yml
tasks:
- debug:
msg: 'Checking for a valid GitLab registration token'
failed_when: "gitlab_runner_registration_token == 'PLEASE_PROVIDE_A_VALID_TOKEN'"
- name: Create a group for the gitlab-runner service
group:
name: gitlab-runner
- name: Create a user for the gitlab-runner service
user:
user: gitlab-runner
group: gitlab-runner
comment: GitLab Runner
home: /home/gitlab-runner
shell: /bin/bash
- name: Remove the .bash_logout file when on Ubuntu systems
file:
path: /home/gitlab-runner/.bash_logout
state: absent
when: "ansible_facts['distribution'] == 'Ubuntu'"
- name: Set the Operating System for gitlab-runner
set_fact:
gitlab_runner_os: "{{ ansible_facts[\"system\"]|lower }}"
- debug:
msg: gitlab-runner OS is {{ gitlab_runner_os }}
- name: Set the architecture for gitlab-runner
set_fact:
gitlab_runner_arch: "{{ ansible_to_gitlab_arch[ansible_facts[\"architecture\"]] }}"
- debug:
msg: gitlab-runner arch is {{ gitlab_runner_arch }}
- name: Download the matching gitlab-runner
get_url:
dest: /usr/local/bin/gitlab-runner
url: "https://s3.amazonaws.com/gitlab-runner-downloads/v{{ gitlab_runner_version }}/binaries/gitlab-runner-{{ gitlab_runner_os }}-{{ gitlab_runner_arch }}"
owner: gitlab-runner
group: gitlab-runner
mode: u=rwx,g=rwx,o=rx
- name: Register the gitlab-runner
command: "/usr/local/bin/gitlab-runner register --non-interactive --url {{ gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registration_token }} --executor shell --tag-list {{ ansible_facts[\"architecture\"] }},{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distribution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{ ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture\"] }} ({{ ansible_facts[\"os_family\"] }})'"
- name: Install the gitlab-runner service using its own functionality
command: /usr/local/bin/gitlab-runner install --user gitlab-runner --working-directory /home/gitlab-runner
register: gitlab_runner_install_service_result
failed_when: "gitlab_runner_install_service_result.rc != 0 and \"already exists\" not in gitlab_runner_install_service_result.stderr"
- name: Enable the gitlab-runner service
service:
name: gitlab-runner
state: started
enabled: yes

View File

@ -0,0 +1 @@
localhost

View File

@ -0,0 +1,12 @@
# The version of the gitlab-runner to use
gitlab_runner_version: 13.12.0
# The URL of the gitlab server to use, usually https://gitlab.com unless you're
# using a private GitLab instance
gitlab_runner_server_url: https://gitlab.com
# A mapping of the ansible to gitlab architecture nomenclature
ansible_to_gitlab_arch:
x86_64: amd64
aarch64: arm64
s390x: s390x
# A unique token made available by GitLab to your project for registering runners
gitlab_runner_registration_token: PLEASE_PROVIDE_A_VALID_TOKEN

View File

@ -93,7 +93,6 @@ ENV PACKAGES \
mingw64-SDL2 \
ncurses-devel \
nettle-devel \
nss-devel \
numactl-devel \
perl \
perl-Test-Harness \

View File

@ -15,7 +15,9 @@ stub_ss.add(files('fdset.c'))
stub_ss.add(files('fw_cfg.c'))
stub_ss.add(files('gdbstub.c'))
stub_ss.add(files('get-vm-name.c'))
stub_ss.add(when: 'CONFIG_LINUX_IO_URING', if_true: files('io_uring.c'))
if linux_io_uring.found()
stub_ss.add(files('io_uring.c'))
endif
stub_ss.add(files('iothread-lock.c'))
stub_ss.add(files('isa-bus.c'))
stub_ss.add(files('is-daemonized.c'))

View File

@ -15,14 +15,23 @@
# overriden by TARGET_LIST if the user sets it.
DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
requires()
requires_binary()
{
found=0
for c in $@; do
if ! echo "$FEATURES" | grep -wq -e "$c"; then
echo "Prerequisite '$c' not present, skip"
exit 0
fi
for d in /bin /usr/bin /usr/local/bin
do
if test -f "$d/$c"
then
found=1
fi
done
done
if test "$found" != "1"
then
echo "Prerequisite '$c' not present, skip"
exit 0
fi
}
configure_qemu()

View File

@ -228,7 +228,9 @@ class Docker(object):
def __init__(self):
self._command = _guess_engine_command()
if "docker" in self._command and "TRAVIS" not in os.environ:
if ("docker" in self._command and
"TRAVIS" not in os.environ and
"GITLAB_CI" not in os.environ):
os.environ["DOCKER_BUILDKIT"] = "1"
self._buildkit = True
else:

View File

@ -1,41 +1,111 @@
FROM centos:8.3.2011
FROM docker.io/centos:8
RUN dnf -y update
ENV PACKAGES \
SDL2-devel \
alsa-lib-devel \
bc \
brlapi-devel \
bzip2 \
bzip2-devel \
ca-certificates \
capstone-devel \
ccache \
clang \
ctags \
cyrus-sasl-devel \
daxctl-devel \
dbus-daemon \
device-mapper-multipath-devel \
diffutils \
findutils \
gcc \
gcc-c++ \
genisoimage \
gettext \
git \
glib2-devel \
glibc-langpack-en \
glibc-static \
glusterfs-api-devel \
gnutls-devel \
gtk3-devel \
hostname \
jemalloc-devel \
libaio-devel \
libasan \
libattr-devel \
libbpf-devel \
libcacard-devel \
libcap-ng-devel \
libcurl-devel \
libdrm-devel \
libepoxy-devel \
libfdt-devel \
libffi-devel \
libgcrypt-devel \
libiscsi-devel \
libjpeg-devel \
libnfs-devel \
libpmem-devel \
libpng-devel \
librbd-devel \
libseccomp-devel \
libslirp-devel \
libssh-devel \
libtasn1-devel \
libubsan \
libudev-devel \
libusbx-devel \
libxml2-devel \
libzstd-devel \
llvm \
lzo-devel \
make \
mesa-libEGL-devel \
nmap-ncat \
mesa-libgbm-devel \
ncurses-devel \
nettle-devel \
ninja-build \
nmap-ncat \
numactl-devel \
openssh-clients \
pam-devel \
perl \
perl-Test-Harness \
pixman-devel \
python36 \
pkgconfig \
pulseaudio-libs-devel \
python3 \
python3-PyYAML \
python3-numpy \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx_rtd_theme \
python3-virtualenv \
python3-wheel \
rdma-core-devel \
spice-glib-devel \
spice-server \
rpm \
sed \
snappy-devel \
spice-protocol \
spice-server-devel \
systemd-devel \
systemtap-sdt-devel \
tar \
texinfo \
usbredir-devel \
util-linux \
virglrenderer-devel \
vte291-devel \
which \
xfsprogs-devel \
zlib-devel
RUN dnf install -y dnf-plugins-core && \
dnf config-manager --set-enabled powertools && \
dnf install -y centos-release-advanced-virtualization && \
dnf install -y epel-release && \
dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt

View File

@ -5,7 +5,7 @@
# using a prebuilt toolchains for Xtensa cores from:
# https://github.com/foss-xtensa/toolchain/releases
#
FROM debian:stretch-slim
FROM docker.io/library/debian:stretch-slim
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \

View File

@ -7,7 +7,7 @@
# On its own you can't build much but the docker-foo-cross targets
# build on top of the base debian image.
#
FROM debian:buster-slim
FROM docker.io/library/debian:buster-slim
# Duplicate deb line as deb-src
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
@ -35,5 +35,3 @@ RUN apt update && \
python3-sphinx \
python3-sphinx-rtd-theme \
$(apt-get -s build-dep --arch-only qemu | egrep ^Inst | fgrep '[all]' | cut -d\ -f2)
ENV FEATURES docs

View File

@ -8,7 +8,7 @@
# On its own you can't build much but the docker-foo-cross targets
# build on top of the base debian image.
#
FROM debian:bullseye-slim
FROM docker.io/library/debian:bullseye-slim
# Duplicate deb line as deb-src
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list

View File

@ -2,7 +2,7 @@
# Cross compiler for cris system tests
#
FROM fedora:33
FROM registry.fedoraproject.org/fedora:33
ENV PACKAGES gcc-cris-linux-gnu
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt

View File

@ -1,4 +1,4 @@
FROM fedora:33
FROM registry.fedoraproject.org/fedora:33
ENV PACKAGES \
bzip2 \
ccache \

View File

@ -1,4 +1,4 @@
FROM fedora:33
FROM registry.fedoraproject.org/fedora:33
# Please keep this list sorted alphabetically
ENV PACKAGES \
@ -37,7 +37,6 @@ ENV PACKAGES \
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
ENV FEATURES mingw
# Specify the cross prefix for this image (see tests/docker/common.rc)
ENV QEMU_CONFIGURE_OPTS --cross-prefix=i686-w64-mingw32-

View File

@ -1,4 +1,4 @@
FROM fedora:33
FROM registry.fedoraproject.org/fedora:33
# Please keep this list sorted alphabetically
ENV PACKAGES \
@ -33,7 +33,6 @@ ENV PACKAGES \
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
ENV FEATURES mingw
# Specify the cross prefix for this image (see tests/docker/common.rc)
ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-w64-mingw32- --disable-capstone

View File

@ -1,92 +1,85 @@
FROM fedora:33
FROM registry.fedoraproject.org/fedora:33
# Please keep this list sorted alphabetically
ENV PACKAGES \
SDL2-devel \
SDL2_image-devel \
alsa-lib-devel \
bc \
brlapi-devel \
bzip2 \
bzip2-devel \
ca-certificates \
capstone-devel \
ccache \
clang \
ctags \
cyrus-sasl-devel \
daxctl-devel \
dbus-daemon \
device-mapper-multipath-devel \
diffutils \
findutils \
gcc \
gcc-c++ \
gcovr \
genisoimage \
gettext \
git \
glib2-devel \
glibc-langpack-en \
glibc-static \
glusterfs-api-devel \
gnutls-devel \
gtk3-devel \
hostname \
jemalloc-devel \
libaio-devel \
libasan \
libattr-devel \
libblockdev-mpath-devel \
libbpf-devel \
libcacard-devel \
libcap-ng-devel \
libcurl-devel \
libdrm-devel \
libepoxy-devel \
libfdt-devel \
libbpf-devel \
libffi-devel \
libgcrypt-devel \
libiscsi-devel \
libjpeg-devel \
libnfs-devel \
libpmem-devel \
libpng-devel \
librbd-devel \
libseccomp-devel \
libslirp-devel \
libssh-devel \
libtasn1-devel \
libubsan \
libudev-devel \
liburing-devel \
libusbx-devel \
libxml2-devel \
libzstd-devel \
llvm \
lttng-ust-devel \
lzo-devel \
make \
mesa-libgbm-devel \
meson \
mingw32-bzip2 \
mingw32-curl \
mingw32-glib2 \
mingw32-gmp \
mingw32-gnutls \
mingw32-gtk3 \
mingw32-libjpeg-turbo \
mingw32-libpng \
mingw32-libtasn1 \
mingw32-nettle \
mingw32-nsis \
mingw32-pixman \
mingw32-pkg-config \
mingw32-SDL2 \
mingw64-bzip2 \
mingw64-curl \
mingw64-glib2 \
mingw64-gmp \
mingw64-gnutls \
mingw64-gtk3 \
mingw64-libjpeg-turbo \
mingw64-libpng \
mingw64-libtasn1 \
mingw64-nettle \
mingw64-pixman \
mingw64-pkg-config \
mingw64-SDL2 \
nmap-ncat \
ncurses-devel \
nettle-devel \
ninja-build \
nss-devel \
nmap-ncat \
numactl-devel \
perl \
openssh-clients \
pam-devel \
perl-Test-Harness \
perl-base \
pixman-devel \
pkgconfig \
pulseaudio-libs-devel \
python3 \
python3-PyYAML \
python3-numpy \
@ -97,24 +90,28 @@ ENV PACKAGES \
python3-sphinx_rtd_theme \
python3-virtualenv \
rdma-core-devel \
SDL2-devel \
rpm \
sed \
snappy-devel \
sparse \
spice-protocol \
spice-server-devel \
systemd-devel \
systemtap-sdt-devel \
tar \
tesseract \
tesseract-langpack-eng \
texinfo \
usbredir-devel \
util-linux \
virglrenderer-devel \
vte291-devel \
which \
xen-devel \
xfsprogs-devel \
zlib-devel
ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3
RUN dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
ENV PATH $PATH:/usr/libexec/python3-sphinx/
ENV FEATURES mingw clang pyyaml asan docs

View File

@ -1,54 +1,111 @@
FROM opensuse/leap:15.2
FROM registry.opensuse.org/opensuse/leap:15.2
# Please keep this list sorted alphabetically
ENV PACKAGES \
Mesa-devel \
alsa-lib-devel \
bc \
brlapi-devel \
bzip2 \
ca-certificates \
ccache \
clang \
ctags \
cyrus-sasl-devel \
dbus-1 \
diffutils \
findutils \
gcc \
gcc-c++ \
mkisofs \
gcovr \
gettext-runtime \
git \
glib2-devel \
glibc-locale \
glibc-static \
glusterfs-devel \
libgnutls-devel \
gtk3-devel \
hostname \
jemalloc-devel \
libSDL2-devel \
libSDL2_image-devel \
libaio-devel \
libasan6 \
libattr-devel \
libbpf-devel \
libbz2-devel \
libcacard-devel \
libcap-ng-devel \
libcurl-devel \
libdrm-devel \
libepoxy-devel \
libfdt-devel \
libffi-devel \
libgcrypt-devel \
libgnutls-devel \
libiscsi-devel \
libjpeg8-devel \
libndctl-devel \
libnettle-devel \
libnfs-devel \
libnuma-devel \
libpixman-1-0-devel \
libpmem-devel \
libpng16-devel \
libpulse-devel \
librbd-devel \
libseccomp-devel \
libspice-server-devel \
libssh-devel \
libtasn1-devel \
libubsan1 \
libudev-devel \
libusb-1_0-devel \
libxml2-devel \
libzstd-devel \
llvm \
lttng-ust-devel \
lzo-devel \
make \
libSDL2_image-devel \
mkisofs \
ncat \
ncurses-devel \
ninja \
libnuma-devel \
perl \
libpixman-1-0-devel \
openssh \
pam-devel \
perl-Test-Harness \
perl-base \
pkgconfig \
python3-Pillow \
python3-PyYAML \
python3-Sphinx \
python3-base \
python3-numpy \
python3-opencv \
python3-pip \
python3-setuptools \
python3-sphinx_rtd_theme \
python3-virtualenv \
python3-wheel \
rdma-core-devel \
libSDL2-devel \
rpm \
sed \
snappy-devel \
libspice-server-devel \
sparse \
spice-protocol-devel \
systemd-devel \
systemtap-sdt-devel \
tar \
tesseract-ocr \
tesseract-ocr-traineddata-english \
texinfo \
usbredir-devel \
util-linux \
virglrenderer-devel \
xen-devel \
vte-devel \
which \
xen-devel \
xfsprogs-devel \
zlib-devel
ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3.6

View File

@ -9,7 +9,7 @@
# system won't pick up that it has changed.
#
FROM ubuntu:20.04
FROM docker.io/library/ubuntu:20.04
ENV PACKAGES \
ccache \
clang \
@ -40,7 +40,6 @@ ENV PACKAGES \
libncurses5-dev \
libncursesw5-dev \
libnfs-dev \
libnss3-dev \
libnuma-dev \
libpixman-1-dev \
libpng-dev \
@ -70,4 +69,3 @@ ENV PACKAGES \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install $PACKAGES
RUN dpkg -l $PACKAGES | sort > /packages.txt
ENV FEATURES clang pyyaml sdl2 docs

View File

@ -1,62 +1,116 @@
FROM ubuntu:18.04
FROM docker.io/library/ubuntu:18.04
ENV PACKAGES \
bc \
bsdmainutils \
bzip2 \
ca-certificates \
ccache \
clang \
dbus \
debianutils \
diffutils \
exuberant-ctags \
findutils \
g++ \
gcc \
gcovr \
genisoimage \
gettext \
git \
glusterfs-common \
hostname \
libaio-dev \
libasan5 \
libasound2-dev \
libattr1-dev \
libbrlapi-dev \
libbz2-dev \
libc6-dev \
libcacard-dev \
libcap-ng-dev \
libcapstone-dev \
libcurl4-gnutls-dev \
libdaxctl-dev \
libdrm-dev \
libepoxy-dev \
libfdt-dev \
libffi-dev \
libgbm-dev \
libgcrypt20-dev \
libglib2.0-dev \
libgnutls28-dev \
libgtk-3-dev \
libibverbs-dev \
libiscsi-dev \
libjemalloc-dev \
libjpeg-turbo8-dev \
liblttng-ust-dev \
liblzo2-dev \
libncurses5-dev \
libncursesw5-dev \
libnfs-dev \
libnss3-dev \
libnuma-dev \
libpam0g-dev \
libpixman-1-dev \
librados-dev \
libpmem-dev \
libpng-dev \
libpulse-dev \
librbd-dev \
librdmacm-dev \
libsasl2-dev \
libsdl2-dev \
libsdl2-image-dev \
libseccomp-dev \
libsnappy-dev \
libspice-protocol-dev \
libspice-server-dev \
libssh-dev \
libsystemd-dev \
libtasn1-6-dev \
libtest-harness-perl \
libubsan1 \
libudev-dev \
libusb-1.0-0-dev \
libusbredirhost-dev \
libvdeplug-dev \
libvirglrenderer-dev \
libvte-2.91-dev \
libxen-dev \
libxml2-dev \
libzstd-dev \
llvm \
locales \
make \
python3-yaml \
multipath-tools \
netcat-openbsd \
nettle-dev \
ninja-build \
openssh-client \
perl-base \
pkgconf \
python3 \
python3-numpy \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
ninja-build \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
sparse \
xfslibs-dev
systemtap-sdt-dev \
tar \
tesseract-ocr \
tesseract-ocr-eng \
texinfo \
xfslibs-dev \
zlib1g-dev
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install $PACKAGES
RUN dpkg -l $PACKAGES | sort > /packages.txt
ENV FEATURES clang pyyaml sdl2 docs
# https://bugs.launchpad.net/qemu/+bug/1838763
ENV QEMU_CONFIGURE_OPTS --disable-libssh

View File

@ -1,26 +1,44 @@
FROM ubuntu:20.04
ENV PACKAGES flex bison \
FROM docker.io/library/ubuntu:20.04
ENV PACKAGES \
bc \
bsdmainutils \
bzip2 \
ca-certificates \
ccache \
clang-10\
clang \
dbus \
debianutils \
diffutils \
exuberant-ctags \
findutils \
g++ \
gcc \
gcovr \
genisoimage \
gettext \
git \
glusterfs-common \
hostname \
libaio-dev \
libasan5 \
libasound2-dev \
libattr1-dev \
libbrlapi-dev \
libbz2-dev \
libc6-dev \
libcacard-dev \
libcap-ng-dev \
libcapstone-dev \
libcurl4-gnutls-dev \
libdaxctl-dev \
libdrm-dev \
libepoxy-dev \
libfdt-dev \
libffi-dev \
libgbm-dev \
libgcrypt20-dev \
libglib2.0-dev \
libglusterfs-dev \
libgnutls28-dev \
libgtk-3-dev \
libibverbs-dev \
libiscsi-dev \
@ -28,50 +46,72 @@ ENV PACKAGES flex bison \
libjpeg-turbo8-dev \
liblttng-ust-dev \
liblzo2-dev \
libncurses5-dev \
libncursesw5-dev \
libnfs-dev \
libnss3-dev \
libnuma-dev \
libpam0g-dev \
libpixman-1-dev \
librados-dev \
libpmem-dev \
libpng-dev \
libpulse-dev \
librbd-dev \
librdmacm-dev \
libsasl2-dev \
libsdl2-dev \
libsdl2-image-dev \
libseccomp-dev \
libslirp-dev \
libsnappy-dev \
libspice-protocol-dev \
libspice-server-dev \
libssh-dev \
libsystemd-dev \
libtasn1-6-dev \
libtest-harness-perl \
libubsan1 \
libudev-dev \
libusb-1.0-0-dev \
libusbredirhost-dev \
libvdeplug-dev \
libvirglrenderer-dev \
libvte-2.91-dev \
libxen-dev \
libxml2-dev \
libzstd-dev \
llvm \
locales \
make \
netcat-openbsd \
multipath-tools \
ncat \
nettle-dev \
ninja-build \
openssh-client \
perl-base \
pkgconf \
python3 \
python3-numpy \
python3-opencv \
python3-pil \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
sparse \
systemtap-sdt-dev \
tar \
tesseract-ocr \
tesseract-ocr-eng \
xfslibs-dev\
vim
texinfo \
xfslibs-dev \
zlib1g-dev
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install $PACKAGES
RUN dpkg -l $PACKAGES | sort > /packages.txt
ENV FEATURES clang tsan pyyaml sdl2
# Apply patch https://reviews.llvm.org/D75820
# This is required for TSan in clang-10 to compile with QEMU.

View File

@ -30,9 +30,6 @@ mkdir -p $TEST_DIR/{src,build,install}
# Extract the source tarballs
tar -C $TEST_DIR/src -xf $BASE/qemu.tar || { echo "Failed to untar source"; exit 2; }
if test -f $TEST_DIR/src/Makefile; then
export FEATURES="$FEATURES dtc"
fi
if test -n "$SHOW_ENV"; then
if test -f /packages.txt; then

View File

@ -13,7 +13,7 @@
. common.rc
requires clang
requires_binary clang
cd "$BUILD_DIR"

View File

@ -14,7 +14,7 @@
. common.rc
requires clang asan
requires_binary clang
cd "$BUILD_DIR"

View File

@ -13,7 +13,8 @@
. common.rc
requires mingw dtc
requires_binary x86_64-w64-mingw32-gcc
requires_binary i686-w64-mingw32-gcc
cd "$BUILD_DIR"

View File

@ -14,7 +14,7 @@
. common.rc
requires docs
requires_binary sphinx-build-3 sphinx-build
cd "$BUILD_DIR"

View File

@ -17,7 +17,7 @@
setup_tsan()
{
requires clang tsan
requires_binary clang
tsan_log_dir="/tmp/qemu-test/build/tsan"
mkdir -p $tsan_log_dir > /dev/null || true
EXTRA_CONFIGURE_OPTS="${EXTRA_CONFIGURE_OPTS} --enable-tsan \

View File

@ -18,15 +18,6 @@
# Hexagon doesn't support gdb, so skip the EXTRA_RUNS
EXTRA_RUNS =
# Hexagon has 64K pages, so increase the timeout to keep
# test-mmap from timing out
ifeq ($(CONFIG_DEBUG_TCG),y)
TIMEOUT=800
else
TIMEOUT=500
endif
CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal
CFLAGS += -fno-unroll-loops

View File

@ -65,6 +65,9 @@ run-plugin-%-with-libinsn.so:
-d plugin -D $*-with-libinsn.so.pout $*, \
"$* (inline) on $(TARGET_NAME)")
run-plugin-signals-with-libinsn.so:
$(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support")
# Update TESTS
I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
TESTS=$(MULTIARCH_TESTS) $(I386_TESTS)

View File

@ -37,6 +37,8 @@ signals: LDFLAGS+=-lrt -lpthread
run-signals: signals
$(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support")
run-plugin-signals-with-%:
$(call skip-test, $<, "BROKEN awaiting sigframe clean-ups and vdso support")
# We define the runner for test-mmap after the individual
# architectures have defined their supported pages sizes. If no

View File

@ -49,64 +49,62 @@ size_t test_fsize;
void check_aligned_anonymous_unfixed_mmaps(void)
{
void *p1;
void *p2;
void *p3;
void *p4;
void *p5;
uintptr_t p;
int i;
void *p1;
void *p2;
void *p3;
void *p4;
void *p5;
uintptr_t p;
int i;
fprintf(stdout, "%s", __func__);
for (i = 0; i < 8; i++) {
size_t len;
len = pagesize + (pagesize * i);
p1 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p2 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p3 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p4 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p5 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fprintf(stdout, "%s", __func__);
for (i = 0; i < 0x1fff; i++)
{
size_t len;
/*
* Make sure we get pages aligned with the pagesize. The
* target expects this.
*/
fail_unless(p1 != MAP_FAILED);
fail_unless(p2 != MAP_FAILED);
fail_unless(p3 != MAP_FAILED);
fail_unless(p4 != MAP_FAILED);
fail_unless(p5 != MAP_FAILED);
p = (uintptr_t) p1;
D(printf("p=%x\n", p));
fail_unless((p & pagemask) == 0);
p = (uintptr_t) p2;
fail_unless((p & pagemask) == 0);
p = (uintptr_t) p3;
fail_unless((p & pagemask) == 0);
p = (uintptr_t) p4;
fail_unless((p & pagemask) == 0);
p = (uintptr_t) p5;
fail_unless((p & pagemask) == 0);
len = pagesize + (pagesize * i & 7);
p1 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p2 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p3 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p4 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
p5 = mmap(NULL, len, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* Make sure we get pages aligned with the pagesize. The
target expects this. */
fail_unless (p1 != MAP_FAILED);
fail_unless (p2 != MAP_FAILED);
fail_unless (p3 != MAP_FAILED);
fail_unless (p4 != MAP_FAILED);
fail_unless (p5 != MAP_FAILED);
p = (uintptr_t) p1;
D(printf ("p=%x\n", p));
fail_unless ((p & pagemask) == 0);
p = (uintptr_t) p2;
fail_unless ((p & pagemask) == 0);
p = (uintptr_t) p3;
fail_unless ((p & pagemask) == 0);
p = (uintptr_t) p4;
fail_unless ((p & pagemask) == 0);
p = (uintptr_t) p5;
fail_unless ((p & pagemask) == 0);
/* Make sure we can read from the entire area. */
memcpy (dummybuf, p1, pagesize);
memcpy (dummybuf, p2, pagesize);
memcpy (dummybuf, p3, pagesize);
memcpy (dummybuf, p4, pagesize);
memcpy (dummybuf, p5, pagesize);
munmap (p1, len);
munmap (p2, len);
munmap (p3, len);
munmap (p4, len);
munmap (p5, len);
}
fprintf(stdout, " passed\n");
/* Make sure we can read from the entire area. */
memcpy(dummybuf, p1, pagesize);
memcpy(dummybuf, p2, pagesize);
memcpy(dummybuf, p3, pagesize);
memcpy(dummybuf, p4, pagesize);
memcpy(dummybuf, p5, pagesize);
munmap(p1, len);
munmap(p2, len);
munmap(p3, len);
munmap(p4, len);
munmap(p5, len);
}
fprintf(stdout, " passed\n");
}
void check_large_anonymous_unfixed_mmap(void)
@ -135,52 +133,54 @@ void check_large_anonymous_unfixed_mmap(void)
void check_aligned_anonymous_unfixed_colliding_mmaps(void)
{
char *p1;
char *p2;
char *p3;
uintptr_t p;
int i;
char *p1;
char *p2;
char *p3;
uintptr_t p;
int i;
fprintf(stdout, "%s", __func__);
for (i = 0; i < 0x2fff; i++)
{
int nlen;
p1 = mmap(NULL, pagesize, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless (p1 != MAP_FAILED);
p = (uintptr_t) p1;
fail_unless ((p & pagemask) == 0);
memcpy (dummybuf, p1, pagesize);
fprintf(stdout, "%s", __func__);
for (i = 0; i < 2; i++) {
int nlen;
p1 = mmap(NULL, pagesize, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless(p1 != MAP_FAILED);
p = (uintptr_t) p1;
fail_unless((p & pagemask) == 0);
memcpy(dummybuf, p1, pagesize);
p2 = mmap(NULL, pagesize, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless (p2 != MAP_FAILED);
p = (uintptr_t) p2;
fail_unless ((p & pagemask) == 0);
memcpy (dummybuf, p2, pagesize);
p2 = mmap(NULL, pagesize, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless(p2 != MAP_FAILED);
p = (uintptr_t) p2;
fail_unless((p & pagemask) == 0);
memcpy(dummybuf, p2, pagesize);
munmap (p1, pagesize);
nlen = pagesize * 8;
p3 = mmap(NULL, nlen, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless (p3 != MAP_FAILED);
munmap(p1, pagesize);
nlen = pagesize * 8;
p3 = mmap(NULL, nlen, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fail_unless(p3 != MAP_FAILED);
/* Check if the mmaped areas collide. */
if (p3 < p2
&& (p3 + nlen) > p2)
fail_unless (0);
/* Check if the mmaped areas collide. */
if (p3 < p2
&& (p3 + nlen) > p2) {
fail_unless(0);
}
memcpy (dummybuf, p3, pagesize);
memcpy(dummybuf, p3, pagesize);
/* Make sure we get pages aligned with the pagesize. The
target expects this. */
p = (uintptr_t) p3;
fail_unless ((p & pagemask) == 0);
munmap (p2, pagesize);
munmap (p3, nlen);
}
fprintf(stdout, " passed\n");
/*
* Make sure we get pages aligned with the pagesize. The
* target expects this.
*/
p = (uintptr_t) p3;
fail_unless((p & pagemask) == 0);
munmap(p2, pagesize);
munmap(p3, nlen);
}
fprintf(stdout, " passed\n");
}
void check_aligned_anonymous_fixed_mmaps(void)

View File

@ -22,8 +22,8 @@ class NetBSDVM(basevm.BaseVM):
name = "netbsd"
arch = "x86_64"
link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.1/images/NetBSD-9.1-amd64.iso"
csum = "65bddc95945991c3b2021f9c8ded7f34c25f0a7611b7aa15a15fe23399e902307e926ae97fcd01dc1662ac67b5f6e4be643c6a2b581692ddcb616d30125066f9"
link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.2/images/NetBSD-9.2-amd64.iso"
csum = "5ee0ea101f73386b9b424f5d1041e371db3c42fdd6f4e4518dc79c4a08f31d43091ebe93425c9f0dcaaed2b51131836fe6774f33f89030b58d64709b35fda72f"
size = "20G"
pkgs = [
# tools

View File

@ -22,8 +22,8 @@ class OpenBSDVM(basevm.BaseVM):
name = "openbsd"
arch = "x86_64"
link = "https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/install68.iso"
csum = "47e291fcc2d0c1a8ae0b66329f040b33af755b6adbd21739e20bb5ad56f62b6c"
link = "https://cdn.openbsd.org/pub/OpenBSD/6.9/amd64/install69.iso"
csum = "140d26548aec680e34bb5f82295414228e7f61e4f5e7951af066014fda2d6e43"
size = "20G"
pkgs = [
# tools