Skip to contentSkip to conversation

documentation an testing updates

GIT PULL Applied Alex Bennée 5 participants 28 messages Jul 27, 2025 – Aug 13, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

The following changes since commit c017386f28c03a03b8f14444f8671d3d8f7180fe:

Merge tag 'pull-target-arm-20250725' of https://gitlab.com/pm215/qemu into staging (2025-07-25 08:24:52 -0400)

are available in the Git repository at:

https://gitlab.com/stsquad/qemu.git tags/pull-10.1-rc1-maintainer-260725-1

for you to fetch changes up to cac08383f06dc378afb23913d65a95442bbd5516:

tests/functional: expose sys.argv to unittest.main (2025-07-26 23:04:35 +0100)

----------------------------------------------------------------
documentation and test cleanups

- improve clarity of user-mode docs
- remove reference to TAP tarball
- add new hypervisor test for aarch64 EL2
- reduce combinatorial explosion of plugin tests
- make docker-all-test-cross more friendly to non-x86 hosts
- expose unittests to sysv.args for embedded help

----------------------------------------------------------------
Alex Bennée (14):
docs/user: clarify user-mode expects the same OS docs/system: reword the TAP notes to remove tarball ref docs/user: clean up headings
docs/user: slightly reword section on system calls docs/user: expand section on threading tests/functional: add hypervisor test for aarch64 tests/tcg: skip libsyscall.so on softmmu tests tests/tcg: remove ADDITIONAL_PLUGINS_TESTS tests/tcg: don't include multiarch tests if not supported
configure: expose PYTHON to test/tcg/config-host.mak tests/tcg: reduce the number of plugin tests combinations tests/docker: add --arch-only to qemu deps for all-test-cross tests/docker: handle host-arch selection for all-test-cross tests/functional: expose sys.argv to unittest.main

 docs/system/devices/net.rst                        | 16 +++--
 docs/user/index.rst                                |  5 +-
 docs/user/main.rst                                 | 60 +++++++++++-------
 configure                                          |  1 +
 .../dockerfiles/debian-all-test-cross.docker       | 34 ++++++-----
 tests/functional/meson.build                       |  1 +
 tests/functional/qemu_test/testcase.py             |  2 +-
 tests/functional/test_aarch64_kvm.py               | 71 ++++++++++++++++++++++
 tests/tcg/Makefile.target                          | 36 ++++++++---
 tests/tcg/multiarch/Makefile.target                |  8 ++-
 tests/tcg/multiarch/system/Makefile.softmmu-target | 16 +++--
 11 files changed, 192 insertions(+), 58 deletions(-)
 create mode 100755 tests/functional/test_aarch64_kvm.py
Signature · 1 line
2.47.2
#1 lore raw

[PULL 08/14] tests/tcg: remove ADDITIONAL_PLUGINS_TESTS

We never actually used this is the end. Remove it to enable re-factoring.

Fixes 7cefff22d54 (tests/tcg: add mechanism to run specific tests with plugins)

Message-ID: <[email protected]>

tests/tcg/Makefile.target +1 -2
index 3d96182a7b9..97ebe8f9bc9 100644
@@ -169,11 +169,10 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
 # only expand MULTIARCH_TESTS which are common on most of our targets
 # to avoid an exponential explosion as new tests are added. We also
 # add some special helpers the run-plugin- rules can use below.
-# In more, extra tests can be added using ADDITIONAL_PLUGINS_TESTS variable.
 
 ifneq ($(MULTIARCH_TESTS),)
 $(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS) $(ADDITIONAL_PLUGINS_TESTS),\
+	$(foreach t,$(MULTIARCH_TESTS),\
 		$(eval run-plugin-$(t)-with-$(p): $t $p) \
 		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
 endif # MULTIARCH_TESTS
Signature · 1 line
2.47.2
#2 lore raw

[PULL 01/14] docs/user: clarify user-mode expects the same OS

In reply to Alex Bennée

While we somewhat cover this later when we talk about supported operating systems make it clear in the front matter.

Message-ID: <[email protected]>

docs/user/index.rst +3 -2
index 782d27cda27..2307580cb97 100644
@@ -5,8 +5,9 @@ User Mode Emulation
 -------------------
 
 This section of the manual is the overall guide for users using QEMU
-for user-mode emulation.  In this mode, QEMU can launch
-processes compiled for one CPU on another CPU.
+for user-mode emulation. In this mode, QEMU can launch programs
+compiled for one CPU architecture on the same Operating System (OS)
+but running on a different CPU architecture.
 
 .. toctree::
    :maxdepth: 2
Signature · 1 line
2.47.2
#3 lore raw

[PULL 03/14] docs/user: clean up headings

In reply to Alex Bennée

This was a slightly duff format for rst, make it use proper headings.

Message-ID: <[email protected]>

docs/user/main.rst +28 -22
index 9a1c60448c5..b8ff203c212 100644
@@ -17,28 +17,34 @@ Features
 
 QEMU user space emulation has the following notable features:
 
-**System call translation:**
-   QEMU includes a generic system call translator. This means that the
-   parameters of the system calls can be converted to fix endianness and
-   32/64-bit mismatches between hosts and targets. IOCTLs can be
-   converted too.
-
-**POSIX signal handling:**
-   QEMU can redirect to the running program all signals coming from the
-   host (such as ``SIGALRM``), as well as synthesize signals from
-   virtual CPU exceptions (for example ``SIGFPE`` when the program
-   executes a division by zero).
-
-   QEMU relies on the host kernel to emulate most signal system calls,
-   for example to emulate the signal mask. On Linux, QEMU supports both
-   normal and real-time signals.
-
-**Threading:**
-   On Linux, QEMU can emulate the ``clone`` syscall and create a real
-   host thread (with a separate virtual CPU) for each emulated thread.
-   Note that not all targets currently emulate atomic operations
-   correctly. x86 and Arm use a global lock in order to preserve their
-   semantics.
+System call translation
+~~~~~~~~~~~~~~~~~~~~~~~
+
+QEMU includes a generic system call translator. This means that the
+parameters of the system calls can be converted to fix endianness
+and 32/64-bit mismatches between hosts and targets. IOCTLs can be
+converted too.
+
+POSIX signal handling
+~~~~~~~~~~~~~~~~~~~~~
+
+QEMU can redirect to the running program all signals coming from the
+host (such as ``SIGALRM``), as well as synthesize signals from
+virtual CPU exceptions (for example ``SIGFPE`` when the program
+executes a division by zero).
+
+QEMU relies on the host kernel to emulate most signal system calls,
+for example to emulate the signal mask. On Linux, QEMU supports both
+normal and real-time signals.
+
+Threading
+~~~~~~~~~
+
+On Linux, QEMU can emulate the ``clone`` syscall and create a real
+host thread (with a separate virtual CPU) for each emulated thread.
+Note that not all targets currently emulate atomic operations
+correctly. x86 and Arm use a global lock in order to preserve their
+semantics.
 
 QEMU was conceived so that ultimately it can emulate itself. Although it
 is not very useful, it is an important test to show the power of the
Signature · 1 line
2.47.2
#4 lore raw

[PULL 06/14] tests/functional: add hypervisor test for aarch64

In reply to Alex Bennée

This is a simple test case that runs an image with kvmtool and kvm-unit-tests which can validate virtualisation works. This is useful for exercising TCG but can also be applied to any nested virt setup which is why it doesn't specify an accelerator.

Message-ID: <[email protected]>

tests/functional/meson.build +1 -0
index 8bebcd4d94e..ecf965adc6c 100644
@@ -89,6 +89,7 @@ tests_aarch64_system_thorough = [
   'aarch64_device_passthrough',
   'aarch64_hotplug_pci',
   'aarch64_imx8mp_evk',
+  'aarch64_kvm',
   'aarch64_raspi3',
   'aarch64_raspi4',
   'aarch64_replay',
tests/functional/test_aarch64_kvm.py new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
2.47.2
#5 lore raw

Re: [PULL 06/14] tests/functional: add hypervisor test for aarch64

Hi Alex,

Quoted 10 lines · Alex Bennée

This is a simple test case that runs an image with kvmtool and kvm-unit-tests which can validate virtualisation works. This is useful for exercising TCG but can also be applied to any nested virt setup which is why it doesn't specify an accelerator.

Message-ID: <[email protected]>

You merged v1, not v2, was that deliberate?
https://lore.kernel.org/qemu-devel/[email protected]/

#6 lore raw

Re: [PULL 06/14] tests/functional: add hypervisor test for aarch64

Quoted 13 lines · Philippe Mathieu-Daudé

Hi Alex,

Quoted 9 lines · Alex Bennée

This is a simple test case that runs an image with kvmtool and kvm-unit-tests which can validate virtualisation works. This is useful for exercising TCG but can also be applied to any nested virt setup which is why it doesn't specify an accelerator.

Message-ID: <[email protected]>

Quoted 2 lines

You merged v1, not v2, was that deliberate?
https://lore.kernel.org/qemu-devel/[email protected]/

I merged my v2 from [email protected] which addressed the same review comments.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#7 lore raw

[PULL 05/14] docs/user: expand section on threading

In reply to Alex Bennée

Potentially too many weasel words when describing atomic and memory order issues.

Message-ID: <[email protected]>

docs/user/main.rst +9 -3
index 05de904225c..347bdfabf8c 100644
@@ -46,9 +46,15 @@ Threading
 
 On Linux, QEMU can emulate the ``clone`` syscall and create a real
 host thread (with a separate virtual CPU) for each emulated thread.
-Note that not all targets currently emulate atomic operations
-correctly. x86 and Arm use a global lock in order to preserve their
-semantics.
+However as QEMU relies on the system libc to call ``clone`` on its
+behalf we limit the flags accepted to those it uses. Specifically this
+means flags affecting namespaces (e.g. container runtimes) are not
+supported. QEMU user-mode processes can still be run inside containers
+though.
+
+While QEMU does its best to emulate atomic operations properly
+differences between the host and guest memory models can cause issues
+for software that makes assumptions about the memory model.
 
 QEMU was conceived so that ultimately it can emulate itself. Although it
 is not very useful, it is an important test to show the power of the
Signature · 1 line
2.47.2
#8 lore raw

[PULL 14/14] tests/functional: expose sys.argv to unittest.main

In reply to Alex Bennée

With this we can call the supported we can take advantage of the argument the module supports:

  env PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional ./pyvenv/bin/python /home/alex/lsrc/qemu.git/tests/functional/test_aarch64_kvm.py --help
  usage: test_aarch64_kvm.py [-h] [-v] [-q] [--locals] [--durations N] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [tests ...]

positional arguments:
tests a list of any number of test modules, classes and test methods.

options:

    -h, --help           show this help message and exit
    -v, --verbose        Verbose output
    -q, --quiet          Quiet output
    --locals             Show local variables in tracebacks
    --durations N        Show the N slowest test cases (N=0 for all)
    -f, --failfast       Stop on first fail or error
    -c, --catch          Catch Ctrl-C and display results so far
    -b, --buffer         Buffer stdout and stderr during tests
    -k TESTNAMEPATTERNS  Only run tests which match the given substring

Examples:

    test_aarch64_kvm.py test_module               - run tests from test_module
    test_aarch64_kvm.py module.TestClass          - run tests from module.TestClass
    test_aarch64_kvm.py module.Class.test_method  - run specified test method
    test_aarch64_kvm.py path/to/test_file.py      - run tests from test_file.py

usage: test_aarch64_kvm.py discover [-h] [-v] [-q] [--locals] [--durations N] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [-s START] [-p PATTERN] [-t TOP]

options:

    -h, --help            show this help message and exit
    -v, --verbose         Verbose output
    -q, --quiet           Quiet output
    --locals              Show local variables in tracebacks
    --durations N         Show the N slowest test cases (N=0 for all)
    -f, --failfast        Stop on first fail or error
    -c, --catch           Catch Ctrl-C and display results so far
    -b, --buffer          Buffer stdout and stderr during tests
    -k TESTNAMEPATTERNS   Only run tests which match the given substring

-s, --start-directory START
Directory to start discovery ('.' default)
-p, --pattern PATTERN
Pattern to match tests ('test*.py' default)
-t, --top-level-directory TOP
Top level directory of project (defaults to start directory)

For test discovery all test modules must be importable from the top level directory of the project.

Message-ID: <[email protected]>

tests/functional/qemu_test/testcase.py +1 -1
index 2a78e735f16..5caf7b13fe3 100644
@@ -249,7 +249,7 @@ def main():
         tr = pycotap.TAPTestRunner(message_log = pycotap.LogMode.LogToError,
                                    test_output_log = pycotap.LogMode.LogToError)
         res = unittest.main(module = None, testRunner = tr, exit = False,
-                            argv=["__dummy__", path])
+                            argv=[sys.argv[0], path] + sys.argv[1:])
         for (test, message) in res.result.errors + res.result.failures:
 
             if hasattr(test, "log_filename"):
Signature · 1 line
2.47.2
#9 lore raw

[PULL 07/14] tests/tcg: skip libsyscall.so on softmmu tests

In reply to Alex Bennée

It isn't testing anything and just expanding the runtime of testing.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +6 -0
index af68f11664f..3d96182a7b9 100644
@@ -155,6 +155,12 @@ VPATH+=$(PLUGIN_LIB)
 # For example, libpatch.so only needs to run against the arch-specific patch
 # target test, so we explicitly run it in the arch-specific Makefile.
 DISABLE_PLUGINS=libpatch.so
+
+# Likewise don't bother with the syscall plugin for softmmu
+ifneq ($(filter %-softmmu, $(TARGET)),)
+DISABLE_PLUGINS += libsyscall.so
+endif
+
 PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
 	$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c))))
 
Signature · 1 line
2.47.2
#10 lore raw

[PULL 10/14] configure: expose PYTHON to test/tcg/config-host.mak

In reply to Alex Bennée

This will be useful for making $shell calls to something more flexible than the shell builtins.

Message-ID: <[email protected]>

configure +1 -0
index 95f67c1a827..825057ebf15 100755
@@ -1800,6 +1800,7 @@ echo "SRC_PATH=$source_path" >> tests/tcg/$config_host_mak
 if test "$plugins" = "yes" ; then
     echo "CONFIG_PLUGIN=y" >> tests/tcg/$config_host_mak
 fi
+echo "PYTHON=$python" >> tests/tcg/$config_host_mak
 
 tcg_tests_targets=
 for target in $target_list; do
Signature · 1 line
2.47.2
#11 lore raw

[PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

In reply to Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
 # We need to ensure expand the run-plugin-TEST-with-PLUGIN
 # pre-requistes manually here as we can't use stems to handle it. We
 # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
 
 ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS),\
-		$(eval run-plugin-$(t)-with-$(p): $t $p) \
-		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
 endif # MULTIARCH_TESTS
 endif # CONFIG_PLUGIN
 
tests/tcg/multiarch/Makefile.target +6 -2
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
 TESTS += semihosting semiconsole
 endif
 
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
 # Test plugin memory access instrumentation
 run-plugin-test-plugin-mem-access-with-libmem.so: \
 	PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
 	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
 	$(QEMU) $<
 
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
 
 # Update TESTS
 TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +7 -4
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
 MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
 	run-gdbstub-untimely-packet run-gdbstub-registers
 
+ifeq ($(CONFIG_PLUGIN),y)
 # Test plugin memory access instrumentation
-run-plugin-memory-with-libmem.so: 		\
-	PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so: 		\
-	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif
Signature · 1 line
2.47.2
#12 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Hi Alex,

Quoted 86 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
  # We need to ensure expand the run-plugin-TEST-with-PLUGIN
  # pre-requistes manually here as we can't use stems to handle it. We
  # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
 
  ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS),\
-		$(eval run-plugin-$(t)-with-$(p): $t $p) \
-		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
  endif # MULTIARCH_TESTS
  endif # CONFIG_PLUGIN
 
tests/tcg/multiarch/Makefile.target +6 -2
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
  TESTS += semihosting semiconsole
  endif
 
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
  # Test plugin memory access instrumentation
  run-plugin-test-plugin-mem-access-with-libmem.so: \
  	PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
  	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
  	$(QEMU) $<
 
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
 
  # Update TESTS
  TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +1 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
  MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
  	run-gdbstub-untimely-packet run-gdbstub-registers
 
+ifeq ($(CONFIG_PLUGIN),y)
  # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so: 		\
-	PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so: 		\
-	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

#13 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
   # We need to ensure expand the run-plugin-TEST-with-PLUGIN
   # pre-requistes manually here as we can't use stems to handle it. We
   # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
   ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+

  endif # MULTIARCH_TESTS
  endif # CONFIG_PLUGIN

tests/tcg/multiarch/Makefile.target +0 -0
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:

  TESTS += semihosting semiconsole
  endif

tests/tcg/multiarch/Makefile.target +4 -0
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)

  # Test plugin memory access instrumentation run-plugin-test-plugin-mem-access-with-libmem.so: \
      PLUGIN_ARGS=$(COMMA)print-accesses=true

tests/tcg/multiarch/Makefile.target +0 -0
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
       $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \

      $(QEMU) $<

tests/tcg/multiarch/Makefile.target +2 -2
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif

  # Update TESTS
  TESTS += $(MULTIARCH_TESTS)

tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
   MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \

      run-gdbstub-untimely-packet run-gdbstub-registers +ifeq ($(CONFIG_PLUGIN),y)
  # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access > run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout > run-plugin-test-plugin-mem-access-with-libmem.so.out

Cheers,
Gustavo

#14 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Hi,

Quoted 101 lines · Gustavo Romero

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
   # We need to ensure expand the run-plugin-TEST-with-PLUGIN
   # pre-requistes manually here as we can't use stems to handle it. We
   # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
   ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+

  endif # MULTIARCH_TESTS
  endif # CONFIG_PLUGIN

tests/tcg/multiarch/Makefile.target +0 -0
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:

  TESTS += semihosting semiconsole
  endif

tests/tcg/multiarch/Makefile.target +4 -0
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)

  # Test plugin memory access instrumentation run-plugin-test-plugin-mem-access-with-libmem.so: \
      PLUGIN_ARGS=$(COMMA)print-accesses=true

tests/tcg/multiarch/Makefile.target +0 -0
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
       $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \

      $(QEMU) $<

tests/tcg/multiarch/Makefile.target +2 -2
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif

  # Update TESTS
  TESTS += $(MULTIARCH_TESTS)

tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
   MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \

      run-gdbstub-untimely-packet run-gdbstub-registers +ifeq ($(CONFIG_PLUGIN),y)
  # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Quoted 7 lines

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access >  run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout  >  run-plugin-test-plugin-mem-access-with-libmem.so.out

The problem is that the new rules generated by a shuffled combination of tests and plugin (the one using eval) sometimes does not include the rule for the test+plugin combination passed via EXTRA_RUNs.

So EXTRA_RUNS tests like run-plugin-test-plugin-mem-access-with-libmem.so might end up with a proper rule if the test test-plugin-mem-access is combined with other plugin randomly, since now a plugin is picked up based on a tests index _idx modulo with the number of plugins.

A possible fix is to generate correctly the rules for the tests with plugins passed via EXTRA_RUNS and ideally, following the patch's mood, remove the test from running if any other plugin (no shuffle with any other plugin).

Of course, as Pierrick said, this patch could be a premature optimization. So maybe it doesn´t justify adding more complexity to our Makefile (Makefiles are hard to debug, with 'eval' tricks, it's _reallly_ hard, so the more we avoid it the better).

That said, if we want to keep this commit, I've kicked off a test to fix it here:

https://gitlab.com/gusbromero/qemu/-/pipelines/1959953122

and sent the fix to the ML too. HTH.

Cheers,
Gustavo

#15 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Quoted 129 lines · Gustavo Romero

Hi,

Quoted 101 lines · Gustavo Romero

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
   # We need to ensure expand the run-plugin-TEST-with-PLUGIN
   # pre-requistes manually here as we can't use stems to handle it. We
   # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
   ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN
tests/tcg/multiarch/Makefile.target +6 -2
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
   TESTS += semihosting semiconsole
   endif
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation
   run-plugin-test-plugin-mem-access-with-libmem.so: \
       PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
       $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
       $(QEMU) $<
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
   # Update TESTS
   TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +1 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
   MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
       run-gdbstub-untimely-packet run-gdbstub-registers
+ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 80

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Quoted 7 lines

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access >  run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout  >  run-plugin-test-plugin-mem-access-with-libmem.so.out

The problem is that the new rules generated by a shuffled combination of tests and plugin (the one using eval) sometimes does not include the rule for the test+plugin combination passed via EXTRA_RUNs.

So EXTRA_RUNS tests like run-plugin-test-plugin-mem-access-with-libmem.so might end up with a proper rule if the test test-plugin-mem-access is combined with other plugin randomly, since now a plugin is picked up based on a tests index _idx modulo with the number of plugins.

A possible fix is to generate correctly the rules for the tests with plugins passed via EXTRA_RUNS and ideally, following the patch's mood, remove the test from running if any other plugin (no shuffle with any other plugin).

Of course, as Pierrick said, this patch could be a premature optimization. So maybe it doesn´t justify adding more complexity to our Makefile (Makefiles are hard to debug, with 'eval' tricks, it's _reallly_ hard, so the more we avoid it the better).

Quoted 6 lines

That said, if we want to keep this commit, I've kicked off a test to fix it here:

https://gitlab.com/gusbromero/qemu/-/pipelines/1959953122

and sent the fix to the ML too. HTH.

Thanks for taking a look at this Gustavo.

In the pipeline you shared, the build-some-softmmu fails with:
Makefile:210: *** multiple target patterns. Stop.
make: *** [/builds/gusbromero/qemu/tests/Makefile.include:50: build-tcg-tests-x86_64-softmmu] Error 2
make: *** Waiting for unfinished jobs....

Is that a new bug related to current patch?

Quoted 3 lines

Cheers,
Gustavo

#16 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Hi Pierrick,

Quoted 137 lines · Pierrick Bouvier
Quoted 129 lines · Gustavo Romero

Hi,

Quoted 101 lines · Gustavo Romero

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
    # We need to ensure expand the run-plugin-TEST-with-PLUGIN
    # pre-requistes manually here as we can't use stems to handle it. We
    # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
    ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+

   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN

tests/tcg/multiarch/Makefile.target +0 -0
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:

   TESTS += semihosting semiconsole
   endif

tests/tcg/multiarch/Makefile.target +4 -0
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)

   # Test plugin memory access instrumentation run-plugin-test-plugin-mem-access-with-libmem.so: \
       PLUGIN_ARGS=$(COMMA)print-accesses=true

tests/tcg/multiarch/Makefile.target +0 -0
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
        $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \

       $(QEMU) $<

tests/tcg/multiarch/Makefile.target +2 -2
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif

   # Update TESTS
   TESTS += $(MULTIARCH_TESTS)

tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
    MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \

       run-gdbstub-untimely-packet run-gdbstub-registers +ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Quoted 7 lines

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access >  run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout  >  run-plugin-test-plugin-mem-access-with-libmem.so.out

The problem is that the new rules generated by a shuffled combination of tests and plugin (the one using eval) sometimes does not include the rule for the test+plugin combination passed via EXTRA_RUNs.

So EXTRA_RUNS tests like run-plugin-test-plugin-mem-access-with-libmem.so might end up with a proper rule if the test test-plugin-mem-access is combined with other plugin randomly, since now a plugin is picked up based on a tests index _idx modulo with the number of plugins.

A possible fix is to generate correctly the rules for the tests with plugins passed via EXTRA_RUNS and ideally, following the patch's mood, remove the test from running if any other plugin (no shuffle with any other plugin).

Of course, as Pierrick said, this patch could be a premature optimization. So maybe it doesn´t justify adding more complexity to our Makefile (Makefiles are hard to debug, with 'eval' tricks, it's _reallly_ hard, so the more we avoid it the better).

Quoted 6 lines

That said, if we want to keep this commit, I've kicked off a test to fix it here:

https://gitlab.com/gusbromero/qemu/-/pipelines/1959953122

and sent the fix to the ML too. HTH.

Quoted 8 lines

Thanks for taking a look at this Gustavo.

In the pipeline you shared, the build-some-softmmu fails with:
Makefile:210: *** multiple target patterns.  Stop.
make: *** [/builds/gusbromero/qemu/tests/Makefile.include:50: build-tcg-tests-x86_64-softmmu] Error 2
make: *** Waiting for unfinished jobs....

Is that a new bug related to current patch?

Yeah. I'm taking a look. I'll get back in a bit.

Thanks.

Cheers,
Gustavo

Quoted 4 lines
Quoted 3 lines

Cheers,
Gustavo

#17 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

In reply to Pierrick Bouvier

Hi Stefan and Pierrick,

Quoted 137 lines · Pierrick Bouvier
Quoted 129 lines · Gustavo Romero

Hi,

Quoted 101 lines · Gustavo Romero

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
    # We need to ensure expand the run-plugin-TEST-with-PLUGIN
    # pre-requistes manually here as we can't use stems to handle it. We
    # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
    ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+

   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN

tests/tcg/multiarch/Makefile.target +0 -0
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:

   TESTS += semihosting semiconsole
   endif

tests/tcg/multiarch/Makefile.target +4 -0
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)

   # Test plugin memory access instrumentation run-plugin-test-plugin-mem-access-with-libmem.so: \
       PLUGIN_ARGS=$(COMMA)print-accesses=true

tests/tcg/multiarch/Makefile.target +0 -0
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
        $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \

       $(QEMU) $<

tests/tcg/multiarch/Makefile.target +2 -2
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif

   # Update TESTS
   TESTS += $(MULTIARCH_TESTS)

tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
    MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \

       run-gdbstub-untimely-packet run-gdbstub-registers +ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Quoted 7 lines

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access >  run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout  >  run-plugin-test-plugin-mem-access-with-libmem.so.out

The problem is that the new rules generated by a shuffled combination of tests and plugin (the one using eval) sometimes does not include the rule for the test+plugin combination passed via EXTRA_RUNs.

So EXTRA_RUNS tests like run-plugin-test-plugin-mem-access-with-libmem.so might end up with a proper rule if the test test-plugin-mem-access is combined with other plugin randomly, since now a plugin is picked up based on a tests index _idx modulo with the number of plugins.

A possible fix is to generate correctly the rules for the tests with plugins passed via EXTRA_RUNS and ideally, following the patch's mood, remove the test from running if any other plugin (no shuffle with any other plugin).

Of course, as Pierrick said, this patch could be a premature optimization. So maybe it doesn´t justify adding more complexity to our Makefile (Makefiles are hard to debug, with 'eval' tricks, it's _reallly_ hard, so the more we avoid it the better).

Quoted 6 lines

That said, if we want to keep this commit, I've kicked off a test to fix it here:

https://gitlab.com/gusbromero/qemu/-/pipelines/1959953122

and sent the fix to the ML too. HTH.

Quoted 8 lines

Thanks for taking a look at this Gustavo.

In the pipeline you shared, the build-some-softmmu fails with:
Makefile:210: *** multiple target patterns.  Stop.
make: *** [/builds/gusbromero/qemu/tests/Makefile.include:50: build-tcg-tests-x86_64-softmmu] Error 2
make: *** Waiting for unfinished jobs....

Is that a new bug related to current patch?

v2 was busted. Please consider this fix, which passed the test pipeline:

https://gitlab.com/gusbromero/qemu/-/pipelines/1960296034

https://mail.gnu.org/archive/html/qemu-devel/2025-07/msg06926.html

Cheers,
Gustavo

#18 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Quoted 142 lines · Gustavo Romero

Hi Stefan and Pierrick,

Quoted 139 lines · Pierrick Bouvier
Quoted 129 lines · Gustavo Romero

Hi,

Quoted 101 lines · Gustavo Romero

Hi,

Quoted 96 lines · Pierrick Bouvier

Hi Alex,

Quoted 80 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
    # We need to ensure expand the run-plugin-TEST-with-PLUGIN
    # pre-requistes manually here as we can't use stems to handle it. We
    # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
    ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-    $(foreach t,$(MULTIARCH_TESTS),\
-        $(eval run-plugin-$(t)-with-$(p): $t $p) \
-        $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+    $(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+    $(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+    $(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+    $(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+

   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN

tests/tcg/multiarch/Makefile.target +0 -0
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:

   TESTS += semihosting semiconsole
   endif

tests/tcg/multiarch/Makefile.target +4 -0
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)

   # Test plugin memory access instrumentation run-plugin-test-plugin-mem-access-with-libmem.so: \
       PLUGIN_ARGS=$(COMMA)print-accesses=true

tests/tcg/multiarch/Makefile.target +0 -0
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
        $(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \

       $(QEMU) $<

tests/tcg/multiarch/Makefile.target +2 -2
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif

   # Update TESTS
   TESTS += $(MULTIARCH_TESTS)

tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
    MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \

       run-gdbstub-untimely-packet run-gdbstub-registers +ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 10 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +6 -4
-run-plugin-memory-with-libmem.so:         \
-    PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so:         \
-    CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails [1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 1 line

[1] https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Quoted 7 lines

I was not able to reproduce it locally on 22.04, but in the CI indeed the test command is missing the "test-plugin-mem-access" binary at the end, just before redirection to .so.out, it should be:

[...] -D test-plugin-mem-access-with-libmem.so.pout test-plugin-mem-access >  run-plugin-test-plugin-mem-access-with-libmem.so.out

not:

[...] -D test-plugin-mem-access-with-libmem.so.pout  >  run-plugin-test-plugin-mem-access-with-libmem.so.out

The problem is that the new rules generated by a shuffled combination of tests and plugin (the one using eval) sometimes does not include the rule for the test+plugin combination passed via EXTRA_RUNs.

So EXTRA_RUNS tests like run-plugin-test-plugin-mem-access-with-libmem.so might end up with a proper rule if the test test-plugin-mem-access is combined with other plugin randomly, since now a plugin is picked up based on a tests index _idx modulo with the number of plugins.

A possible fix is to generate correctly the rules for the tests with plugins passed via EXTRA_RUNS and ideally, following the patch's mood, remove the test from running if any other plugin (no shuffle with any other plugin).

Of course, as Pierrick said, this patch could be a premature optimization. So maybe it doesn´t justify adding more complexity to our Makefile (Makefiles are hard to debug, with 'eval' tricks, it's _reallly_ hard, so the more we avoid it the better).

Quoted 6 lines

That said, if we want to keep this commit, I've kicked off a test to fix it here:

https://gitlab.com/gusbromero/qemu/-/pipelines/1959953122

and sent the fix to the ML too. HTH.

Thanks for taking a look at this Gustavo.

Quoted 8 lines
Quoted 6 lines

In the pipeline you shared, the build-some-softmmu fails with:
Makefile:210: *** multiple target patterns.  Stop.
make: *** [/builds/gusbromero/qemu/tests/Makefile.include:50: build-tcg-tests-x86_64-softmmu] Error 2
make: *** Waiting for unfinished jobs....

Is that a new bug related to current patch?

v2 was busted. Please consider this fix, which passed the test pipeline:

v1, I meant. Please consider v2 as the good one :)

Quoted 3 lines

https://gitlab.com/gusbromero/qemu/-/pipelines/1960296034

https://mail.gnu.org/archive/html/qemu-devel/2025-07/msg06926.html

Cheers,
Gustavo

#19 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

In reply to Pierrick Bouvier
Quoted 87 lines · Pierrick Bouvier

Hi Alex,

Quoted 84 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
   # We need to ensure expand the run-plugin-TEST-with-PLUGIN
   # pre-requistes manually here as we can't use stems to handle it. We
   # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
 
   ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS),\
-		$(eval run-plugin-$(t)-with-$(p): $t $p) \
-		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN
 
tests/tcg/multiarch/Makefile.target +6 -2
index bfdf7197a7b..38345ff8805 100644
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
   TESTS += semihosting semiconsole
   endif
 
+test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation
   run-plugin-test-plugin-mem-access-with-libmem.so: \
   	PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
   	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
   	$(QEMU) $<
 
-test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
 
   # Update TESTS
   TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +0 -0
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
   MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
   	run-gdbstub-untimely-packet run-gdbstub-registers
 
Quoted 17 lines

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 12 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +7 -4
+ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation
-run-plugin-memory-with-libmem.so: 		\
-	PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so: 		\
-	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails
[1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Reverting this patch solved the problem on my side. As well, I'm not sure if it's a real problem to run all plugins for all tests. At the moment, it takes 5 min on a slow machine with 4 cpus and a sanitized build, something we can probably live with for now.

Unfortunately Alex is out this week, but it would be nice if another maintainer could make a PR reverting this patch.

Regards,
Pierrick

Quoted 2 lines

[1]
https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

#20 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Quoted 100 lines · Pierrick Bouvier
Quoted 89 lines · Pierrick Bouvier

Hi Alex,

Quoted 87 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
   # We need to ensure expand the run-plugin-TEST-with-PLUGIN
   # pre-requistes manually here as we can't use stems to handle it. We
   # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
      ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS),\
-		$(eval run-plugin-$(t)-with-$(p): $t $p) \
-		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
   endif # MULTIARCH_TESTS
   endif # CONFIG_PLUGIN
   diff --git a/tests/tcg/multiarch/Makefile.target

b/tests/tcg/multiarch/Makefile.target
index bfdf7197a7b..38345ff8805 100644

tests/tcg/multiarch/Makefile.target +5 -1
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
   TESTS += semihosting semiconsole
   endif
   +test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation
   run-plugin-test-plugin-mem-access-with-libmem.so: \
   	PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
   	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
   	$(QEMU) $<
   -test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
      # Update TESTS
   TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +2 -4
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
   MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
   	run-gdbstub-untimely-packet run-gdbstub-registers
   +ifeq ($(CONFIG_PLUGIN),y)
   # Test plugin memory access instrumentation
-run-plugin-memory-with-libmem.so: 		\
-	PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so: 		\
-	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
Quoted 9 lines

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 4 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +4 -0
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails
[1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 4 lines

Reverting this patch solved the problem on my side. As well, I'm not sure if it's a real problem to run all plugins for all tests. At the moment, it takes 5 min on a slow machine with 4 cpus and a sanitized build, something we can probably live with for now.

It definitely is - but it really shows up on linux-user builds because we have an increasing number of multiarch tests and its not sustainable to increase by $NARCH * $NPLUGIN everytime a new multiarch test is added.

Quoted 9 lines

Unfortunately Alex is out this week, but it would be nice if another maintainer could make a PR reverting this patch.

Regards,
Pierrick

Quoted 2 lines

[1]
https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#21 lore raw

Re: [PULL 11/14] tests/tcg: reduce the number of plugin tests combinations

Quoted 107 lines · Alex Bennée
Quoted 100 lines · Pierrick Bouvier
Quoted 89 lines · Pierrick Bouvier

Hi Alex,

Quoted 87 lines · Alex Bennée

As our set of multiarch tests has grown the practice of running every plugin with every test is becoming unsustainable. If we switch to ensuring every test gets run with at least one plugin we can speed things up.

Some plugins do need to be run with specific tests (for example the memory instrumentation test). We can handle this by manually adding them to EXTRA_RUNS. We also need to wrap rules in a CONFIG_PLUGIN test so we don't enable the runs when plugins are not enabled.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +17 -6
index a12b15637ea..18afd5be194 100644
@@ -173,14 +173,25 @@ PLUGINS=$(filter-out $(DISABLE_PLUGINS), \
    # We need to ensure expand the run-plugin-TEST-with-PLUGIN
    # pre-requistes manually here as we can't use stems to handle it. We
    # only expand MULTIARCH_TESTS which are common on most of our targets
-# to avoid an exponential explosion as new tests are added. We also
-# add some special helpers the run-plugin- rules can use below.
+# and rotate the plugins so we don't grow too out of control as new
+# tests are added. Plugins that need to run with a specific test
+# should ensure they add their combination to EXTRA_RUNS.
       ifneq ($(MULTIARCH_TESTS),)
-$(foreach p,$(PLUGINS), \
-	$(foreach t,$(MULTIARCH_TESTS),\
-		$(eval run-plugin-$(t)-with-$(p): $t $p) \
-		$(eval RUN_TESTS+=run-plugin-$(t)-with-$(p))))
+
+NUM_PLUGINS := $(words $(PLUGINS))
+NUM_TESTS := $(words $(MULTIARCH_TESTS))
+
+define mod_plus_one
+  $(shell $(PYTHON) -c "print( ($(1) % $(2)) + 1 )")
+endef
+
+$(foreach _idx, $(shell seq 1 $(NUM_TESTS)), \
+	$(eval _test := $(word $(_idx), $(MULTIARCH_TESTS))) \
+	$(eval _plugin := $(word $(call mod_plus_one, $(_idx), $(NUM_PLUGINS)), $(PLUGINS))) \
+	$(eval run-plugin-$(_test)-with-$(_plugin): $(_test) $(_plugin)) \
+	$(eval RUN_TESTS+=run-plugin-$(_test)-with-$(_plugin)))
+
    endif # MULTIARCH_TESTS
    endif # CONFIG_PLUGIN
    diff --git a/tests/tcg/multiarch/Makefile.target

b/tests/tcg/multiarch/Makefile.target
index bfdf7197a7b..38345ff8805 100644

tests/tcg/multiarch/Makefile.target +5 -1
@@ -189,6 +189,10 @@ run-plugin-semiconsole-with-%:
    TESTS += semihosting semiconsole
    endif
    +test-plugin-mem-access: CFLAGS+=-pthread -O0
+test-plugin-mem-access: LDFLAGS+=-pthread -O0
+
+ifeq ($(CONFIG_PLUGIN),y)
    # Test plugin memory access instrumentation
    run-plugin-test-plugin-mem-access-with-libmem.so: \
    	PLUGIN_ARGS=$(COMMA)print-accesses=true
@@ -197,8 +201,8 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \
    	$(SRC_PATH)/tests/tcg/multiarch/check-plugin-output.sh \
    	$(QEMU) $<
    -test-plugin-mem-access: CFLAGS+=-pthread -O0
-test-plugin-mem-access: LDFLAGS+=-pthread -O0
+EXTRA_RUNS += run-plugin-test-plugin-mem-access-with-libmem.so
+endif
       # Update TESTS
    TESTS += $(MULTIARCH_TESTS)
tests/tcg/multiarch/system/Makefile.softmmu-target +2 -4
index 5acf2700812..4171b4e6aa0 100644
@@ -71,8 +71,11 @@ endif
    MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt \
    	run-gdbstub-untimely-packet run-gdbstub-registers
    +ifeq ($(CONFIG_PLUGIN),y)
    # Test plugin memory access instrumentation
-run-plugin-memory-with-libmem.so: 		\
-	PLUGIN_ARGS=$(COMMA)region-summary=true
-run-plugin-memory-with-libmem.so: 		\
-	CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+run-plugin-memory-with-libmem.so: memory libmem.so
+run-plugin-memory-with-libmem.so: PLUGIN_ARGS=$(COMMA)region-summary=true
Quoted 9 lines

tests/tcg/multiarch/system/Makefile.softmmu-target endif · line 81

Quoted 4 lines
tests/tcg/multiarch/system/Makefile.softmmu-target +4 -0
+run-plugin-memory-with-libmem.so: CHECK_PLUGIN_OUTPUT_COMMAND=$(MULTIARCH_SYSTEM_SRC)/validate-memory-counts.py [email protected]
+
+EXTRA_RUNS += run-plugin-memory-with-libmem.so
+endif

I'm not sure how it's related, but check-tcg on aarch64 host now fails
[1] since this series was merged, and I suspect it may be related to this patch. I didn't spend time to reproduce and investigate it.

Quoted 4 lines

Reverting this patch solved the problem on my side. As well, I'm not sure if it's a real problem to run all plugins for all tests. At the moment, it takes 5 min on a slow machine with 4 cpus and a sanitized build, something we can probably live with for now.

Quoted 5 lines

It definitely is - but it really shows up on linux-user builds because we have an increasing number of multiarch tests and its not sustainable to increase by $NARCH * $NPLUGIN everytime a new multiarch test is added.

For information, plugins tests are responsible for 65% of check-tcg time approximately, so this makes sense.

Quoted 10 lines
Quoted 9 lines

Unfortunately Alex is out this week, but it would be nice if another maintainer could make a PR reverting this patch.

Regards,
Pierrick

Quoted 2 lines

[1]
https://github.com/pbo-linaro/qemu-ci/actions/runs/16575679153/job/46879690693

#22 lore raw

[PULL 12/14] tests/docker: add --arch-only to qemu deps for all-test-cross

In reply to Alex Bennée

If we want to build this container on non-x86 systems we might not have all the cross-compilers needed for the ROM blobs we don't actually build. Use --arch-only to avoid stalling on these missing bits.

Message-ID: <[email protected]>

tests/docker/dockerfiles/debian-all-test-cross.docker +1 -1
index 8ab244e018a..5aa43749ebe 100644
@@ -15,7 +15,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     apt-get update && \
     apt-get install -y eatmydata && \
     eatmydata apt-get dist-upgrade -y && \
-    apt build-dep -yy qemu
+    apt build-dep -yy --arch-only qemu
 
 # Add extra build tools and as many cross compilers as we can for testing
 RUN DEBIAN_FRONTEND=noninteractive eatmydata \
Signature · 1 line
2.47.2
#23 lore raw

[PULL 13/14] tests/docker: handle host-arch selection for all-test-cross

In reply to Alex Bennée

When building on non-x86 we get a bunch but not all of the compilers. Handle this in the Dockerfile by probing the arch and expanding the list available.

Message-ID: <[email protected]>

tests/docker/dockerfiles/debian-all-test-cross.docker +18 -14
index 5aa43749ebe..ef69bbc8a51 100644
@@ -23,7 +23,9 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         bison \
         ccache \
         clang  \
+        dpkg-dev \
         flex \
+        gcc \
         git \
         libclang-rt-dev \
         ninja-build \
@@ -33,16 +35,11 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         python3-venv \
         python3-wheel
 
-RUN DEBIAN_FRONTEND=noninteractive eatmydata \
-        apt install -y --no-install-recommends \
-        gcc-aarch64-linux-gnu \
+# All the generally available compilers
+ENV AVAILABLE_COMPILERS gcc-aarch64-linux-gnu \
         libc6-dev-arm64-cross \
         gcc-arm-linux-gnueabihf \
         libc6-dev-armhf-cross \
-        gcc-hppa-linux-gnu \
-        libc6-dev-hppa-cross \
-        gcc-m68k-linux-gnu \
-        libc6-dev-m68k-cross \
         gcc-mips-linux-gnu \
         libc6-dev-mips-cross \
         gcc-mips64-linux-gnuabi64 \
@@ -51,18 +48,25 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         libc6-dev-mips64el-cross \
         gcc-mipsel-linux-gnu \
         libc6-dev-mipsel-cross \
-        gcc-powerpc-linux-gnu \
-        libc6-dev-powerpc-cross \
-        gcc-powerpc64-linux-gnu \
-        libc6-dev-ppc64-cross \
         gcc-powerpc64le-linux-gnu \
         libc6-dev-ppc64el-cross \
         gcc-riscv64-linux-gnu \
         libc6-dev-riscv64-cross \
         gcc-s390x-linux-gnu \
-        libc6-dev-s390x-cross \
-        gcc-sparc64-linux-gnu \
-        libc6-dev-sparc64-cross && \
+        libc6-dev-s390x-cross
+
+RUN if dpkg-architecture -e amd64; then \
+  export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-hppa-linux-gnu libc6-dev-hppa-cross"; \
+  export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-m68k-linux-gnu libc6-dev-m68k-cross"; \
+  export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc-linux-gnu libc6-dev-powerpc-cross"; \
+  export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross"; \
+  export AVAILABLE_COMPILERS="${AVAILABLE_COMPILERS} gcc-sparc64-linux-gnu libc6-dev-sparc64-cross"; \
+  fi && \
+  echo "compilers: ${AVAILABLE_COMPILERS}"
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+        apt install -y --no-install-recommends \
+        ${AVAILABLE_COMPILERS} && \
         dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt
 
 
Signature · 1 line
2.47.2
#24 lore raw

[PULL 02/14] docs/system: reword the TAP notes to remove tarball ref

In reply to Alex Bennée

We don't ship the tarball and users should generally look to the distribution specific packaging.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/560

Message-ID: <[email protected]>

docs/system/devices/net.rst +11 -5
index 4d787c3aeb0..7d76fe88c45 100644
@@ -21,11 +21,17 @@ configure it as if it was a real ethernet card.
 Linux host
 ^^^^^^^^^^
 
-As an example, you can download the ``linux-test-xxx.tar.gz`` archive
-and copy the script ``qemu-ifup`` in ``/etc`` and configure properly
-``sudo`` so that the command ``ifconfig`` contained in ``qemu-ifup`` can
-be executed as root. You must verify that your host kernel supports the
-TAP network interfaces: the device ``/dev/net/tun`` must be present.
+A distribution will generally provide specific helper scripts when it
+packages QEMU. By default these are found at ``/etc/qemu-ifup`` and
+``/etc/qemu-ifdown`` and are called appropriately when QEMU wants to
+change the network state.
+
+If QEMU is being run as a non-privileged user you may need properly
+configure ``sudo`` so that network commands in the scripts can be
+executed as root.
+
+You must verify that your host kernel supports the TAP network
+interfaces: the device ``/dev/net/tun`` must be present.
 
 See :ref:`sec_005finvocation` to have examples of command
 lines using the TAP network interfaces.
Signature · 1 line
2.47.2
#25 lore raw

[PULL 04/14] docs/user: slightly reword section on system calls

In reply to Alex Bennée

Expand the description slightly and quote ioctl(). I did ponder mentioning something about why DRM ioctls are often missing but I see we have the I915 ones so I guess its just no one has done them.

Message-ID: <[email protected]>

docs/user/main.rst +8 -4
index b8ff203c212..05de904225c 100644
@@ -20,10 +20,14 @@ QEMU user space emulation has the following notable features:
 System call translation
 ~~~~~~~~~~~~~~~~~~~~~~~
 
-QEMU includes a generic system call translator. This means that the
-parameters of the system calls can be converted to fix endianness
-and 32/64-bit mismatches between hosts and targets. IOCTLs can be
-converted too.
+System calls are the principle interface between user-space and the
+kernel. Generally the same system calls exist on all versions of the
+kernel so QEMU includes a generic system call translator. The
+translator takes care of adjusting endianess, 32/64 bit parameter size
+and then calling the equivalent host system call.
+
+QEMU can also adjust device specific ``ioctl()`` calls in a similar
+fashion.
 
 POSIX signal handling
 ~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.47.2
#26 lore raw

[PULL 09/14] tests/tcg: don't include multiarch tests if not supported

In reply to Alex Bennée

We are about to change the way the plugin runs are done and having this included by default will complicate things.

Message-ID: <[email protected]>

tests/tcg/Makefile.target +6 -0
index 97ebe8f9bc9..a12b15637ea 100644
@@ -127,8 +127,14 @@ else
 # build options for bare programs are usually pretty different. They
 # are expected to provide their own build recipes.
 EXTRA_CFLAGS += -ffreestanding -fno-stack-protector
+
+# We skip the multiarch tests if the target hasn't provided a boot.S
+MULTIARCH_SOFTMMU_TARGETS = i386 alpha aarch64 arm loongarch64 s390x x86_64
+
+ifneq ($(filter $(TARGET_NAME),$(MULTIARCH_SOFTMMU_TARGETS)),)
 -include $(SRC_PATH)/tests/tcg/minilib/Makefile.target
 -include $(SRC_PATH)/tests/tcg/multiarch/system/Makefile.softmmu-target
+endif
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target
 
 endif
tests/tcg/multiarch/system/Makefile.softmmu-target +5 -0
index 07be001102b..5acf2700812 100644
@@ -6,6 +6,11 @@
 # architecture to add to the test dependencies and deal with the
 # complications of building.
 #
+# To support the multiarch guests the target arch needs to provide a
+# boot.S that jumps to main and provides a __sys_outc functions.
+# Remember to update MULTIARCH_SOFTMMU_TARGETS in the tcg test
+# Makefile.target when this is done.
+#
 
 MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
 MULTIARCH_SYSTEM_SRC=$(MULTIARCH_SRC)/system
Signature · 1 line
2.47.2