maintainer tree pre-PR (testing/docs/semihosting/plugins)
v2 cover maintainer tree pre-PR (testing/docs/semihosting/plugins)
Hi,
This is a roll-up of all my maintainer trees which contains fixes all over QEMU. I'd hoped to minimise the disruption of multiple pull requests but in the end spent a lot of time trying to re-create the win64 cross failure which only occurs on CI. I'm not sure if the failure is just down to some sort of weird registry issue so I'm kind of hoping it disappears once merged. However if anyone is able to run CI on their repo you can try:
git push-ci -f gitlab
and then manually run:
win64-fedora-cross-container (in containers)
and then:
cross-win64-system (in builds)
and let me know if it hangs for you to. In which case I'll just have to drop the Fedora 37 updates all together. Either way I'll base the final PR of this series.
A summary of the contents:
- some cleanups and tweaks for gitlab
- a new playbook to install gitlab runners
- a proposed re-org of the front about section
- a few semihosting fixes (with docs ;-)
- a bunch of tsan fixes touching tcg and plugins
- fixing some plugin races
- expunging the last vestiges of perl from the build system
The following patches need review:
plugins: Iterate on cb_lists in qemu_plugin_user_exit
docs: add a new section to outline emulation support (1 acks, 1 sobs)
gitlab: add lsan suppression file to workaround tcmalloc issues scripts/ci: update gitlab-runner playbook to use latest runner
Alex Bennée (12):
scripts/ci: update gitlab-runner playbook to use latest runner
gitlab: just use plain --cc=clang for custom runner build tests/unit: drop hacky race avoidance in test-io-channel-command
gitlab: add lsan suppression file to workaround tcmalloc issues tests/docker: drop debian-tricore-cross's partial status tests/tcg: skip the vma-pthread test on CI
gitlab: wrap up test results for custom runners
docs: add hotlinks to about preface text
docs: add a new section to outline emulation support
semihosting: add semihosting section to the docs
docs: add an introduction to the system docs tests/tcg: add memory-sve test for aarch64
Emilio Cota (9):
cpu: free cpu->tb_jmp_cache with RCU
util/qht: add missing atomic_set(hashes[i])
thread: de-const qemu_spin_destroy
util/qht: use striped locks under TSAN
plugins: make qemu_plugin_user_exit's locking order consistent with
fork_start's
plugins: fix optimization in plugin_gen_disable_mem_helpers
translator: always pair plugin_gen_insn_{start, end} calls
tcg: exclude non-memory effecting helpers from instrumentation
cpu-exec: assert that plugin_mem_cbs is NULL after execution
Evgeny Iakovlev (1):
semihosting: add O_BINARY flag in host_open for NT compatibility
Keith Packard (1):
semihosting: Write back semihosting data before completion callback
Marc-André Lureau (7):
build-sys: fix crlf-ending C code .gitlab-ci.d/windows: do not disable opengl
meson: replace Perl usage with Python
docs: drop texinfo options
Update lcitool and fedora to 37
lcitool: drop perl from QEMU project/dependencies
lcitool: drop texinfo from QEMU project/dependencies
Mark Cave-Ayland (1):
gitlab: add FF_SCRIPT_SECTIONS for timings
Philippe Mathieu-Daudé (1):
tests/docker: Install flex in debian-tricore-cross
Richard Henderson (2):
tests/tcg: Use SIGKILL for timeout
plugins: Iterate on cb_lists in qemu_plugin_user_exit
Thomas Huth (1):
MAINTAINERS: Fix the entry for tests/tcg/nios2
MAINTAINERS | 2 +- docs/about/emulation.rst | 192 +++++++++++++++ docs/about/index.rst | 17 +- docs/conf.py | 13 -- docs/devel/tcg-plugins.rst | 2 + docs/interop/live-block-operations.rst | 2 + docs/interop/qemu-qmp-ref.rst | 2 + docs/system/arm/emulation.rst | 2 + docs/system/index.rst | 4 +- docs/system/introduction.rst | 220 ++++++++++++++++++ docs/system/multi-process.rst | 2 + docs/system/quickstart.rst | 21 -- docs/tools/index.rst | 2 + docs/user/index.rst | 2 + meson.build | 2 +- accel/tcg/plugin-helpers.h | 4 +- accel/tcg/tb-jmp-cache.h | 1 + include/qemu/plugin.h | 11 + include/qemu/thread.h | 5 +- include/tcg/tcg.h | 2 + accel/tcg/cpu-exec.c | 5 +- accel/tcg/plugin-gen.c | 26 ++- accel/tcg/translator.c | 15 +- cpu.c | 11 +- plugins/core.c | 23 +- semihosting/syscalls.c | 28 +-- tcg/tcg.c | 6 +- tests/unit/test-io-channel-command.c | 14 +- util/qht.c | 97 ++++++-- .gitlab-ci.d/base.yml | 5 + .gitlab-ci.d/buildtest.yml | 1 + .gitlab-ci.d/cirrus/freebsd-12.vars | 2 +- .gitlab-ci.d/cirrus/freebsd-13.vars | 2 +- .gitlab-ci.d/cirrus/macos-12.vars | 2 +- .gitlab-ci.d/custom-runners.yml | 11 + .../custom-runners/ubuntu-20.04-s390x.yml | 13 +- .../custom-runners/ubuntu-22.04-aarch32.yml | 2 +- .../custom-runners/ubuntu-22.04-aarch64.yml | 15 +- .gitlab-ci.d/windows.yml | 5 +- qemu-options.hx | 30 ++- scripts/ci/setup/build-environment.yml | 1 - scripts/ci/setup/gitlab-runner.yml | 56 ++--- scripts/ci/setup/vars.yml.template | 2 - scripts/oss-fuzz/lsan_suppressions.txt | 2 + scripts/shaderinclude.pl | 16 -- scripts/shaderinclude.py | 26 +++ tests/docker/Makefile.include | 1 - tests/docker/dockerfiles/alpine.docker | 2 - tests/docker/dockerfiles/centos8.docker | 2 - .../dockerfiles/debian-amd64-cross.docker | 4 +- tests/docker/dockerfiles/debian-amd64.docker | 2 - .../dockerfiles/debian-arm64-cross.docker | 4 +- .../dockerfiles/debian-armel-cross.docker | 4 +- .../dockerfiles/debian-armhf-cross.docker | 4 +- .../dockerfiles/debian-mips64el-cross.docker | 4 +- .../dockerfiles/debian-mipsel-cross.docker | 4 +- .../dockerfiles/debian-ppc64el-cross.docker | 4 +- .../dockerfiles/debian-s390x-cross.docker | 4 +- .../dockerfiles/debian-toolchain.docker | 1 - .../dockerfiles/debian-tricore-cross.docker | 2 +- .../dockerfiles/fedora-win32-cross.docker | 6 +- .../dockerfiles/fedora-win64-cross.docker | 6 +- tests/docker/dockerfiles/fedora.docker | 6 +- tests/docker/dockerfiles/opensuse-leap.docker | 2 - tests/docker/dockerfiles/ubuntu2004.docker | 2 - tests/lcitool/libvirt-ci | 2 +- tests/lcitool/projects/qemu.yml | 2 - tests/lcitool/refresh | 6 +- tests/qapi-schema/meson.build | 7 +- tests/tcg/Makefile.target | 4 +- tests/tcg/aarch64/Makefile.softmmu-target | 7 + tests/tcg/aarch64/system/boot.S | 3 +- tests/tcg/multiarch/Makefile.target | 9 + tests/vm/centos.aarch64 | 2 +- 74 files changed, 758 insertions(+), 272 deletions(-) create mode 100644 docs/about/emulation.rst create mode 100644 docs/system/introduction.rst delete mode 100644 docs/system/quickstart.rst create mode 100644 scripts/oss-fuzz/lsan_suppressions.txt delete mode 100644 scripts/shaderinclude.pl create mode 100644 scripts/shaderinclude.py
Signature · 1 line
2.34.1
PATCH v2 1/35 scripts/ci: update gitlab-runner playbook to use latest runner
We were using quite and old runner on our machines and running into issues with stalling jobs. Gitlab in the meantime now reliably provide the latest packaged versions of the runner under a stable URL. This update:
- creates a per-arch subdir for builds
- switches from binary tarballs to deb packages
- re-uses the same binary for the secondary runner
- updates distro check for second to 22.04
Note this script isn't fully idempotent as we end up accumulating runners especially during testing. However we also want to be able to run twice with different GitLab keys (e.g. project and personal) so I think we just have to be mindful of that during testing.
---
v2
- only register aarch32 runner, move service start post both registers
- tested on s390x
--- scripts/ci/setup/gitlab-runner.yml | 56 +++++++----------------------- scripts/ci/setup/vars.yml.template | 2 -- 2 files changed, 13 insertions(+), 45 deletions(-)
scripts/ci/setup/gitlab-runner.yml +13 -43
@@ -50,60 +50,30 @@ - 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" + dest: "/root/" + url: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_{{ gitlab_runner_arch }}.deb" - - name: Enable the gitlab-runner service - service: - name: gitlab-runner - state: started - enabled: yes + - name: Install gitlab-runner via package manager + apt: deb="/root/gitlab-runner_{{ gitlab_runner_arch }}.deb" - - name: Download secondary gitlab-runner - get_url: - dest: /usr/local/bin/gitlab-runner-arm - url: "https://s3.amazonaws.com/gitlab-runner-downloads/v{{ gitlab_runner_version }}/binaries/gitlab-runner-{{ gitlab_runner_os }}-arm" - owner: gitlab-runner - group: gitlab-runner - mode: u=rwx,g=rwx,o=rx - when: - - ansible_facts['distribution'] == 'Ubuntu' - - ansible_facts['architecture'] == 'aarch64' - - ansible_facts['distribution_version'] == '20.04' + - name: Register the gitlab-runner + command: "/usr/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\"] }})'" + # The secondary runner will still run under the single gitlab-runner service - name: Register secondary gitlab-runner - command: "/usr/local/bin/gitlab-runner-arm register --non-interactive --url {{ gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registration_token }} --executor shell --tag-list aarch32,{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distribution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{ ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture\"] }} ({{ ansible_facts[\"os_family\"] }})'" + command: "/usr/bin/gitlab-runner register --non-interactive --url {{ gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registration_token }} --executor shell --tag-list aarch32,{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distribution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{ ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture\"] }} ({{ ansible_facts[\"os_family\"] }})'" when: - ansible_facts['distribution'] == 'Ubuntu' - ansible_facts['architecture'] == 'aarch64' - - ansible_facts['distribution_version'] == '20.04' + - ansible_facts['distribution_version'] == '22.04' - - name: Install the secondary gitlab-runner service using its own functionality - command: /usr/local/bin/gitlab-runner-arm install --user gitlab-runner --working-directory /home/gitlab-runner/arm -n gitlab-runner-arm + - name: Install the gitlab-runner service using its own functionality + command: "/usr/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" - when: - - ansible_facts['distribution'] == 'Ubuntu' - - ansible_facts['architecture'] == 'aarch64' - - ansible_facts['distribution_version'] == '20.04' - - name: Enable the secondary gitlab-runner service + - name: Enable the gitlab-runner service service: - name: gitlab-runner-arm + name: gitlab-runner state: started enabled: yes - when: - - ansible_facts['distribution'] == 'Ubuntu' - - ansible_facts['architecture'] == 'aarch64' - - ansible_facts['distribution_version'] == '20.04'
scripts/ci/setup/vars.yml.template +0 -2
@@ -1,5 +1,3 @@ -# 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
Signature · 1 line
2.34.1
Re: [PATCH v2 01/35] scripts/ci: update gitlab-runner playbook to use latest runner
Quoted 17 lines · Alex Bennée
We were using quite and old runner on our machines and running into issues with stalling jobs. Gitlab in the meantime now reliably provide the latest packaged versions of the runner under a stable URL. This update:
- creates a per-arch subdir for builds
- switches from binary tarballs to deb packages
- re-uses the same binary for the secondary runner
- updates distro check for second to 22.04Note this script isn't fully idempotent as we end up accumulating runners especially during testing. However we also want to be able to run twice with different GitLab keys (e.g. project and personal) so I think we just have to be mindful of that during testing.
Signed-off-by Alex Bennée<[email protected]>
Quoted 8 lines
---
v2
- only register aarch32 runner, move service start post both registers
- tested on s390x--- scripts/ci/setup/gitlab-runner.yml | 56 +++++++----------------------- scripts/ci/setup/vars.yml.template | 2 -- 2 files changed, 13 insertions(+), 45 deletions(-)
r~
PATCH v2 2/35 gitlab: add FF_SCRIPT_SECTIONS for timings
In reply to Alex BennéeFrom: Mark Cave-Ayland <[email protected]>
--- .gitlab-ci.d/base.yml | 5 +++++ 1 file changed, 5 insertions(+)
.gitlab-ci.d/base.yml +5 -0
@@ -6,6 +6,11 @@ # most restrictive to least restrictive # .base_job_template: + variables: + # Each script line from will be in a collapsible section in the job output + # and show the duration of each line. + FF_SCRIPT_SECTIONS: 1 + rules: ############################################################# # Stage 1: exclude scenarios where we definitely don't
Signature · 1 line
2.34.1
Re: [PATCH v2 02/35] gitlab: add FF_SCRIPT_SECTIONS for timings
Quoted 8 lines · Alex Bennée
From: Mark Cave-Ayland <[email protected]>
Suggested-by Mark Cave-Ayland <[email protected]>Signed-off-by Alex Bennée <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- .gitlab-ci.d/base.yml | 5 +++++ 1 file changed, 5 insertions(+)
Nice!
Re: [PATCH v2 02/35] gitlab: add FF_SCRIPT_SECTIONS for timings
In reply to Alex BennéeQuoted 14 lines · Alex Bennée
From: Mark Cave-Ayland <[email protected]>
Suggested-by Mark Cave-Ayland <[email protected]>Signed-off-by Alex Bennée <[email protected]>Reviewed-by Thomas Huth <[email protected]>--- .gitlab-ci.d/base.yml | 5 +++++ 1 file changed, 5 insertions(+).gitlab-ci.d/base.yml +0
-0
.gitlab-ci.d/base.yml line 12
Quoted 7 lines
.gitlab-ci.d/base.yml +4
-0@@ -6,6 +6,11 @@ # most restrictive to least restrictive # .base_job_template: + variables: + # Each script line from will be in a collapsible section in the job output + # and show the duration of each line. + FF_SCRIPT_SECTIONS: 1
Ooh, it is nice to learn about this. FWIW, I found it eventually documented at
https://docs.gitlab.com/runner/configuration/feature-flags.html
with a footnote indicating it si valid to set in the pipeline yaml config, not only the runner.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v2 3/35 gitlab: just use plain --cc=clang for custom runner build
In reply to Alex BennéeI think this was because older Ubuntu's didn't alias clang to whatever the latest version was. They do now so lets use that and not break.
--- .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml +1 -1
@@ -81,7 +81,7 @@ ubuntu-22.04-aarch64-clang: script: - mkdir build - cd build - - ../configure --disable-libssh --cc=clang-10 --cxx=clang++-10 --enable-sanitizers + - ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check
Signature · 1 line
2.34.1
PATCH v2 4/35 tests/unit: drop hacky race avoidance in test-io-channel-command
In reply to Alex BennéeWe don't need to play timing games to ensure one socat wins over the other, just create the fifo they both can use before spawning the processes. However in the process we need to disable two tests for Windows platforms as we don't have an abstraction for mkfifo().
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1403
--- tests/unit/test-io-channel-command.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tests/unit/test-io-channel-command.c +10 -4
@@ -20,6 +20,8 @@#include "qemu/osdep.h" #include <glib/gstdio.h> +#include <sys/types.h> +#include <sys/stat.h> #include "io/channel-command.h" #include "io-channel-helpers.h" #include "qapi/error.h"
@@ -29,6 +31,7 @@static char *socat =NULL ; +#ifndef _WIN32static void test_io_channel_command_fifo (bool async) { g_autofree gchar *tmpdir = g_dir_make_tmp("qemu-test-io-channel.XXXXXX", NULL);
@@ -40,12 +43,13 @@ static void test_io_channel_command_fifo(bool async)QIOChannel *src, *dst;QIOChannelTest *test; +if (mkfifo (fifo,0600 )) { +g_error ("mkfifo: %s" ,strerror (errno)); + } + src =QIO_CHANNEL (qio_channel_command_new_spawn ((const char **) srcargv,O_WRONLY , &error_abort)); -/* try to avoid a race to create the socket */ -g_usleep (1000 ); - dst =QIO_CHANNEL (qio_channel_command_new_spawn ((const char **) dstargv,O_RDONLY , &error_abort));
@@ -60,7 +64,6 @@ static void test_io_channel_command_fifo(bool async)g_rmdir (tmpdir); } -static void test_io_channel_command_fifo_async (void ) {if (!socat) {
@@ -80,6 +83,7 @@ static void test_io_channel_command_fifo_sync(void) test_io_channel_command_fifo(false); } +#endif static void test_io_channel_command_echo (bool async)
@@ -124,10 +128,12 @@ int main(int argc, char **argv) socat =g_find_program_in_path ("socat" ); +#ifndef _WIN32g_test_add_func ("/io/channel/command/fifo/sync" , test_io_channel_command_fifo_sync);g_test_add_func ("/io/channel/command/fifo/async" , test_io_channel_command_fifo_async); +#endif g_test_add_func ("/io/channel/command/echo/sync" , test_io_channel_command_echo_sync); g_test_add_func("/io/channel/command/echo/async",
Signature · 1 line
2.34.1
PATCH v2 5/35 build-sys: fix crlf-ending C code
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
On msys2, the shader-to-C script produces bad C:./ui/shader/texture-blit-vert.h:2:5: error: missing terminating " character [-Werror]
Fix it by changing the line ending from crlf to lf, and convert the script to Python (qemu build seems perl-free after that).
Message-Id: <[email protected]>
--- meson.build | 2 +- scripts/shaderinclude.pl | 16 ---------------- scripts/shaderinclude.py | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) delete mode 100644 scripts/shaderinclude.pl create mode 100644 scripts/shaderinclude.py
meson.build +1 -1
@@ -2779,7 +2779,7 @@ config_host_data.set('CONFIG_SLIRP', slirp.found()) genh += configure_file(output: 'config-host.h', configuration: config_host_data) hxtool = find_program('scripts/hxtool') -shaderinclude = find_program('scripts/shaderinclude.pl') +shaderinclude = find_program('scripts/shaderinclude.py') qapi_gen = find_program('scripts/qapi-gen.py') qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py', meson.current_source_dir() / 'scripts/qapi/commands.py',
scripts/shaderinclude.pl deleted +0 -16
@@ -1,16 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -my $file = shift; -open FILE, "<", $file or die "open $file: $!"; -my $name = $file; -$name =~ s|.*/||; -$name =~ s/[-.]/_/g; -print "static GLchar ${name}_src[] =\n"; -while (<FILE>) { - chomp; - printf " \"%s\\n\"\n", $_; -} -print " \"\\n\";\n"; -close FILE;
scripts/shaderinclude.py new file +26 -0
@@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2023 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys +import os + + +def main(args): + file_path = args[1] + basename = os.path.basename(file_path) + varname = basename.replace('-', '_').replace('.', '_') + + with os.fdopen(sys.stdout.fileno(), "wt", closefd=False, newline='\n') as stdout: + with open(file_path, "r", encoding='utf-8') as file: + print(f'static GLchar {varname}_src[] =', file=stdout) + for line in file: + line = line.rstrip() + print(f' "{line}\\n"', file=stdout) + print(' "\\n";', file=stdout) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))
Signature · 1 line
2.34.1
PATCH v2 6/35 .gitlab-ci.d/windows: do not disable opengl
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
The previous patch should have fixed shader compilation.
Message-Id: <[email protected]>
--- .gitlab-ci.d/windows.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
.gitlab-ci.d/windows.yml +2 -3
@@ -71,7 +71,7 @@ msys2-64bit: # for the msys2 64-bit job, due to the build could not complete within # the project timeout. - ..\msys64\usr\bin\bash -lc '../configure --target-list=x86_64-softmmu - --without-default-devices --disable-opengl' + --without-default-devices' - ..\msys64\usr\bin\bash -lc 'make' # qTests don't run successfully with "--without-default-devices", # so let's exclude the qtests from CI for now.
@@ -113,8 +113,7 @@ msys2-32bit: - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink - mkdir output - cd output - - ..\msys64\usr\bin\bash -lc '../configure --target-list=ppc64-softmmu - --disable-opengl' + - ..\msys64\usr\bin\bash -lc '../configure --target-list=ppc64-softmmu' - ..\msys64\usr\bin\bash -lc 'make' - ..\msys64\usr\bin\bash -lc 'make check MTESTARGS=\"--no-suite qtest\" || { cat meson-logs/testlog.txt; exit 1; }'
Signature · 1 line
2.34.1
PATCH v2 7/35 meson: replace Perl usage with Python
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
Let's try to remove Perl usage during build time.
Message-Id: <[email protected]>
--- tests/qapi-schema/meson.build | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
tests/qapi-schema/meson.build +4 -3
@@ -259,22 +259,23 @@ if build_docs # Fix possible inconsistency in line endings in generated output and # in the golden reference (which could otherwise cause test failures # on Windows hosts). Unfortunately diff --strip-trailing-cr - # is GNU-diff only. The odd-looking perl is because we must avoid + # is GNU-diff only. The odd-looking python is because we must avoid # using an explicit '\' character in the command arguments to # a custom_target(), as Meson will unhelpfully replace it with a '/' # (https://github.com/mesonbuild/meson/issues/1564) + remove_cr = [python, '-c', 'import sys;[sys.stdout.write(line.replace(chr(13), "")) for line in sys.stdin]'] qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized', output: ['doc-good.txt.nocr'], input: qapi_doc_out[0], build_by_default: true, - command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'], + command: [remove_cr, '@INPUT@'], capture: true) qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized', output: ['doc-good.ref.nocr'], input: files('doc-good.txt'), build_by_default: true, - command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'], + command: [remove_cr, '@INPUT@'], capture: true) test('QAPI rST doc', diff, args: ['-u', qapi_doc_ref_nocr[0], qapi_doc_out_nocr[0]],
Signature · 1 line
2.34.1
PATCH v2 8/35 docs: drop texinfo options
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
It looks like this is no longer wanted, we only build the html output.
Message-Id: <[email protected]>
--- docs/conf.py | 13 ------------- 1 file changed, 13 deletions(-)
docs/conf.py +0 -13
@@ -297,19 +297,6 @@ ] man_make_section_directory = False -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'QEMU', u'QEMU Documentation', - author, 'QEMU', 'One line description of project.', - 'Miscellaneous'), -] - - - # We use paths starting from qemu_docdir here so that you can run # sphinx-build from anywhere and the kerneldoc extension can still # find everything.
Signature · 1 line
2.34.1
PATCH v2 9/35 gitlab: add lsan suppression file to workaround tcmalloc issues
In reply to Alex BennéeThe up-coming upgrade to Fedora 37 will bring in libtcmalloc as a dependency of libglusterfs which confuses our fuzz run. Rather than disable the build lets use LSAN's suppression mechanism to prevent the job from failing.
--- .gitlab-ci.d/buildtest.yml | 1 + scripts/oss-fuzz/lsan_suppressions.txt | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 scripts/oss-fuzz/lsan_suppressions.txt
.gitlab-ci.d/buildtest.yml +1 -0
@@ -511,6 +511,7 @@ build-oss-fuzz: IMAGE: fedora script: - mkdir build-oss-fuzz + - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address" ./scripts/oss-fuzz/build.sh - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
scripts/oss-fuzz/lsan_suppressions.txt new file +2 -0
@@ -0,0 +1,2 @@ +# The tcmalloc on Fedora37 confuses things +leak:/lib64/libtcmalloc_minimal.so.4
Signature · 1 line
2.34.1
Re: [PATCH v2 09/35] gitlab: add lsan suppression file to workaround tcmalloc issues
Quoted 31 lines · Alex Bennée
The up-coming upgrade to Fedora 37 will bring in libtcmalloc as a dependency of libglusterfs which confuses our fuzz run. Rather than disable the build lets use LSAN's suppression mechanism to prevent the job from failing.
Signed-off-by Alex Bennée <[email protected]>Cc Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest.yml | 1 + scripts/oss-fuzz/lsan_suppressions.txt | 2 ++ 2 files changed, 3 insertions(+)create mode 100644
scripts/oss-fuzz/lsan_suppressions.txt.gitlab-ci.d/buildtest.yml +1
-0@@ -511,6 +511,7 @@ build-oss-fuzz: IMAGE: fedora script: - mkdir build-oss-fuzz + - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address" ./scripts/oss-fuzz/build.sh - export ASAN_OPTIONS="fast_unwind_on_malloc=0"scripts/oss-fuzz/lsan_suppressions.txt new file +0
-0
scripts/oss-fuzz/lsan_suppressions.txt line 2
Quoted 2 lines
scripts/oss-fuzz/lsan_suppressions.txt new file +2
-0@@ -0,0 +1,2 @@ +# The tcmalloc on Fedora37 confuses things +leak:/lib64/libtcmalloc_minimal.so.4
Re: [PATCH v2 09/35] gitlab: add lsan suppression file to workaround tcmalloc issues
In reply to Alex BennéeQuoted 31 lines · Alex Bennée
The up-coming upgrade to Fedora 37 will bring in libtcmalloc as a dependency of libglusterfs which confuses our fuzz run. Rather than disable the build lets use LSAN's suppression mechanism to prevent the job from failing.
Signed-off-by Alex Bennée <[email protected]>Cc Daniel P. Berrangé <[email protected]>--- .gitlab-ci.d/buildtest.yml | 1 + scripts/oss-fuzz/lsan_suppressions.txt | 2 ++ 2 files changed, 3 insertions(+)create mode 100644
scripts/oss-fuzz/lsan_suppressions.txt.gitlab-ci.d/buildtest.yml +1
-0@@ -511,6 +511,7 @@ build-oss-fuzz: IMAGE: fedora script: - mkdir build-oss-fuzz + - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address" ./scripts/oss-fuzz/build.sh - export ASAN_OPTIONS="fast_unwind_on_malloc=0"scripts/oss-fuzz/lsan_suppressions.txt new file +0
-0
scripts/oss-fuzz/lsan_suppressions.txt line 2
Quoted 2 lines
scripts/oss-fuzz/lsan_suppressions.txt new file +2
-0@@ -0,0 +1,2 @@ +# The tcmalloc on Fedora37 confuses things +leak:/lib64/libtcmalloc_minimal.so.4
Maybe add a comment around Fedora37 in tests/lcitool/libvirt-ci in the next patch "see workaround in scripts/oss-fuzz/lsan_suppressions.txt" so we remember to remove it when updating again?
Otherwise,
PATCH v2 10/35 Update lcitool and fedora to 37
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
Fedora 35 is EOL.
Update to upstream lcitool, that dropped f35 and added f37.
Message-Id: <[email protected]>
--- tests/docker/dockerfiles/fedora-win32-cross.docker | 4 ++-- tests/docker/dockerfiles/fedora-win64-cross.docker | 4 ++-- tests/docker/dockerfiles/fedora.docker | 4 ++-- tests/lcitool/libvirt-ci | 2 +- tests/lcitool/refresh | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-)
tests/docker/dockerfiles/fedora-win32-cross.docker +2 -2
@@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all --cross mingw32 fedora-35 qemu +# $ lcitool dockerfile --layers all --cross mingw32 fedora-37 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM registry.fedoraproject.org/fedora:35 +FROM registry.fedoraproject.org/fedora:37 RUN dnf install -y nosync && \ echo -e '#!/bin/sh\n\
tests/docker/dockerfiles/fedora-win64-cross.docker +2 -2
@@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all --cross mingw64 fedora-35 qemu +# $ lcitool dockerfile --layers all --cross mingw64 fedora-37 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM registry.fedoraproject.org/fedora:35 +FROM registry.fedoraproject.org/fedora:37 RUN dnf install -y nosync && \ echo -e '#!/bin/sh\n\
tests/docker/dockerfiles/fedora.docker +2 -2
@@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all fedora-35 qemu +# $ lcitool dockerfile --layers all fedora-37 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM registry.fedoraproject.org/fedora:35 +FROM registry.fedoraproject.org/fedora:37 RUN dnf install -y nosync && \ echo -e '#!/bin/sh\n\
tests/lcitool/libvirt-ci +1 -1
@@ -1 +1 @@ -Subproject commit e3eb28cf2e17fbcf7fe7e19505ee432b8ec5bbb5 +Subproject commit 319a534c220f53fc8670254cac25d6f662c82112
tests/lcitool/refresh +3 -3
@@ -111,7 +111,7 @@ try: generate_dockerfile("centos8", "centos-stream-8") generate_dockerfile("debian-amd64", "debian-11", trailer="".join(debian11_extras)) - generate_dockerfile("fedora", "fedora-35") + generate_dockerfile("fedora", "fedora-37") generate_dockerfile("opensuse-leap", "opensuse-leap-153") generate_dockerfile("ubuntu2004", "ubuntu-2004", trailer="".join(ubuntu2004_tsanhack))
@@ -161,12 +161,12 @@ try: trailer=cross_build("s390x-linux-gnu-", "s390x-softmmu,s390x-linux-user")) - generate_dockerfile("fedora-win32-cross", "fedora-35", + generate_dockerfile("fedora-win32-cross", "fedora-37", cross="mingw32", trailer=cross_build("i686-w64-mingw32-", "i386-softmmu")) - generate_dockerfile("fedora-win64-cross", "fedora-35", + generate_dockerfile("fedora-win64-cross", "fedora-37", cross="mingw64", trailer=cross_build("x86_64-w64-mingw32-", "x86_64-softmmu"))
Signature · 1 line
2.34.1
PATCH v2 11/35 lcitool: drop perl from QEMU project/dependencies
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- .gitlab-ci.d/cirrus/freebsd-12.vars | 2 +- .gitlab-ci.d/cirrus/freebsd-13.vars | 2 +- .gitlab-ci.d/cirrus/macos-12.vars | 2 +- scripts/ci/setup/build-environment.yml | 1 - tests/docker/dockerfiles/alpine.docker | 1 - tests/docker/dockerfiles/centos8.docker | 1 - tests/docker/dockerfiles/debian-amd64-cross.docker | 1 - tests/docker/dockerfiles/debian-amd64.docker | 1 - tests/docker/dockerfiles/debian-arm64-cross.docker | 1 - tests/docker/dockerfiles/debian-armel-cross.docker | 1 - tests/docker/dockerfiles/debian-armhf-cross.docker | 1 - tests/docker/dockerfiles/debian-mips64el-cross.docker | 1 - tests/docker/dockerfiles/debian-mipsel-cross.docker | 1 - tests/docker/dockerfiles/debian-ppc64el-cross.docker | 1 - tests/docker/dockerfiles/debian-s390x-cross.docker | 1 - tests/docker/dockerfiles/debian-tricore-cross.docker | 1 - tests/docker/dockerfiles/fedora-win32-cross.docker | 1 - tests/docker/dockerfiles/fedora-win64-cross.docker | 1 - tests/docker/dockerfiles/fedora.docker | 1 - tests/docker/dockerfiles/opensuse-leap.docker | 1 - tests/docker/dockerfiles/ubuntu2004.docker | 1 - tests/lcitool/projects/qemu.yml | 1 - tests/vm/centos.aarch64 | 2 +- 23 files changed, 4 insertions(+), 23 deletions(-)
.gitlab-ci.d/cirrus/freebsd-12.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip-3.8' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/freebsd-13.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip-3.8' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/macos-12.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake' NINJA='/opt/homebrew/bin/ninja' PACKAGING_COMMAND='brew' PIP3='/opt/homebrew/bin/pip3' -PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb 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' +PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja 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' PYTHON='/opt/homebrew/bin/python3'
scripts/ci/setup/build-environment.yml +0 -1
@@ -155,7 +155,6 @@ - nettle-devel - ninja-build - nmap-ncat - - perl-Test-Harness - pixman-devel - python36 - rdma-core-devel
tests/docker/dockerfiles/alpine.docker +0 -1
@@ -77,7 +77,6 @@ RUN apk update && \ numactl-dev \ openssh-client \ pcre-dev \ - perl \ pixman-dev \ pkgconf \ pulseaudio-dev \
tests/docker/dockerfiles/centos8.docker +0 -1
@@ -91,7 +91,6 @@ RUN dnf distro-sync -y && \ openssh-clients \ pam-devel \ pcre-static \ - perl \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \
tests/docker/dockerfiles/debian-amd64-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-amd64.docker +0 -1
@@ -108,7 +108,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ nettle-dev \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-arm64-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-armel-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-armhf-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-mips64el-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-mipsel-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-ppc64el-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-s390x-cross.docker +0 -1
@@ -40,7 +40,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ ncat \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/docker/dockerfiles/debian-tricore-cross.docker +0 -1
@@ -28,7 +28,6 @@ RUN apt update && \ locales \ make \ ninja-build \ - perl-base \ pkgconf \ python3-pip \ python3-setuptools \
tests/docker/dockerfiles/fedora-win32-cross.docker +0 -1
@@ -42,7 +42,6 @@ exec "$@"' > /usr/bin/nosync && \ nmap-ncat \ openssh-clients \ pcre-static \ - perl-base \ python3 \ python3-PyYAML \ python3-numpy \
tests/docker/dockerfiles/fedora-win64-cross.docker +0 -1
@@ -42,7 +42,6 @@ exec "$@"' > /usr/bin/nosync && \ nmap-ncat \ openssh-clients \ pcre-static \ - perl-base \ python3 \ python3-PyYAML \ python3-numpy \
tests/docker/dockerfiles/fedora.docker +0 -1
@@ -98,7 +98,6 @@ exec "$@"' > /usr/bin/nosync && \ openssh-clients \ pam-devel \ pcre-static \ - perl-base \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \
tests/docker/dockerfiles/opensuse-leap.docker +0 -1
@@ -88,7 +88,6 @@ RUN zypper update -y && \ openssh \ pam-devel \ pcre-devel-static \ - perl-base \ pkgconfig \ python3-Pillow \ python3-PyYAML \
tests/docker/dockerfiles/ubuntu2004.docker +0 -1
@@ -105,7 +105,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ nettle-dev \ ninja-build \ openssh-client \ - perl-base \ pkgconf \ python3 \ python3-numpy \
tests/lcitool/projects/qemu.yml +0 -1
@@ -83,7 +83,6 @@ packages: - ncursesw - pam - pcre-static - - perl - pixman - pkg-config - pulseaudio
tests/vm/centos.aarch64 +1 -1
@@ -28,7 +28,7 @@ DEFAULT_CONFIG = { "dnf config-manager --set-enabled powertools, " "dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo, " "dnf install -y make ninja-build git python38 gcc gcc-c++ flex bison "\ - "glib2-devel perl pixman-devel zlib-devel docker-ce.aarch64, " + "glib2-devel pixman-devel zlib-devel docker-ce.aarch64, " "systemctl enable docker, " ), # We increase beyond the default time since during boot
Signature · 1 line
2.34.1
PATCH v2 12/35 lcitool: drop texinfo from QEMU project/dependencies
In reply to Alex BennéeFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- .gitlab-ci.d/cirrus/freebsd-12.vars | 2 +- .gitlab-ci.d/cirrus/freebsd-13.vars | 2 +- .gitlab-ci.d/cirrus/macos-12.vars | 2 +- tests/docker/dockerfiles/alpine.docker | 1 - tests/docker/dockerfiles/centos8.docker | 1 - tests/docker/dockerfiles/debian-amd64-cross.docker | 3 +-- tests/docker/dockerfiles/debian-amd64.docker | 1 - tests/docker/dockerfiles/debian-arm64-cross.docker | 3 +-- tests/docker/dockerfiles/debian-armel-cross.docker | 3 +-- tests/docker/dockerfiles/debian-armhf-cross.docker | 3 +-- tests/docker/dockerfiles/debian-mips64el-cross.docker | 3 +-- tests/docker/dockerfiles/debian-mipsel-cross.docker | 3 +-- tests/docker/dockerfiles/debian-ppc64el-cross.docker | 3 +-- tests/docker/dockerfiles/debian-s390x-cross.docker | 3 +-- tests/docker/dockerfiles/debian-toolchain.docker | 1 - tests/docker/dockerfiles/fedora-win32-cross.docker | 1 - tests/docker/dockerfiles/fedora-win64-cross.docker | 1 - tests/docker/dockerfiles/fedora.docker | 1 - tests/docker/dockerfiles/opensuse-leap.docker | 1 - tests/docker/dockerfiles/ubuntu2004.docker | 1 - tests/lcitool/projects/qemu.yml | 1 - 21 files changed, 11 insertions(+), 29 deletions(-)
.gitlab-ci.d/cirrus/freebsd-12.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip-3.8' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract usbredir virglrenderer vte3 zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/freebsd-13.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PACKAGING_COMMAND='pkg' PIP3='/usr/local/bin/pip-3.8' -PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd' +PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract usbredir virglrenderer vte3 zstd' PYPI_PKGS='' PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/macos-12.vars +1 -1
@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake' NINJA='/opt/homebrew/bin/ninja' PACKAGING_COMMAND='brew' PIP3='/opt/homebrew/bin/pip3' -PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract texinfo usbredir vde vte3 zlib zstd' +PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract usbredir vde vte3 zlib zstd' PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme' PYTHON='/opt/homebrew/bin/python3'
tests/docker/dockerfiles/alpine.docker +0 -1
@@ -99,7 +99,6 @@ RUN apk update && \ spice-protocol \ tar \ tesseract-ocr \ - texinfo \ usbredir-dev \ util-linux \ vde2-dev \
tests/docker/dockerfiles/centos8.docker +0 -1
@@ -110,7 +110,6 @@ RUN dnf distro-sync -y && \ systemd-devel \ systemtap-sdt-devel \ tar \ - texinfo \ usbredir-devel \ util-linux \ virglrenderer-devel \
tests/docker/dockerfiles/debian-amd64-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-amd64.docker +0 -1
@@ -125,7 +125,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ tar \ tesseract-ocr \ tesseract-ocr-eng \ - texinfo \ xfslibs-dev \ zlib1g-dev && \ eatmydata apt-get autoremove -y && \
tests/docker/dockerfiles/debian-arm64-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-armel-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-armhf-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-mips64el-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-mipsel-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-ppc64el-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-s390x-cross.docker +1 -2
@@ -55,8 +55,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ sparse \ tar \ tesseract-ocr \ - tesseract-ocr-eng \ - texinfo && \ + tesseract-ocr-eng && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
tests/docker/dockerfiles/debian-toolchain.docker +0 -1
@@ -21,7 +21,6 @@ RUN apt update && \ libmpc-dev \ libmpfr-dev \ rsync \ - texinfo \ wget && \ DEBIAN_FRONTEND=noninteractive eatmydata \ apt build-dep -yy --arch-only gcc glibc
tests/docker/dockerfiles/fedora-win32-cross.docker +0 -1
@@ -57,7 +57,6 @@ exec "$@"' > /usr/bin/nosync && \ tar \ tesseract \ tesseract-langpack-eng \ - texinfo \ util-linux \ which && \ nosync dnf autoremove -y && \
tests/docker/dockerfiles/fedora-win64-cross.docker +0 -1
@@ -57,7 +57,6 @@ exec "$@"' > /usr/bin/nosync && \ tar \ tesseract \ tesseract-langpack-eng \ - texinfo \ util-linux \ which && \ nosync dnf autoremove -y && \
tests/docker/dockerfiles/fedora.docker +0 -1
@@ -121,7 +121,6 @@ exec "$@"' > /usr/bin/nosync && \ tar \ tesseract \ tesseract-langpack-eng \ - texinfo \ usbredir-devel \ util-linux \ virglrenderer-devel \
tests/docker/dockerfiles/opensuse-leap.docker +0 -1
@@ -111,7 +111,6 @@ RUN zypper update -y && \ tar \ tesseract-ocr \ tesseract-ocr-traineddata-english \ - texinfo \ usbredir-devel \ util-linux \ virglrenderer-devel \
tests/docker/dockerfiles/ubuntu2004.docker +0 -1
@@ -124,7 +124,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ tar \ tesseract-ocr \ tesseract-ocr-eng \ - texinfo \ xfslibs-dev \ zlib1g-dev && \ eatmydata apt-get autoremove -y && \
tests/lcitool/projects/qemu.yml +0 -1
@@ -109,7 +109,6 @@ packages: - tar - tesseract - tesseract-eng - - texinfo - usbredir - virglrenderer - vte
Signature · 1 line
2.34.1
PATCH v2 13/35 tests/docker: Install flex in debian-tricore-cross
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
When flex is not available, binutils sources default to the 'missing' script, but the current script available is not in the format expected by the 'configure' script:
$ ./configure ... /usr/src/binutils/missing: Unknown `--run' option Try `/usr/src/binutils/missing --help' for more information configure: WARNING: `missing' script is too old or missing ... checking for bison... bison -y checking for flex... no checking for lex... no checking for flex... /usr/src/binutils/missing flex
$ make ... updating ldgram.h gcc -DHAVE_CONFIG_H -I. -I. -I. -D_GNU_SOURCE -I. -I. -I../bfd -I./../bfd -I./../include -I./../intl -I../intl -w -DLOCALEDIR="\"/usr/local/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -w -c `test -f 'ldgram.c' || echo './'`ldgram.c `test -f ldlex.l || echo './'`ldlex.l /bin/sh: 1: ldlex.l: not found make[3]: *** [Makefile:662: ldlex.c] Error 127 make[3]: Leaving directory '/usr/src/binutils/ld' make[2]: *** [Makefile:799: all-recursive] Error 1
By pass the 'missing' script use by directly installing 'flex' in the container.
Message-Id: <[email protected]>
--- tests/docker/dockerfiles/debian-tricore-cross.docker | 1 + 1 file changed, 1 insertion(+)
tests/docker/dockerfiles/debian-tricore-cross.docker +1 -0
@@ -20,6 +20,7 @@ RUN apt update && \ bzip2 \ ca-certificates \ ccache \ + flex \ g++ \ gcc \ git \
Signature · 1 line
2.34.1
PATCH v2 14/35 tests/docker: drop debian-tricore-cross's partial status
In reply to Alex BennéeThis image is perfectly capable of building QEMU, and indeed we do that on gitlab. Drop the DOCKER_PARTIAL_IMAGES setting so we can also test the gitlab build locally.
--- tests/docker/Makefile.include | 1 - 1 file changed, 1 deletion(-)
tests/docker/Makefile.include +0 -1
@@ -128,7 +128,6 @@ DOCKER_PARTIAL_IMAGES += debian-mips-cross DOCKER_PARTIAL_IMAGES += debian-nios2-cross DOCKER_PARTIAL_IMAGES += debian-riscv64-test-cross DOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross -DOCKER_PARTIAL_IMAGES += debian-tricore-cross DOCKER_PARTIAL_IMAGES += debian-xtensa-cross DOCKER_PARTIAL_IMAGES += fedora-cris-cross
Signature · 1 line
2.34.1
PATCH v2 15/35 tests/tcg: skip the vma-pthread test on CI
In reply to Alex BennéeWe are getting a lot of failures that are not related to changes so this could be a flaky test.
--- tests/tcg/multiarch/Makefile.target | 9 +++++++++ 1 file changed, 9 insertions(+)
tests/tcg/multiarch/Makefile.target +9 -0
@@ -42,6 +42,15 @@ munmap-pthread: LDFLAGS+=-pthread vma-pthread: CFLAGS+=-pthread vma-pthread: LDFLAGS+=-pthread +# The vma-pthread seems very sensitive on gitlab and we currently +# don't know if its exposing a real bug or the test is flaky. +ifneq ($(GITLAB_CI),) +run-vma-pthread: vma-pthread + $(call skip-test, $<, "flaky on CI?") +run-plugin-vma-pthread-with-%: vma-pthread + $(call skip-test, $<, "flaky on CI?") +endif + # We define the runner for test-mmap after the individual # architectures have defined their supported pages sizes. If no # additional page sizes are defined we only run the default test.
Signature · 1 line
2.34.1
PATCH v2 16/35 tests/tcg: Use SIGKILL for timeout
In reply to Alex BennéeFrom: Richard Henderson <[email protected]>
linux-user blocks all signals while attempting to handle guest signals (e.g. ABRT), which means that the default TERM sent by timeout has no effect -- KILL instead.
Message-Id: <[email protected]>
--- tests/tcg/Makefile.target | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/tcg/Makefile.target +2 -2
@@ -54,10 +54,10 @@ cc-option = if $(call cc-test, $1); then \ # $1 = test name, $2 = cmd, $3 = desc ifeq ($(filter %-softmmu, $(TARGET)),) -run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \ +run-test = $(call quiet-command, timeout -s KILL --foreground $(TIMEOUT) $2 > $1.out, \ TEST,$(or $3, $*, $<) on $(TARGET_NAME)) else -run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2, \ +run-test = $(call quiet-command, timeout -s KILL --foreground $(TIMEOUT) $2, \ TEST,$(or $3, $*, $<) on $(TARGET_NAME)) endif
Signature · 1 line
2.34.1
Re: [PATCH v2 16/35] tests/tcg: Use SIGKILL for timeout
Quoted 6 lines · Alex Bennée
From: Richard Henderson <[email protected]>
linux-user blocks all signals while attempting to handle guest signals (e.g. ABRT), which means that the default TERM sent by timeout has no effect -- KILL instead.
Quoted 7 lines
Signed-off-by Richard Henderson <[email protected]>Message-Id: <[email protected]>
[AJB: expanded commit message from cover letter]Signed-off-by Alex Bennée <[email protected]>--- tests/tcg/Makefile.target | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH v2 17/35 gitlab: wrap up test results for custom runners
In reply to Alex BennéeInstead of spewing the whole log to stdout lets just define them as build artefacts so we can examine them later. Where we are running check-tcg run it first as those tests are yet to be integrated into meson. To avoid confusion we don't run multiple check-tcg tests at once.
---
v2
- mention we don't parallelise check-tcg
--- .gitlab-ci.d/custom-runners.yml | 11 +++++++++++ .gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml | 13 ++++++------- .../custom-runners/ubuntu-22.04-aarch32.yml | 2 +- .../custom-runners/ubuntu-22.04-aarch64.yml | 13 ++++++------- 4 files changed, 24 insertions(+), 15 deletions(-)
.gitlab-ci.d/custom-runners.yml +11 -0
@@ -13,6 +13,17 @@ variables: GIT_STRATEGY: clone +# All custom runners can extend this template to upload the testlog +# data as an artifact and also feed the junit report +.custom_artifacts_template: + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + expire_in: 7 days + paths: + - build/meson-logs/testlog.txt + reports: + junit: build/meson-logs/testlog.junit.xml + include: - local: '/.gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml' - local: '/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml'
.gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml +6 -7
@@ -3,6 +3,7 @@ # "Install basic packages to build QEMU on Ubuntu 20.04/20.04" ubuntu-20.04-s390x-all-linux-static: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -19,12 +20,11 @@ ubuntu-20.04-s390x-all-linux-static: - ../configure --enable-debug --static --disable-system --disable-glusterfs --disable-libssh || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc` + - make --output-sync check-tcg - make --output-sync -j`nproc` check - || { cat meson-logs/testlog.txt; exit 1; } ; - - make --output-sync -j`nproc` check-tcg - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-20.04-s390x-all: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -41,9 +41,9 @@ ubuntu-20.04-s390x-all: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc` - make --output-sync -j`nproc` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-20.04-s390x-alldbg: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -64,9 +64,9 @@ ubuntu-20.04-s390x-alldbg: - make clean - make --output-sync -j`nproc` - make --output-sync -j`nproc` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-20.04-s390x-clang: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -86,7 +86,6 @@ ubuntu-20.04-s390x-clang: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc` - make --output-sync -j`nproc` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-20.04-s390x-tci: needs: []
@@ -109,6 +108,7 @@ ubuntu-20.04-s390x-tci: - make --output-sync -j`nproc` ubuntu-20.04-s390x-notcg: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -128,4 +128,3 @@ ubuntu-20.04-s390x-notcg: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc` - make --output-sync -j`nproc` check - || { cat meson-logs/testlog.txt; exit 1; } ;
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch32.yml +1 -1
@@ -3,6 +3,7 @@ # "Install basic packages to build QEMU on Ubuntu 20.04" ubuntu-22.04-aarch32-all: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -22,4 +23,3 @@ ubuntu-22.04-aarch32-all: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ;
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml +6 -7
@@ -3,6 +3,7 @@ # "Install basic packages to build QEMU on Ubuntu 20.04" ubuntu-22.04-aarch64-all-linux-static: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -19,12 +20,11 @@ ubuntu-22.04-aarch64-all-linux-static: - ../configure --enable-debug --static --disable-system --disable-pie || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` + - make check-tcg - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ; - - make --output-sync -j`nproc --ignore=40` check-tcg - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-22.04-aarch64-all: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -44,9 +44,9 @@ ubuntu-22.04-aarch64-all: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-22.04-aarch64-alldbg: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -63,9 +63,9 @@ ubuntu-22.04-aarch64-alldbg: - make clean - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-22.04-aarch64-clang: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -85,7 +85,6 @@ ubuntu-22.04-aarch64-clang: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ; ubuntu-22.04-aarch64-tci: needs: []
@@ -108,6 +107,7 @@ ubuntu-22.04-aarch64-tci: - make --output-sync -j`nproc --ignore=40` ubuntu-22.04-aarch64-notcg: + extends: .custom_artifacts_template needs: [] stage: build tags:
@@ -127,4 +127,3 @@ ubuntu-22.04-aarch64-notcg: || { cat config.log meson-logs/meson-log.txt; exit 1; } - make --output-sync -j`nproc --ignore=40` - make --output-sync -j`nproc --ignore=40` check - || { cat meson-logs/testlog.txt; exit 1; } ;
Signature · 1 line
2.34.1
PATCH v2 18/35 MAINTAINERS: Fix the entry for tests/tcg/nios2
In reply to Alex BennéeFrom: Thomas Huth <[email protected]>
tests/tcg/nios2/Makefile.target has accidentally been added to the Microblaze section. Move it into the correct nios2 section instead - and while we're at it, it should also cover the whole folder, and not only the Makefile.
Message-Id: <[email protected]>
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
@@ -240,7 +240,6 @@ F: target/microblaze/ F: hw/microblaze/ F: disas/microblaze.c F: tests/docker/dockerfiles/debian-microblaze-cross.d/build-toolchain.sh -F: tests/tcg/nios2/Makefile.target MIPS TCG CPUs M: Philippe Mathieu-Daudé <[email protected]>
@@ -262,6 +261,7 @@ F: hw/nios2/ F: disas/nios2.c F: configs/devices/nios2-softmmu/default.mak F: tests/docker/dockerfiles/debian-nios2-cross.d/build-toolchain.sh +F: tests/tcg/nios2/ OpenRISC TCG CPUs M: Stafford Horne <[email protected]>
Signature · 1 line
2.34.1
PATCH v2 19/35 docs: add hotlinks to about preface text
In reply to Alex BennéeMake it easier to navigate the documentation.
--- docs/about/index.rst | 16 ++++++++-------- docs/system/index.rst | 2 ++ docs/tools/index.rst | 2 ++ docs/user/index.rst | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)
docs/about/index.rst +8 -8
@@ -5,19 +5,19 @@ About QEMU QEMU is a generic and open source machine emulator and virtualizer. QEMU can be used in several different ways. The most common is for -"system emulation", where it provides a virtual model of an +:ref:`System Emulation`, where it provides a virtual model of an entire machine (CPU, memory and emulated devices) to run a guest OS. -In this mode the CPU may be fully emulated, or it may work with -a hypervisor such as KVM, Xen, Hax or Hypervisor.Framework to -allow the guest to run directly on the host CPU. +In this mode the CPU may be fully emulated, or it may work with a +hypervisor such as KVM, Xen, Hax or Hypervisor.Framework to allow the +guest to run directly on the host CPU. -The second supported way to use QEMU is "user mode emulation", +The second supported way to use QEMU is :ref:`User Mode Emulation`, where QEMU can launch processes compiled for one CPU on another CPU. In this mode the CPU is always emulated. -QEMU also provides a number of standalone commandline utilities, -such as the ``qemu-img`` disk image utility that allows you to create, -convert and modify disk images. +QEMU also provides a number of standalone :ref:`command line +utilities<Tools>`, such as the ``qemu-img`` disk image utility that +allows you to create, convert and modify disk images. .. toctree:: :maxdepth: 2
docs/system/index.rst +2 -0
@@ -1,3 +1,5 @@ +.. _System Emulation: + ---------------- System Emulation ----------------
docs/tools/index.rst +2 -0
@@ -1,3 +1,5 @@ +.. _Tools: + ----- Tools -----
docs/user/index.rst +2 -0
@@ -1,3 +1,5 @@ +.. _User Mode Emulation: + ------------------- User Mode Emulation -------------------
Signature · 1 line
2.34.1
Re: [PATCH v2 19/35] docs: add hotlinks to about preface text
Quoted 11 lines · Alex Bennée
Make it easier to navigate the documentation.
Reviewed-by Peter Maydell <[email protected]>Signed-off-by Alex Bennée <[email protected]>--- docs/about/index.rst | 16 ++++++++-------- docs/system/index.rst | 2 ++ docs/tools/index.rst | 2 ++ docs/user/index.rst | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-)
PATCH v2 20/35 docs: add a new section to outline emulation support
In reply to Alex BennéeThis affects both system and user mode emulation so we should probably list it up front.
---
v2
- HPs -> HP's
- MIPs-like -> MIPS-like
--- docs/about/emulation.rst | 103 ++++++++++++++++++++++++++++++++++ docs/about/index.rst | 1 + docs/devel/tcg-plugins.rst | 2 + docs/system/arm/emulation.rst | 2 + 4 files changed, 108 insertions(+) create mode 100644 docs/about/emulation.rst
docs/about/emulation.rst new file +103 -0
@@ -0,0 +1,103 @@ +Emulation +========= + +QEMU's Tiny Code Generator (TCG) gives it the ability to emulate a +number of CPU architectures on any supported platform. Both +:ref:`System Emulation` and :ref:`User Mode Emulation` are supported +depending on the guest architecture. + +.. list-table:: Supported Guest Architectures for Emulation + :widths: 30 10 10 50 + :header-rows: 1 + + * - Architecture (qemu name) + - System + - User-mode + - Notes + * - Alpha + - Yes + - Yes + - Legacy 64 bit RISC ISA developed by DEC + * - Arm (arm, aarch64) + - Yes + - Yes + - Wide range of features, see :ref:`Arm Emulation` for details + * - AVR + - Yes + - No + - 8 bit micro controller, often used in maker projects + * - Cris + - Yes + - Yes + - Embedded RISC chip developed by AXIS + * - Hexagon + - No + - Yes + - Family of DSPs by Qualcomm + * - PA-RISC (hppa) + - Yes + - Yes + - A legacy RISC system used in HP's old minicomputers + * - x86 (i386, x86_64) + - Yes + - Yes + - The ubiquitous desktop PC CPU architecture, 32 and 64 bit. + * - Loongarch + - Yes + - Yes + - A MIPS-like 64bit RISC architecture developed in China + * - m68k + - Yes + - Yes + - Motorola 68000 variants and ColdFire + * - Microblaze + - Yes + - Yes + - RISC based soft-core by Xilinx + * - MIPS (mips, mipsel, mips64, mips64el) + - Yes + - Yes + - Venerable RISC architecture originally out of Stanford University + * - Nios2 + - Yes + - Yes + - 32 bit embedded soft-core by Altera + * - OpenRISC + - Yes + - Yes + - Open source RISC architecture developed by the OpenRISC community + * - Power (ppc, ppc64) + - Yes + - Yes + - A general purpose RISC architecture now managed by IBM + * - RISC-V + - Yes + - Yes + - An open standard RISC ISA maintained by RISC-V International + * - RX + - Yes + - No + - A 32 bit micro controller developed by Renesas + * - s390x + - Yes + - Yes + - A 64 bit CPU found in IBM's System Z mainframes + * - sh4 + - Yes + - Yes + - A 32 bit RISC embedded CPU developed by Hitachi + * - SPARC (sparc, sparc64) + - Yes + - Yes + - A RISC ISA originally developed by Sun Microsystems + * - Tricore + - Yes + - No + - A 32 bit RISC/uController/DSP developed by Infineon + * - Xtensa + - Yes + - Yes + - A configurable 32 bit soft core now owned by Cadence + +A number of features are are only available when running under +emulation including :ref:`Record/Replay<replay>` and :ref:`TCG Plugins`.
docs/about/index.rst +1 -0
@@ -23,6 +23,7 @@ allows you to create, convert and modify disk images. :maxdepth: 2 build-platforms + emulation deprecated removed-features license
docs/devel/tcg-plugins.rst +2 -0
@@ -3,6 +3,8 @@ Copyright (c) 2019, Linaro Limited Written by Emilio Cota and Alex Bennée +.. _TCG Plugins: + QEMU TCG Plugins ================
docs/system/arm/emulation.rst +2 -0
@@ -1,3 +1,5 @@ +.. _Arm Emulation: + A-profile CPU architecture support ==================================
Signature · 1 line
2.34.1
Re: [PATCH v2 20/35] docs: add a new section to outline emulation support
Quoted 24 lines · Alex Bennée
This affects both system and user mode emulation so we should probably list it up front.
Signed-off-by Alex Bennée <[email protected]>---
v2
- HPs -> HP's
- MIPs-like -> MIPS-like--- docs/about/emulation.rst | 103 ++++++++++++++++++++++++++++++++++ docs/about/index.rst | 1 + docs/devel/tcg-plugins.rst | 2 + docs/system/arm/emulation.rst | 2 + 4 files changed, 108 insertions(+)create mode 100644
docs/about/emulation.rstdocs/about/emulation.rst new file +0
-0
docs/about/emulation.rst line 4
Quoted 4 lines
docs/about/emulation.rst new file +4
-0@@ -0,0 +1,103 @@ +Emulation +========= + +QEMU's Tiny Code Generator (TCG) gives it the ability to emulate a
I'd maybe rather say "provides" instead of "gives it".
docs/about/emulation.rst line 5
Quoted 1 line
docs/about/emulation.rst new file +1
-0+number of CPU architectures on any supported platform. Both
I'd maybe add a "host" between "supported" and "platform.
docs/about/emulation.rst line 15
Quoted 10 lines
docs/about/emulation.rst new file +10
-0+:ref:`System Emulation` and :ref:`User Mode Emulation` are supported +depending on the guest architecture. + +.. list-table:: Supported Guest Architectures for Emulation + :widths: 30 10 10 50 + :header-rows: 1 + + * - Architecture (qemu name) + - System + - User-mode
Maybe just use "User" instead of "User-mode" to make the column smaller?
Quoted 25 lines
docs/about/emulation.rst new file +25
-0+ - Notes + * - Alpha + - Yes + - Yes + - Legacy 64 bit RISC ISA developed by DEC + * - Arm (arm, aarch64) + - Yes + - Yes + - Wide range of features, see :ref:`Arm Emulation` for details + * - AVR + - Yes + - No + - 8 bit micro controller, often used in maker projects + * - Cris + - Yes + - Yes + - Embedded RISC chip developed by AXIS + * - Hexagon + - No + - Yes + - Family of DSPs by Qualcomm + * - PA-RISC (hppa) + - Yes + - Yes + - A legacy RISC system used in HP's old minicomputers
docs/about/emulation.rst line 50
Quoted 10 lines
docs/about/emulation.rst new file +10
-0+ * - x86 (i386, x86_64) + - Yes + - Yes + - The ubiquitous desktop PC CPU architecture, 32 and 64 bit. + * - Loongarch + - Yes + - Yes + - A MIPS-like 64bit RISC architecture developed in China + * - m68k + - Yes
Would it be possible to link the "Yes" entries in the "System" column to corresponding target-*.rst files? E.g. docs/system/target-m68k.rst for the m68k entry?
docs/about/emulation.rst line 57
Quoted 7 lines
docs/about/emulation.rst new file +7
-0+ - Yes + - Motorola 68000 variants and ColdFire + * - Microblaze + - Yes + - Yes + - RISC based soft-core by Xilinx + * - MIPS (mips, mipsel, mips64, mips64el)
The table renders very badly for me, the last column is cut off and you need to scroll to see its contents. This seems mainly to happen since this MIPS entry is very long. Could the information in the parentheses maybe be shortened to "(mips*)" or be dropped completely?
Thomas
Re: [PATCH v2 20/35] docs: add a new section to outline emulation support
Quoted 95 lines · Thomas Huth
Quoted 24 lines · Alex Bennée
This affects both system and user mode emulation so we should probably list it up front.
Signed-off-by Alex Bennée <[email protected]>---
v2
- HPs -> HP's
- MIPs-like -> MIPS-like
---
docs/about/emulation.rst | 103 ++++++++++++++++++++++++++++++++++ docs/about/index.rst | 1 + docs/devel/tcg-plugins.rst | 2 +docs/system/arm/emulation.rst| 2 +4 files changed, 108 insertions(+)create mode 100644
docs/about/emulation.rstdocs/about/emulation.rst new file +0
-0docs/about/emulation.rst line 4
Quoted 4 lines
docs/about/emulation.rst new file +4
-0@@ -0,0 +1,103 @@ +Emulation +========= + +QEMU's Tiny Code Generator (TCG) gives it the ability to emulate aI'd maybe rather say "provides" instead of "gives it".
docs/about/emulation.rst line 5
Quoted 1 line
docs/about/emulation.rst new file +1
-0+number of CPU architectures on any supported platform. BothI'd maybe add a "host" between "supported" and "platform.
docs/about/emulation.rst line 15
Quoted 10 lines
docs/about/emulation.rst new file +10
-0+:ref:`System Emulation` and :ref:`User Mode Emulation` are supported +depending on the guest architecture. + +.. list-table:: Supported Guest Architectures for Emulation + :widths: 30 10 10 50 + :header-rows: 1 + + * - Architecture (qemu name) + - System + - User-modeMaybe just use "User" instead of "User-mode" to make the column smaller?
Quoted 25 lines
docs/about/emulation.rst new file +25
-0+ - Notes + * - Alpha + - Yes + - Yes + - Legacy 64 bit RISC ISA developed by DEC + * - Arm (arm, aarch64) + - Yes + - Yes + - Wide range of features, see :ref:`Arm Emulation` for details + * - AVR + - Yes + - No + - 8 bit micro controller, often used in maker projects + * - Cris + - Yes + - Yes + - Embedded RISC chip developed by AXIS + * - Hexagon + - No + - Yes + - Family of DSPs by Qualcomm + * - PA-RISC (hppa) + - Yes + - Yes + - A legacy RISC system used in HP's old minicomputersdocs/about/emulation.rst line 50
Quoted 10 lines
docs/about/emulation.rst new file +10
-0+ * - x86 (i386, x86_64) + - Yes + - Yes + - The ubiquitous desktop PC CPU architecture, 32 and 64 bit. + * - Loongarch + - Yes + - Yes + - A MIPS-like 64bit RISC architecture developed in China + * - m68k + - YesWould it be possible to link the "Yes" entries in the "System" column to corresponding target-*.rst files? E.g.
docs/system/target-m68k.rstfor the m68k entry?docs/about/emulation.rst line 57
Quoted 7 lines
docs/about/emulation.rst new file +7
-0+ - Yes + - Motorola 68000 variants and ColdFire + * - Microblaze + - Yes + - Yes + - RISC based soft-core by Xilinx + * - MIPS (mips, mipsel, mips64, mips64el)
Quoted 1 line
The table renders very badly for me, the last column is cut off and you need to scroll to see its contents. This seems mainly to happen since this MIPS entry is very long. Could the information in the parentheses maybe be shortened to "(mips*)" or be dropped completely?
Or "32 and 64 bit".
PATCH v2 21/35 semihosting: add semihosting section to the docs
In reply to Alex BennéeThe main reason to do this is to document our O_BINARY implementation decision somewhere. However I've also moved some of the implementation details out of qemu-options and added links between the two. As a bonus I've highlighted the scary warnings about host access with the appropriate RST tags.
---
v2
- moved inside the generic emulation section
- make it clearer semihosting is specified by the architecture
- more expansive description for O_BINARY
- s/mips/MIPS/
--- docs/about/emulation.rst | 89 ++++++++++++++++++++++++++++++++++++++++ qemu-options.hx | 27 +++++------- 2 files changed, 99 insertions(+), 17 deletions(-)
docs/about/emulation.rst +89 -0
@@ -101,3 +101,92 @@ depending on the guest architecture. A number of features are are only available when running under emulation including :ref:`Record/Replay<replay>` and :ref:`TCG Plugins`. + +.. _Semihosting: + +Semihosting +----------- + +Semihosting is a feature defined by the owner of the architecture to +allow programs to interact with a debugging host system. On real +hardware this is usually provided by an In-circuit emulator (ICE) +hooked directly to the board. QEMU's implementation allows for +semihosting calls to be passed to the host system or via the +``gdbstub``. + +Generally semihosting makes it easier to bring up low level code before a +more fully functional operating system has been enabled. On QEMU it +also allows for embedded micro-controller code which typically doesn't +have a full libc to be run as "bare-metal" code under QEMU's user-mode +emulation. It is also useful for writing test cases and indeed a +number of compiler suites as well as QEMU itself use semihosting calls +to exit test code while reporting the success state. + +Semihosting is only available using TCG emulation. This is because the +instructions to trigger a semihosting call are typically reserved +causing most hypervisors to trap and fault on them. + +.. warning:: + Semihosting inherently bypasses any isolation there may be between + the guest and the host. As a result a program using semihosting can + happily trash your host system. You should only ever run trusted + code with semihosting enabled. + +Redirection +~~~~~~~~~~~ + +Semihosting calls can be re-directed to a (potentially remote) gdb +during debugging via the :ref:`gdbstub<GDB usage>`. Output to the +semihosting console is configured as a ``chardev`` so can be +redirected to a file, pipe or socket like any other ``chardev`` +device. + +See :ref:`Semihosting Options<Semihosting Options>` for details. + +Supported Targets +~~~~~~~~~~~~~~~~~ + +Most targets offer similar semihosting implementations with some +minor changes to define the appropriate instruction to encode the +semihosting call and which registers hold the parameters. They tend to +presents a simple POSIX-like API which allows your program to read and +write files, access the console and some other basic interactions. + +For full details of the ABI for a particular target, and the set of +calls it provides, you should consult the semihosting specification +for that architecture. + +.. note:: + QEMU makes an implementation decision to implement all file + access in ``O_BINARY`` mode. The user-visible effect of this is + regardless of the text/binary mode the program sets QEMU will + always select a binary mode ensuring no line-terminator conversion + is performed on input or output. This is because gdb semihosting + support doesn't make the distinction between the modes and + magically processing line endings can be confusing. + +.. list-table:: Guest Architectures supporting Semihosting + :widths: 10 10 80 + :header-rows: 1 + + * - Architecture + - Modes + - Specification + * - Arm + - System and User-mode + - https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst + * - m68k + - System + - https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/m68k/m68k-semi.txt;hb=HEAD + * - MIPS + - System + - Unified Hosting Interface (MD01069) + * - Nios II + - System + - https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=libgloss/nios2/nios2-semi.txt;hb=HEAD + * - RISC-V + - System and User-mode + - https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc + * - Xtensa + - System + - Tensilica ISS SIMCALL
qemu-options.hx +10 -17
@@ -4633,10 +4633,13 @@ DEF("semihosting", 0, QEMU_OPTION_semihosting, QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV) SRST ``-semihosting`` - Enable semihosting mode (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only). + Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only). - Note that this allows guest direct access to the host filesystem, so - should only be used with a trusted guest OS. + .. warning:: + Note that this allows guest direct access to the host filesystem, so + should only be used with a trusted guest OS. + + .. _Semihosting Options: See the -semihosting-config option documentation for further information about the facilities this enables.
@@ -4648,22 +4651,12 @@ QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV) SRST ``-semihosting-config [enable=on|off][,target=native|gdb|auto][,chardev=id][,userspace=on|off][,arg=str[,...]]`` - Enable and configure semihosting (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V + Enable and configure :ref:`Semihosting` (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only). - Note that this allows guest direct access to the host filesystem, so - should only be used with a trusted guest OS. - - On Arm this implements the standard semihosting API, version 2.0. - - On M68K this implements the "ColdFire GDB" interface used by - libgloss. - - Xtensa semihosting provides basic file IO calls, such as - open/read/write/seek/select. Tensilica baremetal libc for ISS and - linux platform "sim" use this interface. - - On RISC-V this implements the standard semihosting API, version 0.2. + .. warning:: + Note that this allows guest direct access to the host filesystem, so + should only be used with a trusted guest OS. ``target=native|gdb|auto`` Defines where the semihosting calls will be addressed, to QEMU
Signature · 1 line
2.34.1
PATCH v2 22/35 docs: add an introduction to the system docs
In reply to Alex BennéeDrop the frankly misleading quickstart section for a more rounded introduction section. This new section gives an overview of the accelerators as well as a high level introduction to some of the key features of the emulator. We also expand on a general form for a QEMU command line with a hopefully not too scary worked example of what this looks like.
---
v2
- integrated Kashyap's comments
- used -blockdev for pflash
- remove extra whitespace
- some punctuation fixes from Peter
- make it clearer TCG is the default accelerator
--- docs/interop/live-block-operations.rst | 2 + docs/interop/qemu-qmp-ref.rst | 2 + docs/system/index.rst | 2 +- docs/system/introduction.rst | 220 +++++++++++++++++++++++++ docs/system/multi-process.rst | 2 + docs/system/quickstart.rst | 21 --- qemu-options.hx | 3 + 7 files changed, 230 insertions(+), 22 deletions(-) create mode 100644 docs/system/introduction.rst delete mode 100644 docs/system/quickstart.rst
docs/interop/live-block-operations.rst +2 -0
@@ -4,6 +4,8 @@ This work is licensed under the terms of the GNU GPL, version 2 or later. See the COPYING file in the top-level directory. +.. _Live Block Operations: + ============================ Live Block Device Operations ============================
docs/interop/qemu-qmp-ref.rst +2 -0
@@ -1,3 +1,5 @@ +.. _QMP Ref: + QEMU QMP Reference Manual =========================
docs/system/index.rst +1 -1
@@ -12,7 +12,7 @@ or Hypervisor.Framework. .. toctree:: :maxdepth: 3 - quickstart + introduction invocation device-emulation keys
docs/system/introduction.rst new file +220 -0
220 lines not on this page · raw message
docs/system/multi-process.rst +2 -0
@@ -1,3 +1,5 @@ +.. _Multi-process QEMU: + Multi-process QEMU ==================
docs/system/quickstart.rst deleted +0 -21
@@ -1,21 +0,0 @@ -.. _pcsys_005fquickstart: - -Quick Start ------------ - -Download and uncompress a PC hard disk image with Linux installed (e.g. -``linux.img``) and type: - -.. parsed-literal:: - - |qemu_system| linux.img - -Linux should boot and give you a prompt. - -Users should be aware the above example elides a lot of the complexity -of setting up a VM with x86_64 specific defaults and assumes the -first non switch argument is a PC compatible disk image with a boot -sector. For a non-x86 system where we emulate a broad range of machine -types, the command lines are generally more explicit in defining the -machine and boot behaviour. You will find more example command lines -in the :ref:`system-targets-ref` section of the manual.
qemu-options.hx +3 -0
@@ -20,6 +20,9 @@ DEF("version", 0, QEMU_OPTION_version, SRST ``-version`` Display version information and exit + + .. _Machine Options: + ERST DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
Signature · 1 line
2.34.1
Re: [PATCH v2 22/35] docs: add an introduction to the system docs
Quoted 10 lines · Alex Bennée
Drop the frankly misleading quickstart section for a more rounded introduction section. This new section gives an overview of the accelerators as well as a high level introduction to some of the key features of the emulator. We also expand on a general form for a QEMU command line with a hopefully not too scary worked example of what this looks like.
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Kashyap Chamarthy <[email protected]>
...
docs/system/introduction.rst line 106
Quoted 12 lines
docs/system/introduction.rst new file +12
-0+That said, the general form of a QEMU command line can be expressed +as: + +.. parsed-literal:: + + $ |qemu_system| [machine opts] \\ + [cpu opts] \\ + [accelerator opts] \\ + [device opts] \\ + [backend opts] \\ + [interface opts] \\ + [boot opts]
FYI: My "git am" complains about a trailing white space after "[boot opts]" here. Please remove it.
Thomas
PATCH v2 23/35 semihosting: Write back semihosting data before completion callback
In reply to Alex BennéeFrom: Keith Packard <[email protected]>
'lock_user' allocates a host buffer to shadow a target buffer, 'unlock_user' copies that host buffer back to the target and frees the host memory. If the completion function uses the target buffer, it must be called after unlock_user to ensure the data are present.
This caused the arm-compatible TARGET_SYS_READC to fail as the completion function, common_semi_readc_cb, pulled data from the target buffer which would not have been gotten the console data.
I decided to fix all instances of this pattern instead of just the console_read function to make things consistent and potentially fix bugs in other cases.
Message-Id: <[email protected]>
--- semihosting/syscalls.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
semihosting/syscalls.c +10 -10
@@ -319,11 +319,11 @@ static void host_read(CPUState *cs, gdb_syscall_complete_cb complete, } ret =RETRY_ON_EINTR (read (gf->hostfd, ptr, len));if (ret ==-1 ) { -complete (cs,-1 , errno);unlock_user (ptr, buf,0 ); +complete (cs,-1 , errno); }else { -complete (cs, ret,0 );unlock_user (ptr, buf, ret); +complete (cs, ret,0 ); } }
@@ -339,8 +339,8 @@ static void host_write(CPUState *cs, gdb_syscall_complete_cb complete,return ; } ret =write (gf->hostfd, ptr, len); -complete (cs, ret, ret ==-1 ? errno :0 );unlock_user (ptr, buf,0 ); +complete (cs, ret, ret ==-1 ? errno :0 ); } static void host_lseek(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -426,8 +426,8 @@ static void host_stat(CPUState *cs, gdb_syscall_complete_cb complete, ret =-1 ; } } -complete (cs, ret, err);unlock_user (name, fname,0 ); +complete (cs, ret, err); } static void host_remove(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -444,8 +444,8 @@ static void host_remove(CPUState *cs, gdb_syscall_complete_cb complete, } ret =remove (p); -complete (cs, ret, ret ? errno :0 );unlock_user (p, fname,0 ); +complete (cs, ret, ret ? errno :0 ); } static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -469,9 +469,9 @@ static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete, } ret =rename (ostr, nstr); -complete (cs, ret, ret ? errno :0 );unlock_user (ostr, oname,0 );unlock_user (nstr, nname,0 ); +complete (cs, ret, ret ? errno :0 ); } static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -488,8 +488,8 @@ static void host_system(CPUState *cs, gdb_syscall_complete_cb complete, } ret =system (p); -complete (cs, ret, ret ==-1 ? errno :0 );unlock_user (p, cmd,0 ); +complete (cs, ret, ret ==-1 ? errno :0 ); } static void host_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -554,8 +554,8 @@ static void staticfile_read(CPUState *cs, gdb_syscall_complete_cb complete, }memcpy (ptr, gf->staticfile.data + gf->staticfile.off, len); gf->staticfile.off += len; -complete (cs, len,0 );unlock_user (ptr, buf, len); +complete (cs, len,0 ); } static void staticfile_lseek(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -608,8 +608,8 @@ static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,return ; } ret =qemu_semihosting_console_read (cs, ptr, len); -complete (cs, ret,0 );unlock_user (ptr, buf, ret); +complete (cs, ret,0 ); } static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,
@@ -624,8 +624,8 @@ static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,return ; } ret =qemu_semihosting_console_write (ptr, len); -complete (cs, ret ? ret :-1 , ret ?0 :EIO );unlock_user (ptr, buf,0 ); +complete (cs, ret ? ret :-1 , ret ?0 :EIO ); } static void console_fstat(CPUState *cs, gdb_syscall_complete_cb complete,
Signature · 1 line
2.34.1
Re: [PATCH v2 23/35] semihosting: Write back semihosting data before completion callback
Quoted 15 lines · Alex Bennée
From: Keith Packard <[email protected]>
'
lock_user' allocates a host buffer to shadow a target buffer, 'unlock_user' copies that host buffer back to the target and frees the host memory. If the completion function uses the target buffer, it must be called afterunlock_userto ensure the data are present.This caused the arm-compatible
TARGET_SYS_READCto fail as the completion function,common_semi_readc_cb, pulled data from the target buffer which would not have been gotten the console data.I decided to fix all instances of this pattern instead of just the
console_readfunction to make things consistent and potentially fix bugs in other cases.
Quoted 7 lines
Signed-off-by Keith Packard <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-Id: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- semihosting/syscalls.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
PATCH v2 24/35 semihosting: add O_BINARY flag in host_open for NT compatibility
In reply to Alex BennéeFrom: Evgeny Iakovlev <[email protected]>
Windows open(2) implementation opens files in text mode by default and needs a Windows-only O_BINARY flag to open files as binary. QEMU already knows about that flag in osdep and it is defined to 0 on non-Windows, so we can just add it to the host_flags for better compatibility.
Message-Id: <[email protected]>
--- semihosting/syscalls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
semihosting/syscalls.c +4 -4
@@ -253,7 +253,7 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete, { CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;char *p; -int ret, host_flags; +int ret, host_flags =O_BINARY ; ret =validate_lock_user_string (&p, cs, fname, fname_len);if (ret <0 ) {
@@ -262,11 +262,11 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete, }if (gdb_flags &GDB_O_WRONLY ) { - host_flags =O_WRONLY ; + host_flags |=O_WRONLY ; }else if (gdb_flags &GDB_O_RDWR ) { - host_flags =O_RDWR ; + host_flags |=O_RDWR ; }else { - host_flags =O_RDONLY ; + host_flags |=O_RDONLY ; }if (gdb_flags &GDB_O_CREAT ) { host_flags |=O_CREAT ;
Signature · 1 line
2.34.1
PATCH v2 25/35 tests/tcg: add memory-sve test for aarch64
In reply to Alex BennéeThis will be helpful in debugging problems with tracking SVE memory accesses via the TCG plugins system.
--- tests/tcg/aarch64/Makefile.softmmu-target | 7 +++++++ tests/tcg/aarch64/system/boot.S | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-)
tests/tcg/aarch64/Makefile.softmmu-target +7 -0
@@ -36,6 +36,13 @@ config-cc.mak: Makefile memory: CFLAGS+=-DCHECK_UNALIGNED=1 +memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +memory-sve: CFLAGS+=-DCHECK_UNALIGNED=1 -march=armv8.1-a+sve -O3 -fno-tree-loop-distribute-patterns + +TESTS+=memory-sve + # Running QEMU_BASE_MACHINE=-M virt -cpu max -display none QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
tests/tcg/aarch64/system/boot.S +2 -1
@@ -179,12 +179,13 @@ __start: isb /* - * Enable FP registers. The standard C pre-amble will be + * Enable FP/SVE registers. The standard C pre-amble will be * saving these and A-profile compilers will use AdvSIMD * registers unless we tell it not to. */ mrs x0, cpacr_el1 orr x0, x0, #(3 << 20) + orr x0, x0, #(3 << 16) msr cpacr_el1, x0 /* Setup some stack space and enter the test code.
Signature · 1 line
2.34.1
PATCH v2 26/35 cpu: free cpu->tb_jmp_cache with RCU
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
Fixes the appended use-after-free. The root cause is that during tb invalidation we use CPU_FOREACH, and therefore to safely free a vCPU we must wait for an RCU grace period to elapse.
$ x86_64-linux-user/qemu-x86_64 tests/tcg/x86_64-linux-user/munmap-pthread
=================================================================
==1800604==ERROR: AddressSanitizer: heap-use-after-free on address 0x62d0005f7418 at pc 0x5593da6704eb bp 0x7f4961a7ac70 sp 0x7f4961a7ac60
READ of size 8 at 0x62d0005f7418 thread T2
#0 0x5593da6704ea in tb_jmp_cache_inval_tb ../accel/tcg/tb-maint.c:244
#1 0x5593da6704ea in do_tb_phys_invalidate ../accel/tcg/tb-maint.c:290
#2 0x5593da670631 in tb_phys_invalidate__locked ../accel/tcg/tb-maint.c:306
#3 0x5593da670631 in tb_invalidate_phys_page_range__locked ../accel/tcg/tb-maint.c:542
#4 0x5593da67106d in tb_invalidate_phys_range ../accel/tcg/tb-maint.c:614
#5 0x5593da6a64d4 in target_munmap ../linux-user/mmap.c:766
#6 0x5593da6dba05 in do_syscall1 ../linux-user/syscall.c:10105
#7 0x5593da6f564c in do_syscall ../linux-user/syscall.c:13329
#8 0x5593da49e80c in cpu_loop ../linux-user/x86_64/../i386/cpu_loop.c:233
#9 0x5593da6be28c in clone_func ../linux-user/syscall.c:6633
#10 0x7f496231cb42 in start_thread nptl/pthread_create.c:442
#11 0x7f49623ae9ff (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)0x62d0005f7418 is located 28696 bytes inside of 32768-byte region [0x62d0005f0400,0x62d0005f8400) freed by thread T148 here:
#0 0x7f49627b6460 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:52
#1 0x5593da5ac057 in cpu_exec_unrealizefn ../cpu.c:180
#2 0x5593da81f851 (/home/cota/src/qemu/build/qemu-x86_64+0x484851)Message-Id: <[email protected]>
--- accel/tcg/tb-jmp-cache.h | 1 + accel/tcg/cpu-exec.c | 3 +-- cpu.c | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-)
accel/tcg/tb-jmp-cache.h +1 -0
@@ -18,6 +18,7 @@* a load_acquire/store_release to 'tb'. */ struct CPUJumpCache { +struct rcu_head rcu;struct {TranslationBlock *tb;#if TARGET_TB_PCREL
accel/tcg/cpu-exec.c +1 -2
@@ -1064,13 +1064,12 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)/* undo the initializations in reverse order */ void tcg_exec_unrealizefn (CPUState *cpu) { -qemu_plugin_vcpu_exit_hook (cpu);#ifndef CONFIG_USER_ONLY tcg_iommu_free_notifier_list (cpu);#endif /* !CONFIG_USER_ONLY */ tlb_destroy (cpu); -g_free (cpu->tb_jmp_cache); +g_free_rcu (cpu->tb_jmp_cache, rcu); }#ifndef CONFIG_USER_ONLY
cpu.c +10 -1
@@ -176,11 +176,20 @@ void cpu_exec_unrealizefn(CPUState *cpu) vmstate_unregister(NULL, &vmstate_cpu_common, cpu); }#endif + +/* Call the plugin hook before clearing cpu->cpu_index in cpu_list_remove */ if (tcg_enabled ()) { -tcg_exec_unrealizefn (cpu); +qemu_plugin_vcpu_exit_hook (cpu); }cpu_list_remove (cpu); +/* +* Now that the vCPU has been removed from the RCU list, we can call +* tcg_exec_unrealizefn, which may free fields using call_rcu. +*/ +if (tcg_enabled ()) { +tcg_exec_unrealizefn (cpu); + } }/*
Signature · 1 line
2.34.1
PATCH v2 27/35 util/qht: add missing atomic_set(hashes[i])
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
We forgot to add this one in "a890643958 util/qht: atomically set b->hashes".
Detected with tsan.
Message-Id: <[email protected]>
--- util/qht.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/qht.c +1 -1
@@ -688,7 +688,7 @@ static inline void qht_bucket_remove_entry(struct qht_bucket *orig, int pos)int i;if (qht_entry_is_last (orig, pos)) { - orig->hashes[pos] =0 ; +qatomic_set (&orig->hashes[pos],0 );qatomic_set (&orig->pointers[pos],NULL );return ; }
Signature · 1 line
2.34.1
PATCH v2 28/35 thread: de-const qemu_spin_destroy
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
Message-Id: <[email protected]>
--- include/qemu/thread.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/qemu/thread.h +2 -3
@@ -237,11 +237,10 @@ static inline void qemu_spin_init(QemuSpin *spin)#endif } -/* const parameter because the only purpose here is the TSAN annotation */ -static inline void qemu_spin_destroy (const QemuSpin *spin) +static inline void qemu_spin_destroy (QemuSpin *spin) {#ifdef CONFIG_TSAN -__tsan_mutex_destroy ((void *)spin, __tsan_mutex_not_static); +__tsan_mutex_destroy (spin, __tsan_mutex_not_static);#endif }
Signature · 1 line
2.34.1
PATCH v2 29/35 util/qht: use striped locks under TSAN
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
Fixes this tsan crash, easy to reproduce with any large enough program:
$ tests/unit/test-qht
1..2
ThreadSanitizer: CHECK failed: sanitizer_deadlock_detector.h:67 "((n_all_locks_)) < (((sizeof(all_locks_with_contexts_)/sizeof((all_locks_with_contexts_)[0]))))" (0x40, 0x40) (tid=1821568)
#0 __tsan::CheckUnwind() ../../../../src/libsanitizer/tsan/tsan_rtl.cpp:353 (libtsan.so.2+0x90034)
#1 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:86 (libtsan.so.2+0xca555)
#2 __sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::addLock(unsigned long, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:67 (libtsan.so.2+0xb3616)
#3 __sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::addLock(unsigned long, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:59 (libtsan.so.2+0xb3616)
#4 __sanitizer::DeadlockDetector<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::onLockAfter(__sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >*, unsigned long, unsigned int) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector.h:216 (libtsan.so.2+0xb3616)
#5 __sanitizer::DD::MutexAfterLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool, bool) ../../../../src/libsanitizer/sanitizer_common/sanitizer_deadlock_detector1.cpp:169 (libtsan.so.2+0xb3616)
#6 __tsan::MutexPostLock(__tsan::ThreadState*, unsigned long, unsigned long, unsigned int, int) ../../../../src/libsanitizer/tsan/tsan_rtl_mutex.cpp:200 (libtsan.so.2+0xa3382)
#7 __tsan_mutex_post_lock ../../../../src/libsanitizer/tsan/tsan_interface_ann.cpp:384 (libtsan.so.2+0x76bc3)
#8 qemu_spin_lock /home/cota/src/qemu/include/qemu/thread.h:259 (test-qht+0x44a97)
#9 qht_map_lock_buckets ../util/qht.c:253 (test-qht+0x44a97)
#10 do_qht_iter ../util/qht.c:809 (test-qht+0x45f33)
#11 qht_iter ../util/qht.c:821 (test-qht+0x45f33)
#12 iter_check ../tests/unit/test-qht.c:121 (test-qht+0xe473)
#13 qht_do_test ../tests/unit/test-qht.c:202 (test-qht+0xe473)
#14 qht_test ../tests/unit/test-qht.c:240 (test-qht+0xe7c1)
#15 test_default ../tests/unit/test-qht.c:246 (test-qht+0xe828)
#16 <null> <null> (libglib-2.0.so.0+0x7daed)
#17 <null> <null> (libglib-2.0.so.0+0x7d80a)
#18 <null> <null> (libglib-2.0.so.0+0x7d80a)
#19 g_test_run_suite <null> (libglib-2.0.so.0+0x7dfe9)
#20 g_test_run <null> (libglib-2.0.so.0+0x7e055)
#21 main ../tests/unit/test-qht.c:259 (test-qht+0xd2c6)
#22 __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 (libc.so.6+0x29d8f)
#23 __libc_start_main_impl ../csu/libc-start.c:392 (libc.so.6+0x29e3f)
#24 _start <null> (test-qht+0xdb44)Message-Id: <[email protected]>
--- util/qht.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 14 deletions(-)
util/qht.c +81 -14
@@ -151,6 +151,22 @@ struct qht_bucket {QEMU_BUILD_BUG_ON (sizeof (struct qht_bucket ) >QHT_BUCKET_ALIGN ); +/* +* Under TSAN, we use striped locks instead of one lock per bucket chain. +* This avoids crashing under TSAN, since TSAN aborts the program if more than +* 64 locks are held (this is a hardcoded limit in TSAN). +* When resizing a QHT we grab all the buckets' locks, which can easily +* go over TSAN's limit. By using striped locks, we avoid this problem. +* +* Note: this number must be a power of two for easy index computation. +*/ +#define QHT_TSAN_BUCKET_LOCKS_BITS 4 +#define QHT_TSAN_BUCKET_LOCKS (1 << QHT_TSAN_BUCKET_LOCKS_BITS) + +struct qht_tsan_lock { +QemuSpin lock; +}QEMU_ALIGNED (QHT_BUCKET_ALIGN ); +/** * struct qht_map - structure to track an array of buckets * @rcu: used by RCU. Keep it as the top field in the struct to help valgrind
@@ -160,6 +176,7 @@ QEMU_BUILD_BUG_ON(sizeof(struct qht_bucket) > QHT_BUCKET_ALIGN);* @n_added_buckets: number of added (i.e. "non-head") buckets * @n_added_buckets_threshold: threshold to trigger an upward resize once the * number of added buckets surpasses it. +* @tsan_bucket_locks: Array of striped locks to be used only under TSAN. * * Buckets are tracked in what we call a "map", i.e. this structure. */
@@ -169,6 +186,9 @@ struct qht_map {size_t n_buckets;size_t n_added_buckets;size_t n_added_buckets_threshold; +#ifdef CONFIG_TSAN +struct qht_tsan_lock tsan_bucket_locks[QHT_TSAN_BUCKET_LOCKS ]; +#endif };/* trigger a resize when n_added_buckets > n_buckets / div */
@@ -229,10 +249,56 @@ static inline size_t qht_elems_to_buckets(size_t n_elems)return pow2ceil (n_elems /QHT_BUCKET_ENTRIES ); } -static inline void qht_head_init (struct qht_bucket *b) +/* +* When using striped locks (i.e. under TSAN), we have to be careful not +* to operate on the same lock twice (e.g. when iterating through all buckets). +* We achieve this by operating only on each stripe's first matching lock. +*/ +static inline void qht_do_if_first_in_stripe (struct qht_map *map, +struct qht_bucket *b, +void (*func)(QemuSpin *spin)) +{ +#ifdef CONFIG_TSAN +unsigned long bucket_idx = b - map->buckets; +bool is_first_in_stripe = (bucket_idx >>QHT_TSAN_BUCKET_LOCKS_BITS ) ==0 ; +if (is_first_in_stripe) { +unsigned long lock_idx = bucket_idx & (QHT_TSAN_BUCKET_LOCKS -1 ); +func (&map->tsan_bucket_locks[lock_idx].lock); + } +#else +func (&b->lock); +#endif +} + +static inline void qht_bucket_lock_do (struct qht_map *map, +struct qht_bucket *b, +void (*func)(QemuSpin *lock)) +{ +#ifdef CONFIG_TSAN +unsigned long bucket_idx = b - map->buckets; +unsigned long lock_idx = bucket_idx & (QHT_TSAN_BUCKET_LOCKS -1 ); +func (&map->tsan_bucket_locks[lock_idx].lock); +#else +func (&b->lock); +#endif +} + +static inline void qht_bucket_lock (struct qht_map *map, +struct qht_bucket *b) +{ +qht_bucket_lock_do (map, b, qemu_spin_lock); +} + +static inline void qht_bucket_unlock (struct qht_map *map, +struct qht_bucket *b) +{ +qht_bucket_lock_do (map, b, qemu_spin_unlock); +} + +static inline void qht_head_init (struct qht_map *map,struct qht_bucket *b) {memset (b,0 ,sizeof (*b)); -qemu_spin_init (&b->lock); +qht_do_if_first_in_stripe (map, b, qemu_spin_init);seqlock_init (&b->sequence); }
@@ -250,7 +316,7 @@ static void qht_map_lock_buckets(struct qht_map *map)for (i =0 ; i < map->n_buckets; i++) {struct qht_bucket *b = &map->buckets[i]; -qemu_spin_lock (&b->lock); +qht_do_if_first_in_stripe (map, b, qemu_spin_lock); } }
@@ -261,7 +327,7 @@ static void qht_map_unlock_buckets(struct qht_map *map)for (i =0 ; i < map->n_buckets; i++) {struct qht_bucket *b = &map->buckets[i]; -qemu_spin_unlock (&b->lock); +qht_do_if_first_in_stripe (map, b, qemu_spin_unlock); } }
@@ -308,7 +374,7 @@ void qht_map_lock_buckets__no_stale(struct qht *ht, struct qht_map **pmap)* Get a head bucket and lock it, making sure its parent map is not stale. * @pmap is filled with a pointer to the bucket's parent map. * -* Unlock with qemu_spin_unlock(&b->lock). +* Unlock with qht_bucket_unlock. * * Note: callers cannot have ht->lock held. */
@@ -322,18 +388,18 @@ struct qht_bucket *qht_bucket_lock__no_stale(struct qht *ht, uint32_t hash, map =qatomic_rcu_read (&ht->map); b =qht_map_to_bucket (map, hash); -qemu_spin_lock (&b->lock); +qht_bucket_lock (map, b);if (likely (!qht_map_is_stale__locked (ht, map))) { *pmap = map;return b; } -qemu_spin_unlock (&b->lock); +qht_bucket_unlock (map, b);/* we raced with a resize; acquire ht->lock to see the updated ht->map */ qht_lock (ht); map = ht->map; b =qht_map_to_bucket (map, hash); -qemu_spin_lock (&b->lock); +qht_bucket_lock (map, b);qht_unlock (ht); *pmap = map;return b;
@@ -345,12 +411,13 @@ static inline bool qht_map_needs_resize(const struct qht_map *map) map->n_added_buckets_threshold; } -static inline void qht_chain_destroy (const struct qht_bucket *head) +static inline void qht_chain_destroy (struct qht_map *map, +struct qht_bucket *head) {struct qht_bucket *curr = head->next;struct qht_bucket *prev; -qemu_spin_destroy (&head->lock); +qht_do_if_first_in_stripe (map, head, qemu_spin_destroy);while (curr) { prev = curr; curr = curr->next;
@@ -364,7 +431,7 @@ static void qht_map_destroy(struct qht_map *map)size_t i;for (i =0 ; i < map->n_buckets; i++) { -qht_chain_destroy (&map->buckets[i]); +qht_chain_destroy (map, &map->buckets[i]); }qemu_vfree (map->buckets);g_free (map);
@@ -390,7 +457,7 @@ static struct qht_map *qht_map_create(size_t n_buckets) map->buckets =qemu_memalign (QHT_BUCKET_ALIGN ,sizeof (*map->buckets) * n_buckets);for (i =0 ; i < n_buckets; i++) { -qht_head_init (&map->buckets[i]); +qht_head_init (map, &map->buckets[i]); }return map; }
@@ -638,7 +705,7 @@ bool qht_insert(struct qht *ht, void *p, uint32_t hash, void **existing) b =qht_bucket_lock__no_stale (ht, hash, &map); prev =qht_insert__locked (ht, map, b, p, hash, &needs_resize);qht_bucket_debug__locked (b); -qemu_spin_unlock (&b->lock); +qht_bucket_unlock (map, b);if (unlikely (needs_resize) && ht->mode &QHT_MODE_AUTO_RESIZE ) {qht_grow_maybe (ht);
@@ -749,7 +816,7 @@ bool qht_remove(struct qht *ht, const void *p, uint32_t hash) b =qht_bucket_lock__no_stale (ht, hash, &map); ret =qht_remove__locked (b, p, hash);qht_bucket_debug__locked (b); -qemu_spin_unlock (&b->lock); +qht_bucket_unlock (map, b);return ret; }
Signature · 1 line
2.34.1
PATCH v2 30/35 plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
To fix potential deadlocks as reported by tsan.
Message-Id: <[email protected]>
--- plugins/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
plugins/core.c +11 -5
@@ -500,10 +500,17 @@ void qemu_plugin_user_exit(void)enum qemu_plugin_event ev;CPUState *cpu; -QEMU_LOCK_GUARD (&plugin.lock); - +/* +* Locking order: we must acquire locks in an order that is consistent +* with the one in fork_start(). That is: +* - start_exclusive(), which acquires qemu_cpu_list_lock, +* must be called before acquiring plugin.lock. +* - tb_flush(), which acquires mmap_lock(), must be called +* while plugin.lock is not held. +*/ start_exclusive (); +qemu_rec_mutex_lock (&plugin.lock);/* un-register all callbacks except the final AT_EXIT one */ for (ev =0 ; ev <QEMU_PLUGIN_EV_MAX ; ev++) {if (ev !=QEMU_PLUGIN_EV_ATEXIT ) {
@@ -513,13 +520,12 @@ void qemu_plugin_user_exit(void) } } } - -tb_flush (current_cpu); -CPU_FOREACH (cpu) {qemu_plugin_disable_mem_helpers (cpu); } +qemu_rec_mutex_unlock (&plugin.lock); +tb_flush (current_cpu);end_exclusive ();/* now it's safe to handle the exit case */
Signature · 1 line
2.34.1
PATCH v2 31/35 plugins: fix optimization in plugin_gen_disable_mem_helpers
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
We were mistakenly checking tcg_ctx->plugin_insn as a canary to know whether the TB had emitted helpers that might have accessed memory.
The problem is that tcg_ctx->plugin_insn gets updated on every instruction in the TB, which results in us wrongly performing the optimization (i.e. not clearing cpu->plugin_mem_cbs) way too often, since it's not rare that the last instruction in the TB doesn't use helpers.
Fix it by tracking a per-TB canary.
While at it, expand documentation.
Related: #1381
Message-Id: <[email protected]>
--- include/qemu/plugin.h | 7 +++++++ accel/tcg/plugin-gen.c | 26 ++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-)
include/qemu/plugin.h +7 -0
@@ -118,7 +118,10 @@ struct qemu_plugin_insn {void *haddr;GArray *cbs[PLUGIN_N_CB_TYPES ][PLUGIN_N_CB_SUBTYPES ];bool calls_helpers; + +/* if set, the instruction calls helpers that might access guest memory */ bool mem_helper; +bool mem_only; };
@@ -158,6 +161,10 @@ struct qemu_plugin_tb {void *haddr1;void *haddr2;bool mem_only; + +/* if set, the TB calls helpers that might access guest memory */ +bool mem_helper; +GArray *cbs[PLUGIN_N_CB_SUBTYPES ]; };
accel/tcg/plugin-gen.c +18 -8
@@ -579,7 +579,8 @@ static void inject_mem_helper(TCGOp *begin_op, GArray *arr)* is possible that the code we generate after the instruction is * dead, we also add checks before generating tb_exit etc. */ -static void inject_mem_enable_helper (struct qemu_plugin_insn *plugin_insn, +static void inject_mem_enable_helper (struct qemu_plugin_tb *ptb, +struct qemu_plugin_insn *plugin_insn,TCGOp *begin_op) {GArray *cbs[2 ];
@@ -599,6 +600,7 @@ static void inject_mem_enable_helper(struct qemu_plugin_insn *plugin_insn,rm_ops (begin_op);return ; } + ptb->mem_helper = true; arr =g_array_sized_new (false, false,sizeof (struct qemu_plugin_dyn_cb ), n_cbs);
@@ -626,15 +628,22 @@ void plugin_gen_disable_mem_helpers(void) {TCGv_ptr ptr; -if (likely (tcg_ctx->plugin_insn ==NULL || - !tcg_ctx->plugin_insn->mem_helper)) { +/* +* We could emit the clearing unconditionally and be done. However, this can +* be wasteful if for instance plugins don't track memory accesses, or if +* most TBs don't use helpers. Instead, emit the clearing iff the TB calls +* helpers that might access guest memory. +* +* Note: we do not reset plugin_tb->mem_helper here; a TB might have several +* exit points, and we want to emit the clearing from all of them. +*/ +if (!tcg_ctx->plugin_tb->mem_helper) {return ; } ptr =tcg_const_ptr (NULL );tcg_gen_st_ptr (ptr, cpu_env, offsetof(CPUState , plugin_mem_cbs) - offsetof(ArchCPU , env));tcg_temp_free_ptr (ptr); - tcg_ctx->plugin_insn->mem_helper = false; } static void plugin_gen_tb_udata(const struct qemu_plugin_tb *ptb,
@@ -682,14 +691,14 @@ static void plugin_gen_mem_inline(const struct qemu_plugin_tb *ptb,inject_inline_cb (cbs, begin_op, op_rw); } -static void plugin_gen_enable_mem_helper (const struct qemu_plugin_tb *ptb, +static void plugin_gen_enable_mem_helper (struct qemu_plugin_tb *ptb,TCGOp *begin_op,int insn_idx) {struct qemu_plugin_insn *insn =g_ptr_array_index (ptb->insns, insn_idx); -inject_mem_enable_helper (insn, begin_op); +inject_mem_enable_helper (ptb, insn, begin_op); } -static void plugin_gen_disable_mem_helper (const struct qemu_plugin_tb *ptb, +static void plugin_gen_disable_mem_helper (struct qemu_plugin_tb *ptb,TCGOp *begin_op,int insn_idx) {struct qemu_plugin_insn *insn =g_ptr_array_index (ptb->insns, insn_idx);
@@ -750,7 +759,7 @@ static void pr_ops(void)#endif } -static void plugin_gen_inject (const struct qemu_plugin_tb *plugin_tb) +static void plugin_gen_inject (struct qemu_plugin_tb *plugin_tb) {TCGOp *op;int insn_idx =-1 ;
@@ -870,6 +879,7 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, ptb->haddr1 = db->host_addr[0 ]; ptb->haddr2 =NULL ; ptb->mem_only = mem_only; + ptb->mem_helper = false;plugin_gen_empty_callback (PLUGIN_GEN_FROM_TB ); }
Signature · 1 line
2.34.1
PATCH v2 32/35 translator: always pair plugin_gen_insn_{start, end} calls
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
Related: #1381
Message-Id: <[email protected]>
--- accel/tcg/translator.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
accel/tcg/translator.c +10 -5
@@ -100,19 +100,24 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int max_insns, ops->translate_insn (db, cpu); } -/* Stop translation if translate_insn so indicated. */ -if (db->is_jmp !=DISAS_NEXT ) { -break ; - } -/* * We can't instrument after instructions that change control * flow although this only really affects post-load operations. +* +* Calling plugin_gen_insn_end() before we possibly stop translation +* is important. Even if this ends up as dead code, plugin generation +* needs to see a matching plugin_gen_insn_{start,end}() pair in order +* to accurately track instrumented helpers that might access memory. */ if (plugin_enabled) {plugin_gen_insn_end (); } +/* Stop translation if translate_insn so indicated. */ +if (db->is_jmp !=DISAS_NEXT ) { +break ; + } +/* Stop translation if the output buffer is full, or we have executed all of the allowed instructions. */ if (tcg_op_buf_full () || db->num_insns >= db->max_insns) {
Signature · 1 line
2.34.1
PATCH v2 33/35 tcg: exclude non-memory effecting helpers from instrumentation
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
There are actually a whole bunch of helpers that don't affect memory that we shouldn't instrument. They are helpfully identified by the TCG_CALL_NO_SIDE_EFFECTS flag which marks out lookup_tb_ptr as well as a lot of the maths helpers. To avoid the string compare we introduce a new flag for plugin internals so we skip that too.
Related: #1381
Message-Id: <[email protected]>
---
v2
- use TCG_CALL_NO_SIDE_EFFECTS as suggested by rth
- add flag for plugin specific helpers
--- accel/tcg/plugin-helpers.h | 4 ++-- include/tcg/tcg.h | 2 ++ tcg/tcg.c | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-)
accel/tcg/plugin-helpers.h +2 -2
@@ -1,4 +1,4 @@#ifdef CONFIG_PLUGIN -DEF_HELPER_FLAGS_2(plugin_vcpu_udata_cb, TCG_CALL_NO_RWG, void, i32, ptr) -DEF_HELPER_FLAGS_4(plugin_vcpu_mem_cb, TCG_CALL_NO_RWG, void, i32, i32, i64, ptr) +DEF_HELPER_FLAGS_2(plugin_vcpu_udata_cb, TCG_CALL_NO_RWG | TCG_CALL_PLUGIN, void, i32, ptr) +DEF_HELPER_FLAGS_4(plugin_vcpu_mem_cb, TCG_CALL_NO_RWG | TCG_CALL_PLUGIN, void, i32, i32, i64, ptr)#endif
include/tcg/tcg.h +2 -0
@@ -405,6 +405,8 @@ typedef TCGv_ptr TCGv_env;#define TCG_CALL_NO_SIDE_EFFECTS 0x0004/* Helper is G_NORETURN. */ #define TCG_CALL_NO_RETURN 0x0008 +/* Helper is part of Plugins. */ +#define TCG_CALL_PLUGIN 0x0010/* convenience version of most used call flags */ #define TCG_CALL_NO_RWG TCG_CALL_NO_READ_GLOBALS
tcg/tcg.c +4 -2
@@ -1674,8 +1674,10 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) op =tcg_op_alloc (INDEX_op_call, total_args);#ifdef CONFIG_PLUGIN -/* detect non-plugin helpers */ -if (tcg_ctx->plugin_insn &&unlikely (strncmp (info->name,"plugin_" ,7 ))) { +/* Flag helpers that may affect guest state */ +if (tcg_ctx->plugin_insn && + !(info->flags &TCG_CALL_PLUGIN ) && + !(info->flags &TCG_CALL_NO_SIDE_EFFECTS )) { tcg_ctx->plugin_insn->calls_helpers = true; }#endif
Signature · 1 line
2.34.1
Re: [PATCH v2 33/35] tcg: exclude non-memory effecting helpers from instrumentation
Quoted 18 lines · Alex Bennée
From: Emilio Cota<[email protected]>
There are actually a whole bunch of helpers that don't affect memory that we shouldn't instrument. They are helpfully identified by the
TCG_CALL_NO_SIDE_EFFECTSflag which marks outlookup_tb_ptras well as a lot of the maths helpers. To avoid the string compare we introduce a new flag for plugin internals so we skip that too.Related: #1381
Signed-off-by Emilio Cota<[email protected]>Message-Id:<[email protected]>
[AJB: updated to skip all no SE plugins, add flag for plugin helper]Signed-off-by Alex Bennée<[email protected]>---
v2
- useTCG_CALL_NO_SIDE_EFFECTSas suggested by rth
- add flag for plugin specific helpers
Quoted 5 lines
--- accel/tcg/plugin-helpers.h | 4 ++-- include/tcg/tcg.h | 2 ++ tcg/tcg.c | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-)
r~
PATCH v2 34/35 cpu-exec: assert that plugin_mem_cbs is NULL after execution
In reply to Alex BennéeFrom: Emilio Cota <[email protected]>
Message-Id: <[email protected]>
--- include/qemu/plugin.h | 4 ++++ accel/tcg/cpu-exec.c | 2 ++ 2 files changed, 6 insertions(+)
include/qemu/plugin.h +4 -0
@@ -59,6 +59,8 @@ get_plugin_meminfo_rw(qemu_plugin_meminfo_t i)#ifdef CONFIG_PLUGIN extern QemuOptsList qemu_plugin_opts; +#define QEMU_PLUGIN_ASSERT (cond) g_assert(cond) +static inline void qemu_plugin_add_opts (void ) {qemu_add_opts (&qemu_plugin_opts);
@@ -250,6 +252,8 @@ void qemu_plugin_user_postfork(bool is_child);#else /* !CONFIG_PLUGIN */ +#define QEMU_PLUGIN_ASSERT (cond) +static inline void qemu_plugin_add_opts (void ) { }
accel/tcg/cpu-exec.c +2 -0
@@ -504,6 +504,7 @@ static void cpu_exec_exit(CPUState *cpu)if (cc->tcg_ops->cpu_exec_exit) { cc->tcg_ops->cpu_exec_exit (cpu); } +QEMU_PLUGIN_ASSERT (cpu->plugin_mem_cbs ==NULL ); }void cpu_exec_step_atomic (CPUState *cpu)
@@ -980,6 +981,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)cpu_loop_exec_tb (cpu, tb, pc, &last_tb, &tb_exit); +QEMU_PLUGIN_ASSERT (cpu->plugin_mem_cbs ==NULL );/* Try to align the host and virtual clocks if the guest is in advance */ align_clocks (sc, cpu);
Signature · 1 line
2.34.1
Re: [PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution
Quoted 4 lines · Alex Bennée
From: Emilio Cota<[email protected]>
Fixes #1381
Quoted 8 lines
Signed-off-by Emilio Cota<[email protected]>Message-Id:<[email protected]>
[AJB: manually applied follow-up fix]Signed-off-by Alex Bennée<[email protected]>--- include/qemu/plugin.h | 4 ++++ accel/tcg/cpu-exec.c | 2 ++ 2 files changed, 6 insertions(+)
r~
Re: [PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution
In reply to Alex BennéeQuoted 4 lines · Alex Bennée
From: Emilio Cota <[email protected]>
Fixes #1381
Quoted 8 lines
Signed-off-by Emilio Cota <[email protected]>Message-Id: <[email protected]>
[AJB: manually applied follow-up fix]Signed-off-by Alex Bennée <[email protected]>--- include/qemu/plugin.h | 4 ++++ accel/tcg/cpu-exec.c | 2 ++ 2 files changed, 6 insertions(+)
PATCH v2 35/35 plugins: Iterate on cb_lists in qemu_plugin_user_exit
In reply to Alex BennéeFrom: Richard Henderson <[email protected]>
Rather than iterate over all plugins for all events, iterate over plugins that have registered a given event.
Message-Id: <[email protected]>
--- plugins/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
plugins/core.c +4 -3
@@ -514,9 +514,10 @@ void qemu_plugin_user_exit(void)/* un-register all callbacks except the final AT_EXIT one */ for (ev =0 ; ev <QEMU_PLUGIN_EV_MAX ; ev++) {if (ev !=QEMU_PLUGIN_EV_ATEXIT ) { -struct qemu_plugin_ctx *ctx; - QTAILQ_FOREACH(ctx, &plugin.ctxs, entry) { -plugin_unregister_cb__locked (ctx, ev); +struct qemu_plugin_cb *cb, *next; + + QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { +plugin_unregister_cb__locked (cb->ctx, ev); } } }
Signature · 1 line
2.34.1
Re: [PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit
Quoted 7 lines · Alex Bennée
From: Richard Henderson <[email protected]>
Rather than iterate over all plugins for all events, iterate over plugins that have registered a given event.
Signed-off-by Richard Henderson <[email protected]>Message-Id: <[email protected]>
(Missing Alex's S-o-b)
Quoted 3 lines
--- plugins/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)