testing/next: various updates (MacOS, docker, gitlab) - pre-PR
v3 cover testing/next: various updates (MacOS, docker, gitlab) - pre-PR
These patches are mostly dealing with the loss of the CirrusCI MacOS images by porting to gitlab. I've had to fight a bit with the build system to deal with the way MacOS has signed and unsigned versions of QEMU. In the end I couldn't get the dependencies to work for check-tcg so I've just called the check-tcg test runners directly.
There is also a fix for getting watchpoints working so we can have the basic TCG gdb tests.
I've also included Phil's docker series which is already reviewed.
The following still need review:
accel/tcg: move jit thread manipulation into do_tb_phys_invalidate
I plan on rolling the PR tomorrow.
Alex.
Alex Bennée (9):
Makefile: include tests/Makefile.include before ninja calculation tests/Makefile.include: fix typo in comment tests/Makefile.include: add binary dependency to run-tcg-tests-% rules accel/tcg: move jit thread manipulation into do_tb_phys_invalidate
ci: drop cirrus MacOS build
gitlab: add initial MacOS 15 on gitlab runner
gitlab: add MacOS 26 job on gitlab runner
gitlab: update issue template for binary test cases
MAINTAINERS: add a section for AI agents
Philippe Mathieu-Daudé (5):
MAINTAINERS: Fix docker/dockerfiles/debian-hexagon-cross.docker path
MAINTAINERS: Cover debian-loongarch-cross.docker with LoongArch
section
MAINTAINERS: Cover debian-xtensa-cross.docker with Xtensa section
MAINTAINERS: Cover debian-tricore-cross.docker with TriCore section
MAINTAINERS: Cover python.docker with Python library section
MAINTAINERS | 12 ++++-
Makefile | 4 +-
accel/tcg/tb-maint.c | 43 ++++++++---------
tests/lcitool/refresh | 12 ++++-
.gitlab-ci.d/cirrus.yml | 14 ------
.gitlab-ci.d/{cirrus => }/macos-14.vars | 0
.gitlab-ci.d/macos.yml | 63 +++++++++++++++++++++++++
.gitlab-ci.d/qemu-project.yml | 1 +
.gitlab/issue_templates/bug.md | 4 ++
tests/Makefile.include | 8 +++-
10 files changed, 118 insertions(+), 43 deletions(-)
rename .gitlab-ci.d/{cirrus => }/macos-14.vars (100%)
create mode 100644 .gitlab-ci.d/macos.ymlSignature · 1 line
2.47.3
PATCH v3 1/14 Makefile: include tests/Makefile.include before ninja calculation
As the tests Makefile sets .ninja-goals we need it to be included before we do the calculations in the main Makefile.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -45,6 +45,8 @@ include config-host.mak include Makefile.prereqs Makefile.prereqs: config-host.mak +include $(SRC_PATH)/tests/Makefile.include + # 0. ensure the build tree is okay # Check that we're not trying to do an out-of-tree build from
@@ -180,8 +182,6 @@ endif # config-host.mak does not exist SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) -include $(SRC_PATH)/tests/Makefile.include - all: recurse-all SUBDIR_RULES=$(foreach t, all clean distclean, $(addsuffix /$(t), $(SUBDIRS)))
Signature · 1 line
2.47.3
PATCH v3 2/14 tests/Makefile.include: fix typo in comment
In reply to Alex Bennée--- tests/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile.include +1 -1
@@ -42,7 +42,7 @@ SPEED = quick # TCG_TESTS_WITH_COMPILERS represents the test targets we have cross compiler -# support for, CONFIGURED_TEST_TARGETS it what meson has finally +# support for, CONFIGURED_TCG_TARGETS it what meson has finally # configured having rejected stuff we can't build. CONFIGURED_TCG_TARGETS=$(patsubst %-config-target.h, %, $(wildcard *-config-target.h))
Signature · 1 line
2.47.3
PATCH v3 3/14 tests/Makefile.include: add binary dependency to run-tcg-tests-% rules
In reply to Alex BennéeExplicitly set the appropriate QEMU binary as a dependency so we can ensure they get built. This is especially important for MacOS which otherwise only builds the unsigned binaries on a normal "make all" run.
--- tests/Makefile.include | 6 ++++++ 1 file changed, 6 insertions(+)
tests/Makefile.include +6 -0
@@ -58,6 +58,12 @@ RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS)) $(foreach TARGET,$(TCG_TESTS_TARGETS), \ $(eval $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak: config-host.mak)) +# $1 = the stem (e.g., arm-softmmu or x86_64-linux-user) +get-qemu-bin = $(if $(findstring softmmu,$1),qemu-system-$(subst -softmmu,,$1),qemu-$(subst -linux-user,,$1)) + +$(foreach TARGET,$(TCG_TESTS_TARGETS), \ + $(eval .ninja-goals.run-tcg-tests-$(TARGET) += $(call get-qemu-bin,$(TARGET)))) + .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%) $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak $(call quiet-command, \
Signature · 1 line
2.47.3
PATCH v3 4/14 accel/tcg: move jit thread manipulation into do_tb_phys_invalidate
In reply to Alex BennéeTo invalidate a TB on MacOS we need to enable write access to the JIT buffer. We were doing this for tb_phys_invalidate__locked but that is not the only path into do_tb_phys_invalidate. Move the manipulation into the shared function that does the work.
As a result we can drop the tb_phys_invalidate__locked function and update the calls directly.
This enables watchpoints to work in MacOS TCG guests.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3444
---
v2
- make everyone call do_tb_phys_invalidate
- tweak the if statement so we don't miss unlocking on an early return
--- accel/tcg/tb-maint.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
accel/tcg/tb-maint.c +19 -24
@@ -925,6 +925,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)uint32_t orig_cflags =tb_cflags (tb);assert_memory_lock (); +qemu_thread_jit_write ();/* make sure no further incoming jumps will be chained to this TB */ qemu_spin_lock (&tb->jmp_lock);
@@ -935,33 +936,27 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) phys_pc =tb_page_addr0 (tb); h =tb_hash_func (phys_pc, (orig_cflags &CF_PCREL ?0 : tb->pc), tb->flags, tb->cs_base, orig_cflags); -if (!qht_remove (&tb_ctx.htable, tb, h)) { -return ; - } +if (qht_remove (&tb_ctx.htable, tb, h)) { -/* remove the TB from the page list */ -if (rm_from_page_list) { -tb_remove (tb); - } +/* remove the TB from the page list */ +if (rm_from_page_list) { +tb_remove (tb); + } -/* remove the TB from the hash list */ -tb_jmp_cache_inval_tb (tb); +/* remove the TB from the hash list */ +tb_jmp_cache_inval_tb (tb); -/* suppress this TB from the two jump lists */ -tb_remove_from_jmp_list (tb,0 ); -tb_remove_from_jmp_list (tb,1 ); +/* suppress this TB from the two jump lists */ +tb_remove_from_jmp_list (tb,0 ); +tb_remove_from_jmp_list (tb,1 ); -/* suppress any remaining jumps to this TB */ -tb_jmp_unlink (tb); +/* suppress any remaining jumps to this TB */ +tb_jmp_unlink (tb); -qatomic_set (&tb_ctx.tb_phys_invalidate_count, - tb_ctx.tb_phys_invalidate_count +1 ); -} +qatomic_set (&tb_ctx.tb_phys_invalidate_count, + tb_ctx.tb_phys_invalidate_count +1 ); + } -static void tb_phys_invalidate__locked (TranslationBlock *tb) -{ -qemu_thread_jit_write (); -do_tb_phys_invalidate (tb, true);qemu_thread_jit_execute (); }
@@ -1030,7 +1025,7 @@ void tb_invalidate_phys_range(CPUState *cpu, tb_page_addr_t start,assert_memory_lock (); PAGE_FOR_EACH_TB(start, last, unused, tb, n) { -tb_phys_invalidate__locked (tb); +do_tb_phys_invalidate (tb, true); } }
@@ -1091,7 +1086,7 @@ bool tb_invalidate_phys_page_unwind(CPUState *cpu, tb_page_addr_t addr, current_tb_modified = true;cpu_restore_state_from_tb (cpu, current_tb, pc); } -tb_phys_invalidate__locked (tb); +do_tb_phys_invalidate (tb, true); }if (current_tb_modified) {
@@ -1156,7 +1151,7 @@ tb_invalidate_phys_page_range__locked(CPUState *cpu, current_tb_modified = true;cpu_restore_state_from_tb (cpu, current_tb, retaddr); } -tb_phys_invalidate__locked (tb); +do_tb_phys_invalidate (tb, true); } }
Signature · 1 line
2.47.3
Re: [PATCH v3 04/14] accel/tcg: move jit thread manipulation into do_tb_phys_invalidate
Quoted 13 lines · Alex Bennée
To invalidate a TB on MacOS we need to enable write access to the JIT buffer. We were doing this for
tb_phys_invalidate__lockedbut that is not the only path intodo_tb_phys_invalidate. Move the manipulation into the shared function that does the work.As a result we can drop the
tb_phys_invalidate__lockedfunction and update the calls directly.This enables watchpoints to work in MacOS TCG guests.
Resolves:https://gitlab.com/qemu-project/qemu/-/work_items/3444
Signed-off-by Alex Bennée<[email protected]>
Quoted 7 lines
---
v2
- make everyone calldo_tb_phys_invalidate
- tweak the if statement so we don't miss unlocking on an early return--- accel/tcg/tb-maint.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-)
r~
PATCH v3 5/14 ci: drop cirrus MacOS build
In reply to Alex BennéeCirrusCI is closing down soon so time to migrate.
--- tests/lcitool/refresh | 1 - .gitlab-ci.d/cirrus.yml | 14 -------------- .gitlab-ci.d/cirrus/macos-14.vars | 16 ---------------- 3 files changed, 31 deletions(-) delete mode 100644 .gitlab-ci.d/cirrus/macos-14.vars
tests/lcitool/refresh +0 -1
@@ -301,7 +301,6 @@ try: # Cirrus packages lists for GitLab # generate_cirrus("freebsd-14") - generate_cirrus("macos-14") # # VM packages lists
.gitlab-ci.d/cirrus.yml +0 -14
@@ -44,17 +44,3 @@ x64-freebsd-14-build: INSTALL_COMMAND: pkg install -y CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,mips64el-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4eb-softmmu,xtensa-softmmu --enable-rust TEST_TARGETS: check - -aarch64-macos-build: - extends: .cirrus_build_job - variables: - NAME: macos-14 - CIRRUS_VM_INSTANCE_TYPE: macos_instance - CIRRUS_VM_IMAGE_SELECTOR: image - CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-runner:sonoma - UPDATE_COMMAND: brew update - INSTALL_COMMAND: brew install - PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin - PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig - CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,mips64-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4-softmmu,xtensaeb-softmmu --enable-rust - TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
.gitlab-ci.d/cirrus/macos-14.vars deleted +0 -16
@@ -1,16 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool variables macos-14 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -CCACHE='/opt/homebrew/bin/ccache' -CPAN_PKGS='' -CROSS_PKGS='' -MAKE='/opt/homebrew/bin/gmake' -NINJA='/opt/homebrew/bin/ninja' -PACKAGING_COMMAND='brew' -PIP3='/opt/homebrew/bin/pip3' -PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd' -PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli' -PYTHON='/opt/homebrew/bin/python3'
Signature · 1 line
2.47.3
PATCH v3 6/14 gitlab: add initial MacOS 15 on gitlab runner
In reply to Alex BennéeThe gitlab runners are currently in beta but available to projects on the Premium and Ultimate plans (which QEMU is via the Open Source program).
We install some compilers via brew so we can run some of the check-tcg softmmu test cases.
We disable rust as the version is too old.
We disable plugins because we haven't taught the test harness about .dynlib vs .so yet.
There is a discrepancy between the vars and version of MacOS because lcitool needs teaching about other versions (although I don't think it matters as brew is shared across versions).
---
v2
- call tcg run directly to work around makefile issues
- drop debug lines
--- tests/lcitool/refresh | 11 ++++++++ .gitlab-ci.d/macos-14.vars | 16 ++++++++++++ .gitlab-ci.d/macos.yml | 47 +++++++++++++++++++++++++++++++++++ .gitlab-ci.d/qemu-project.yml | 1 + 4 files changed, 75 insertions(+) create mode 100644 .gitlab-ci.d/macos-14.vars create mode 100644 .gitlab-ci.d/macos.yml
tests/lcitool/refresh +11 -0
@@ -87,6 +87,12 @@ def generate_cirrus(target, trailer=None): generate(filename, cmd, trailer) +def generate_vars(target, trailer=None): + filename = Path(src_dir, ".gitlab-ci.d", target + ".vars") + cmd = lcitool_cmd + ["variables", "--format", "shell", target, "qemu"] + generate(filename, cmd, trailer) + + def generate_pkglist(vm, target, project="qemu"): filename = Path(src_dir, "tests", "vm", "generated", vm + ".json") cmd = lcitool_cmd + ["variables", "--format", "json", target, project]
@@ -302,6 +308,11 @@ try: # generate_cirrus("freebsd-14") + # + # GitLab packages lists + # + generate_vars("macos-14") + # # VM packages lists #
.gitlab-ci.d/macos-14.vars new file +16 -0
@@ -0,0 +1,16 @@ +# THIS FILE WAS AUTO-GENERATED +# +# $ lcitool variables macos-14 qemu +# +# https://gitlab.com/libvirt/libvirt-ci + +CCACHE='/opt/homebrew/bin/ccache' +CPAN_PKGS='' +CROSS_PKGS='' +MAKE='/opt/homebrew/bin/gmake' +NINJA='/opt/homebrew/bin/ninja' +PACKAGING_COMMAND='brew' +PIP3='/opt/homebrew/bin/pip3' +PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd' +PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli' +PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/macos.yml new file +47 -0
47 lines not on this page · raw message
.gitlab-ci.d/qemu-project.yml +1 -0
@@ -19,3 +19,4 @@ include: - local: '/.gitlab-ci.d/custom-runners.yml' - local: '/.gitlab-ci.d/cirrus.yml' - local: '/.gitlab-ci.d/windows.yml' + - local: '/.gitlab-ci.d/macos.yml'
Signature · 1 line
2.47.3
PATCH v3 7/14 gitlab: add MacOS 26 job on gitlab runner
In reply to Alex Bennéegitlab supports 3 MacOS images with 15 and 26 being the current supported ones. To get ahead of the curve lets enable 26 as well.
It re-uses the same brew list but also attempts to work around python configure failure by setting DYLD_LIBRARY_PATH:/opt/homebrew/opt/expat/lib/
---
v2
- call runners directly, seems to be working now
- drop debug lines
--- .gitlab-ci.d/macos.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
.gitlab-ci.d/macos.yml +16 -0
@@ -45,3 +45,19 @@ aarch64-macos-15-build: --cross-prefix-x86_64=x86_64-elf- --disable-plugins TEST_TARGETS: check-unit run-tcg-tests-aarch64-softmmu run-tcg-tests-i386-softmmu run-tcg-tests-x86_64-softmmu + +aarch64-macos-26-build: + extends: .macos_job_template + image: macos-26-xcode-26 + variables: + NAME: macos-26 + DYLD_LIBRARY_PATH: /opt/homebrew/opt/expat/lib/ + PATH_EXTRA: /opt/homebrew/gettext/bin + PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig + CONFIGURE_ARGS: + --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu + --cross-prefix-aarch64=aarch64-elf- + --cross-prefix-i386=i686-elf- + --cross-prefix-x86_64=x86_64-elf- + --disable-plugins + TEST_TARGETS: check-unit run-tcg-tests-aarch64-softmmu run-tcg-tests-i386-softmmu run-tcg-tests-x86_64-softmmu
Signature · 1 line
2.47.3
PATCH v3 8/14 gitlab: update issue template for binary test cases
In reply to Alex BennéeBinary test cases are sketchy because they can be vectors for phishing and other malware. Lets strongly hint that source bases tests are preferred and binaries should have their provenance declared.
Message-ID: <[email protected]>
--- .gitlab/issue_templates/bug.md | 4 ++++ 1 file changed, 4 insertions(+)
.gitlab/issue_templates/bug.md +4 -0
@@ -55,6 +55,10 @@ https://www.qemu.org/contribute/security-process/ <!-- Attach logs, stack traces, screenshots, etc. Compress the files if necessary. If using libvirt, libvirt logs and XML domain information may be relevant. + +If attaching binary test cases you should describe where they were obtained +from, preferably linking to the original source. We greatly prefer test cases in +the form of source code that can be audited before compiling by the engineer. --> <!--
Signature · 1 line
2.47.3
PATCH v3 9/14 MAINTAINERS: add a section for AI agents
In reply to Alex BennéeFor completeness add a section to MAINTAINERS to catch changes should we decide to merge this.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -4564,6 +4564,12 @@ M: Pierrick Bouvier <[email protected]> S: Maintained F: docs/ +AI agents +M: Alex Bennée <[email protected]> +S: Maintained +F: .agents/skills/ +F: AGENTS.md + Build System ------------ Meson
Signature · 1 line
2.47.3
PATCH v3 10/14 MAINTAINERS: Fix docker/dockerfiles/debian-hexagon-cross.docker path
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
@@ -257,7 +257,7 @@ F: linux-user/hexagon/ F: tests/tcg/hexagon/ F: disas/hexagon.c F: configs/targets/hexagon-linux-user/default.mak -F: docker/dockerfiles/debian-hexagon-cross.docker +F: tests/docker/dockerfiles/debian-hexagon-cross.docker F: gdbstub/gdb-xml/hexagon*.xml T: git https://github.com/quic/qemu.git hex-next
Signature · 1 line
2.47.3
PATCH v3 11/14 MAINTAINERS: Cover debian-loongarch-cross.docker with LoongArch section
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -280,6 +280,7 @@ LoongArch TCG CPUs M: Song Gao <[email protected]> S: Maintained F: target/loongarch/ +F: tests/docker/dockerfiles/debian-loongarch-cross.docker F: tests/tcg/loongarch64/ F: tests/functional/loongarch64/meson.build F: tests/functional/loongarch64/test_virt.py
Signature · 1 line
2.47.3
PATCH v3 12/14 MAINTAINERS: Cover debian-xtensa-cross.docker with Xtensa section
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -445,6 +445,7 @@ W: http://wiki.osll.ru/doku.php?id=etc:users:jcmvbkbc:qemu-target-xtensa S: Maintained F: target/xtensa/ F: hw/xtensa/ +F: tests/docker/dockerfiles/debian-xtensa-cross.docker F: tests/functional/xtensa/meson.build F: tests/tcg/xtensa/ F: tests/tcg/xtensaeb/
Signature · 1 line
2.47.3
PATCH v3 13/14 MAINTAINERS: Cover debian-tricore-cross.docker with TriCore section
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -458,6 +458,7 @@ S: Orphan F: target/tricore/ F: hw/tricore/ F: include/hw/tricore/ +F: tests/docker/dockerfiles/debian-tricore-cross.docker F: tests/tcg/tricore/ Multiarch Linux User Tests
Signature · 1 line
2.47.3
PATCH v3 14/14 MAINTAINERS: Cover python.docker with Python library section
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -3479,6 +3479,7 @@ M: John Snow <[email protected]> M: Cleber Rosa <[email protected]> S: Maintained F: python/ +F: tests/docker/dockerfiles/python.docker T: git https://gitlab.com/jsnow/qemu.git python Python scripts
Signature · 1 line
2.47.3