.cirrus.yml | 11 + .gitlab-ci.yml | 2 +- .shippable.yml | 2 - .travis.yml | 69 ++- MAINTAINERS | 6 + Makefile | 16 +- Makefile.target | 2 + accel/stubs/tcg-stub.c | 1 - accel/tcg/Makefile.objs | 1 + accel/tcg/atomic_common.inc.c | 54 ++ accel/tcg/atomic_template.h | 94 +-- accel/tcg/cpu-exec.c | 8 +- accel/tcg/cputlb.c | 84 ++- accel/tcg/plugin-gen.c | 932 ++++++++++++++++++++++++++++++ accel/tcg/plugin-helpers.h | 5 + accel/tcg/translate-all.c | 15 +- accel/tcg/translator.c | 20 + accel/tcg/user-exec.c | 3 + bsd-user/syscall.c | 24 +- configure | 89 +++ cpus-common.c | 4 + cpus.c | 10 + disas.c | 110 ++++ docs/devel/index.rst | 1 + docs/devel/plugins.rst | 112 ++++ exec.c | 2 + hw/core/cpu.c | 2 + include/disas/disas.h | 2 + include/exec/cpu-defs.h | 1 + include/exec/cpu_ldst.h | 11 + include/exec/cpu_ldst_template.h | 41 +- include/exec/cpu_ldst_useronly_template.h | 32 +- include/exec/exec-all.h | 64 +- include/exec/helper-gen.h | 1 + include/exec/helper-proto.h | 1 + include/exec/helper-tcg.h | 1 + include/exec/plugin-gen.h | 71 +++ include/exec/translator.h | 62 +- include/hw/core/cpu.h | 19 + include/qemu/log.h | 1 + include/qemu/plugin-memory.h | 40 ++ include/qemu/plugin.h | 255 ++++++++ include/qemu/qemu-plugin.h | 393 +++++++++++++ include/qemu/queue.h | 10 + include/user/syscall-trace.h | 40 ++ linux-user/exit.c | 1 + linux-user/main.c | 18 + linux-user/syscall.c | 7 +- plugins/.gitignore | 2 + plugins/Makefile.objs | 21 + plugins/api.c | 341 +++++++++++ plugins/core.c | 502 ++++++++++++++++ plugins/loader.c | 377 ++++++++++++ plugins/plugin.h | 97 ++++ plugins/qemu-plugins.symbols | 40 ++ qemu-options.hx | 17 + scripts/checkpatch.pl | 2 +- scripts/tracetool/transform.py | 1 + target/alpha/translate.c | 2 +- target/arm/arm_ldst.h | 15 +- target/cris/translate_v10.inc.c | 3 +- target/hppa/translate.c | 2 +- target/i386/translate.c | 10 +- target/m68k/translate.c | 2 +- target/openrisc/translate.c | 2 +- target/ppc/translate.c | 8 +- target/riscv/translate.c | 2 +- target/sh4/translate.c | 4 +- target/sparc/translate.c | 2 +- target/xtensa/translate.c | 4 +- tcg/tcg-op.c | 40 +- tcg/tcg-op.h | 16 + tcg/tcg-opc.h | 3 + tcg/tcg.c | 22 + tcg/tcg.h | 41 +- tests/Makefile.include | 11 +- tests/docker/Makefile.include | 6 +- tests/docker/dockerfiles/travis.docker | 6 +- tests/plugin/Makefile | 31 + tests/plugin/bb.c | 64 ++ tests/plugin/empty.c | 30 + tests/plugin/hotblocks.c | 143 +++++ tests/plugin/hotpages.c | 191 ++++++ tests/plugin/howvec.c | 352 +++++++++++ tests/plugin/insn.c | 61 ++ tests/plugin/mem.c | 97 ++++ tests/tcg/Makefile.target | 43 +- tests/tcg/aarch64/Makefile.softmmu-target | 2 +- tests/tcg/aarch64/Makefile.target | 6 + tests/tcg/arm/Makefile.softmmu-target | 1 + tests/tcg/arm/Makefile.target | 6 + tests/tcg/cris/Makefile.target | 2 +- tests/tcg/i386/Makefile.target | 11 +- tests/vm/basevm.py | 15 +- tests/vm/netbsd | 195 ++++++- trace-events | 8 +- trace/mem-internal.h | 39 +- trace/mem.h | 7 +- util/log.c | 3 + vl.c | 11 + 100 files changed, 5462 insertions(+), 207 deletions(-) create mode 100644 accel/tcg/atomic_common.inc.c create mode 100644 accel/tcg/plugin-gen.c create mode 100644 accel/tcg/plugin-helpers.h create mode 100644 docs/devel/plugins.rst create mode 100644 include/exec/plugin-gen.h create mode 100644 include/qemu/plugin-memory.h create mode 100644 include/qemu/plugin.h create mode 100644 include/qemu/qemu-plugin.h create mode 100644 include/user/syscall-trace.h create mode 100644 plugins/.gitignore create mode 100644 plugins/Makefile.objs create mode 100644 plugins/api.c create mode 100644 plugins/core.c create mode 100644 plugins/loader.c create mode 100644 plugins/plugin.h create mode 100644 plugins/qemu-plugins.symbols create mode 100644 tests/plugin/Makefile create mode 100644 tests/plugin/bb.c create mode 100644 tests/plugin/empty.c create mode 100644 tests/plugin/hotblocks.c create mode 100644 tests/plugin/hotpages.c create mode 100644 tests/plugin/howvec.c create mode 100644 tests/plugin/insn.c create mode 100644 tests/plugin/mem.c
The following changes since commit 81c1f71eeb874c4cbbb9c5c4d1a1dc0ba7391dff: Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2019-10-24 10:43:20 +0100) are available in the Git repository at: https://github.com/stsquad/qemu.git tags/pull-testing-and-plugins-241019-2 for you to fetch changes up to 18900c2d7901680457b51b3ad3f684ef9cba8b64: travis.yml: enable linux-gcc-debug-tcg cache (2019-10-24 22:31:29 +0100) ---------------------------------------------------------------- Core TCG plugin support and testing updates - TCG plugin support - netbsd VM autoinstall - various Travis dependency updates - enable tcg debug for check-tcg - additional Xcode build for Cirrus - dependency tweak for gitlab ---------------------------------------------------------------- Alex Bennée (30): travis.yml: reduce scope of the --enable-debug build travis.yml: bump Xcode 10 to latest dot release cirrus.yml: add latest Xcode build target travis.yml: cache the clang sanitizer build travis.yml: --enable-debug-tcg to check-tcg tests/docker: set HOST_ARCH if we don't have ARCH tests/docker: update Travis image to a more current version trace: add mmu_index to mem_info docs/devel: add plugins.rst design document plugin: add implementation of the api plugins: implement helpers for resolving hwaddr cputlb: ensure _cmmu helper functions follow the naming standard configure: add --enable-plugins plugin: expand the plugin_init function to include an info block plugin: add qemu_plugin_insn_disas helper plugin: add qemu_plugin_outs helper tests/tcg/Makefile.target: fix path to config-host.mak tests/tcg: set QEMU_OPTS for all cris runs tests/tcg: move "virtual" tests to EXTRA_TESTS tests/tcg: drop test-i386-fprem from TESTS when not SLOW tests/tcg: enable plugin testing tests/plugin: add a hotblocks plugin tests/plugin: add instruction execution breakdown tests/plugin: add hotpages to analyse memory access patterns accel/stubs: reduce headers from tcg-stub include/exec: wrap cpu_ldst.h in CONFIG_TCG .travis.yml: add --enable-plugins tests scripts/checkpatch.pl: don't complain about (foo, /* empty */) MAINTAINERS: add me for the TCG plugins code travis.yml: enable linux-gcc-debug-tcg cache Eduardo Habkost (2): tests/vm: Let subclasses disable IPv6 tests/vm/netbsd: Disable IPv6 Emilio G. Cota (32): trace: expand mem_info:size_shift to 4 bits cpu: introduce cpu_in_exclusive_context() translate-all: use cpu_in_exclusive_work_context() in tb_flush plugin: add user-facing API plugin: add core code queue: add QTAILQ_REMOVE_SEVERAL cputlb: document get_page_addr_code cputlb: introduce get_page_addr_code_hostp tcg: add tcg_gen_st_ptr plugin-gen: add module for TCG-related code atomic_template: add inline trace/plugin helpers tcg: let plugins instrument virtual memory accesses translate-all: notify plugin code of tb_flush *-user: notify plugin of exit *-user: plugin syscalls cpu: hook plugin vcpu events plugin-gen: add plugin_insn_append translator: add translator_ld{ub,sw,uw,l,q} target/arm: fetch code with translator_ld target/ppc: fetch code with translator_ld target/sh4: fetch code with translator_ld target/i386: fetch code with translator_ld target/hppa: fetch code with translator_ld target/m68k: fetch code with translator_ld target/alpha: fetch code with translator_ld target/riscv: fetch code with translator_ld target/sparc: fetch code with translator_ld target/xtensa: fetch code with translator_ld target/openrisc: fetch code with translator_ld translator: inject instrumentation from plugins plugin: add API symbols to qemu-plugins.symbols tests/plugin: add sample plugins Gerd Hoffmann (1): tests/vm: netbsd autoinstall, using serial console Lluís Vilanova (2): vl: support -plugin option linux-user: support -plugin option Philippe Mathieu-Daudé (1): travis.yml: Test the release tarball Thomas Huth (5): travis.yml: Add libvdeplug-dev to compile-test net/vde.c travis.yml: Use libsdl2 instead of libsdl1.2, and install libsdl2-image travis.yml: Use newer version of libgnutls and libpng travis.yml: Fix the ccache lines gitlab-ci.yml: Use libvdeplug-dev to compile-test the VDE network backend .cirrus.yml | 11 + .gitlab-ci.yml | 2 +- .shippable.yml | 2 - .travis.yml | 69 ++- MAINTAINERS | 6 + Makefile | 16 +- Makefile.target | 2 + accel/stubs/tcg-stub.c | 1 - accel/tcg/Makefile.objs | 1 + accel/tcg/atomic_common.inc.c | 54 ++ accel/tcg/atomic_template.h | 94 +-- accel/tcg/cpu-exec.c | 8 +- accel/tcg/cputlb.c | 84 ++- accel/tcg/plugin-gen.c | 932 ++++++++++++++++++++++++++++++ accel/tcg/plugin-helpers.h | 5 + accel/tcg/translate-all.c | 15 +- accel/tcg/translator.c | 20 + accel/tcg/user-exec.c | 3 + bsd-user/syscall.c | 24 +- configure | 89 +++ cpus-common.c | 4 + cpus.c | 10 + disas.c | 110 ++++ docs/devel/index.rst | 1 + docs/devel/plugins.rst | 112 ++++ exec.c | 2 + hw/core/cpu.c | 2 + include/disas/disas.h | 2 + include/exec/cpu-defs.h | 1 + include/exec/cpu_ldst.h | 11 + include/exec/cpu_ldst_template.h | 41 +- include/exec/cpu_ldst_useronly_template.h | 32 +- include/exec/exec-all.h | 64 +- include/exec/helper-gen.h | 1 + include/exec/helper-proto.h | 1 + include/exec/helper-tcg.h | 1 + include/exec/plugin-gen.h | 71 +++ include/exec/translator.h | 62 +- include/hw/core/cpu.h | 19 + include/qemu/log.h | 1 + include/qemu/plugin-memory.h | 40 ++ include/qemu/plugin.h | 255 ++++++++ include/qemu/qemu-plugin.h | 393 +++++++++++++ include/qemu/queue.h | 10 + include/user/syscall-trace.h | 40 ++ linux-user/exit.c | 1 + linux-user/main.c | 18 + linux-user/syscall.c | 7 +- plugins/.gitignore | 2 + plugins/Makefile.objs | 21 + plugins/api.c | 341 +++++++++++ plugins/core.c | 502 ++++++++++++++++ plugins/loader.c | 377 ++++++++++++ plugins/plugin.h | 97 ++++ plugins/qemu-plugins.symbols | 40 ++ qemu-options.hx | 17 + scripts/checkpatch.pl | 2 +- scripts/tracetool/transform.py | 1 + target/alpha/translate.c | 2 +- target/arm/arm_ldst.h | 15 +- target/cris/translate_v10.inc.c | 3 +- target/hppa/translate.c | 2 +- target/i386/translate.c | 10 +- target/m68k/translate.c | 2 +- target/openrisc/translate.c | 2 +- target/ppc/translate.c | 8 +- target/riscv/translate.c | 2 +- target/sh4/translate.c | 4 +- target/sparc/translate.c | 2 +- target/xtensa/translate.c | 4 +- tcg/tcg-op.c | 40 +- tcg/tcg-op.h | 16 + tcg/tcg-opc.h | 3 + tcg/tcg.c | 22 + tcg/tcg.h | 41 +- tests/Makefile.include | 11 +- tests/docker/Makefile.include | 6 +- tests/docker/dockerfiles/travis.docker | 6 +- tests/plugin/Makefile | 31 + tests/plugin/bb.c | 64 ++ tests/plugin/empty.c | 30 + tests/plugin/hotblocks.c | 143 +++++ tests/plugin/hotpages.c | 191 ++++++ tests/plugin/howvec.c | 352 +++++++++++ tests/plugin/insn.c | 61 ++ tests/plugin/mem.c | 97 ++++ tests/tcg/Makefile.target | 43 +- tests/tcg/aarch64/Makefile.softmmu-target | 2 +- tests/tcg/aarch64/Makefile.target | 6 + tests/tcg/arm/Makefile.softmmu-target | 1 + tests/tcg/arm/Makefile.target | 6 + tests/tcg/cris/Makefile.target | 2 +- tests/tcg/i386/Makefile.target | 11 +- tests/vm/basevm.py | 15 +- tests/vm/netbsd | 195 ++++++- trace-events | 8 +- trace/mem-internal.h | 39 +- trace/mem.h | 7 +- util/log.c | 3 + vl.c | 11 + 100 files changed, 5462 insertions(+), 207 deletions(-) create mode 100644 accel/tcg/atomic_common.inc.c create mode 100644 accel/tcg/plugin-gen.c create mode 100644 accel/tcg/plugin-helpers.h create mode 100644 docs/devel/plugins.rst create mode 100644 include/exec/plugin-gen.h create mode 100644 include/qemu/plugin-memory.h create mode 100644 include/qemu/plugin.h create mode 100644 include/qemu/qemu-plugin.h create mode 100644 include/user/syscall-trace.h create mode 100644 plugins/.gitignore create mode 100644 plugins/Makefile.objs create mode 100644 plugins/api.c create mode 100644 plugins/core.c create mode 100644 plugins/loader.c create mode 100644 plugins/plugin.h create mode 100644 plugins/qemu-plugins.symbols create mode 100644 tests/plugin/Makefile create mode 100644 tests/plugin/bb.c create mode 100644 tests/plugin/empty.c create mode 100644 tests/plugin/hotblocks.c create mode 100644 tests/plugin/hotpages.c create mode 100644 tests/plugin/howvec.c create mode 100644 tests/plugin/insn.c create mode 100644 tests/plugin/mem.c -- 2.20.1
On Fri, 25 Oct 2019 at 07:37, Alex Bennée <alex.bennee@linaro.org> wrote: > > The following changes since commit 81c1f71eeb874c4cbbb9c5c4d1a1dc0ba7391dff: > > Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2019-10-24 10:43:20 +0100) > > are available in the Git repository at: > > https://github.com/stsquad/qemu.git tags/pull-testing-and-plugins-241019-2 > > for you to fetch changes up to 18900c2d7901680457b51b3ad3f684ef9cba8b64: > > travis.yml: enable linux-gcc-debug-tcg cache (2019-10-24 22:31:29 +0100) > > ---------------------------------------------------------------- > Core TCG plugin support and testing updates > > - TCG plugin support > - netbsd VM autoinstall > - various Travis dependency updates > - enable tcg debug for check-tcg > - additional Xcode build for Cirrus > - dependency tweak for gitlab > This makes the vm-build-netbsd target stop working: looking at the log file it seems to try to do an install, but there's a pkg_add command failure and then it times out because it expects a menu with an 'Enable sshd' option and it isn't there: con recv: >a: Host ftp.NetBSD.org con recv: b: Base directorypub/pkgsrc/packages/NetBSD con recv: c: Package directory/amd64/8.1/All con recv: d: Userftp con recv: e: Password con recv: f: Proxy con recv: g: Additional packages con recv: h: Configure network con recv: i: Quit installing binary pkgs con recv: x: Install pkgin con send: x<enter> con recv: and update package summary a: Host ftp.NetBSD.org>x: Install pkgin and update package summary con recv: Status: RunningCommand: pkg_add http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin con recv: --------------------------------------------------------------------------------pkg_add: Can't process http://ftp.NetBSD.org:80/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin*: Not Found con recv: pkg_add: no pkg found for 'http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin', sorry. con recv: pkg_add: 1 package addition failed con recv: Command failedHit enter to continue con send: <enter> con recv: Enabling binary packages with pkgin requires setting up the repository. The con recv: following are the host, directory, user, and password that will be used. If con recv: "user" is "ftp", then the password is not needed. con recv: con recv: >a: Host ftp.NetBSD.org con recv: b: Base directorypub/pkgsrc/packages/NetBSD con recv: c: Package directory/amd64/8.1/All con recv: d: Userftp con recv: e: Password con recv: f: Proxy con recv: g: Additional packages con recv: h: Configure network con recv: i: Quit installing binary pkgs console: *** read timeout *** console: waiting for: 'g: Enable sshd' console: line buffer: con recv: x: Install pkgin and update package summary Failed to prepare guest environment Traceback (most recent call last): File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 362, in main return vm.build_image(args.image) File "/home/peter.maydell/qemu-netbsd/tests/vm/netbsd", line 173, in build_image self.console_wait_send("g: Enable sshd", "g\n") File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 262, in console_wait_send self.console_wait(wait) File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 224, in console_wait chars = vm.console_socket.recv(1) socket.timeout: timed out I tried a couple of times and it failed the same way both times. thanks -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On Fri, 25 Oct 2019 at 07:37, Alex Bennée <alex.bennee@linaro.org> wrote: >> >> The following changes since commit 81c1f71eeb874c4cbbb9c5c4d1a1dc0ba7391dff: >> >> Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2019-10-24 10:43:20 +0100) >> >> are available in the Git repository at: >> >> https://github.com/stsquad/qemu.git tags/pull-testing-and-plugins-241019-2 >> >> for you to fetch changes up to 18900c2d7901680457b51b3ad3f684ef9cba8b64: >> >> travis.yml: enable linux-gcc-debug-tcg cache (2019-10-24 22:31:29 +0100) >> >> ---------------------------------------------------------------- >> Core TCG plugin support and testing updates >> >> - TCG plugin support >> - netbsd VM autoinstall >> - various Travis dependency updates >> - enable tcg debug for check-tcg >> - additional Xcode build for Cirrus >> - dependency tweak for gitlab >> > > This makes the vm-build-netbsd target stop working: > looking at the log file it seems to try to do an install, > but there's a pkg_add command failure and then it > times out because it expects a menu with an 'Enable sshd' > option and it isn't there: OK I've dropped this (again) and re-sent a testing only PR. I'll resend the remaining plugin stuff on Monday. > > con recv: >a: Host ftp.NetBSD.org > con recv: b: Base directorypub/pkgsrc/packages/NetBSD > con recv: c: Package directory/amd64/8.1/All > con recv: d: Userftp > con recv: e: Password > con recv: f: Proxy > con recv: g: Additional packages > con recv: h: Configure network > con recv: i: Quit installing binary pkgs > con recv: x: Install pkgin > con send: x<enter> > con recv: and update package summary a: Host > ftp.NetBSD.org>x: Install pkgin and update package summary > con recv: Status: RunningCommand: pkg_add > http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin > con recv: --------------------------------------------------------------------------------pkg_add: > Can't process http://ftp.NetBSD.org:80/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin*: > Not Found > con recv: pkg_add: no pkg found for > 'http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/pkgin', > sorry. > con recv: pkg_add: 1 package addition failed > con recv: Command failedHit enter to continue > con send: <enter> > con recv: Enabling binary packages with pkgin requires setting up the > repository. The > con recv: following are the host, directory, user, and password that > will be used. If > con recv: "user" is "ftp", then the password is not needed. > con recv: > con recv: >a: Host ftp.NetBSD.org > con recv: b: Base directorypub/pkgsrc/packages/NetBSD > con recv: c: Package directory/amd64/8.1/All > con recv: d: Userftp > con recv: e: Password > con recv: f: Proxy > con recv: g: Additional packages > con recv: h: Configure network > con recv: i: Quit installing binary pkgs > console: *** read timeout *** > console: waiting for: 'g: Enable sshd' > console: line buffer: > > con recv: x: Install pkgin and update package summary > > Failed to prepare guest environment > Traceback (most recent call last): > File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 362, in main > return vm.build_image(args.image) > File "/home/peter.maydell/qemu-netbsd/tests/vm/netbsd", line 173, in > build_image > self.console_wait_send("g: Enable sshd", "g\n") > File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 262, > in console_wait_send > self.console_wait(wait) > File "/home/peter.maydell/qemu-netbsd/tests/vm/basevm.py", line 224, > in console_wait > chars = vm.console_socket.recv(1) > socket.timeout: timed out > > > I tried a couple of times and it failed the same way both times. > > > thanks > -- PMM -- Alex Bennée
I hate to interfere with the merging of working code for non-technical reasons.... This is a plugin interface. As I wrote in reply to v4, I'd like to see a pragmatic argument why abuse of the plugin interface to circumvent the GPL is not practical. This might include "not a stable interface", "you have to link with a truckload of gpl code", "the set of things you can do is deliberately extremely limited". Perhaps such an argument is made somewhere in these 73 patches already. I admit to not having read them all :) In the TCG plugin design document perhaps? Assuming it exists... I proposed discussing the project's requirements for external interfaces on GPL circumvention deterrence at the QEMU Summit next week. If merging this could be delayed until the licensing ramifications have become a bit more clear, I'd be obliged.
Markus Armbruster <armbru@redhat.com> writes: > I hate to interfere with the merging of working code for non-technical > reasons.... > > This is a plugin interface. As I wrote in reply to v4, I'd like to see > a pragmatic argument why abuse of the plugin interface to circumvent the > GPL is not practical. This might include "not a stable interface", "you > have to link with a truckload of gpl code", "the set of things you can > do is deliberately extremely limited". I included a link to the description in lead patch of the following two revisions posted after v4 for this purpose. To repeat myself: QEMU TCG plugins provide a way for users to run experiments taking advantage of the total system control emulation can have over a guest. It provides a mechanism for plugins to subscribe to events during translation and execution and optionally callback into the plugin during these events. TCG plugins are unable to change the system state only monitor it passively. However they can do this down to an individual instruction granularity including potentially subscribing to all load and store operations. So to summarise it is a deliberately limited set of passive observations that can be made by the plugins. You cannot implement a new device using this interface. > Perhaps such an argument is made somewhere in these 73 patches already. > I admit to not having read them all :) In the TCG plugin design document > perhaps? Assuming it exists... Indeed there is - docs/devel/plugins.rst A high level tour of the design decisions and approaches is the subject of my talk on Friday morning. > I proposed discussing the project's requirements for external interfaces > on GPL circumvention deterrence at the QEMU Summit next week. That should certainly be an agenda item for the summit. I don't think this provides a mechanism for GPL circumnavigation though. > If merging this could be delayed until the licensing ramifications have > become a bit more clear, I'd be obliged. I'd rather not unless we can make an exception for late merging of the PR. I've worked quite hard to make sure everything is ready for the 4.2 window and I'd rather not miss a whole release cycle on a misunderstanding of what these plugins allow. -- Alex Bennée
Alex Bennée <alex.bennee@linaro.org> writes: > Markus Armbruster <armbru@redhat.com> writes: > >> I hate to interfere with the merging of working code for non-technical >> reasons.... >> >> This is a plugin interface. As I wrote in reply to v4, I'd like to see >> a pragmatic argument why abuse of the plugin interface to circumvent the >> GPL is not practical. This might include "not a stable interface", "you >> have to link with a truckload of gpl code", "the set of things you can >> do is deliberately extremely limited". > > I included a link to the description in lead patch of the following two > revisions posted after v4 for this purpose. To repeat myself: If you had cc'ed me, I might have even read it :) > QEMU TCG plugins provide a way for users to run experiments taking > advantage of the total system control emulation can have over a guest. > It provides a mechanism for plugins to subscribe to events during > translation and execution and optionally callback into the plugin > during these events. TCG plugins are unable to change the system state > only monitor it passively. However they can do this down to an > individual instruction granularity including potentially subscribing > to all load and store operations. > > So to summarise it is a deliberately limited set of passive observations > that can be made by the plugins. You cannot implement a new device using > this interface. > >> Perhaps such an argument is made somewhere in these 73 patches already. >> I admit to not having read them all :) In the TCG plugin design document >> perhaps? Assuming it exists... > > Indeed there is - docs/devel/plugins.rst In 21/73. I'll read it as soon as I can. File contents is about *TCG* plugins, file name advertises plugins without a qualifier. We can rename when it bothers us. > A high level tour of the design decisions and approaches is the subject > of my talk on Friday morning. Good move. >> I proposed discussing the project's requirements for external interfaces >> on GPL circumvention deterrence at the QEMU Summit next week. > > That should certainly be an agenda item for the summit. I don't think > this provides a mechanism for GPL circumnavigation though. > >> If merging this could be delayed until the licensing ramifications have >> become a bit more clear, I'd be obliged. > > I'd rather not unless we can make an exception for late merging of the > PR. I've worked quite hard to make sure everything is ready for the 4.2 > window and I'd rather not miss a whole release cycle on a > misunderstanding of what these plugins allow. I think there are multiple ways to avoid the nuclear outcome. Coming to a conclusion before the soft freeze is the nicest one. Making an exception for late merging is another one, but Peter may prefer not to. Yet another one is merging the pull request before the soft freeze with the understanding that it'll be reverted unless we come to a positive conclusion before say -rc0 (Nov 5). I'm confident we can work it out in Lyon.
On Fri, 25 Oct 2019 at 21:24, Markus Armbruster <armbru@redhat.com> wrote: > Alex Bennée <alex.bennee@linaro.org> writes: > > I'd rather not unless we can make an exception for late merging of the > > PR. I've worked quite hard to make sure everything is ready for the 4.2 > > window and I'd rather not miss a whole release cycle on a > > misunderstanding of what these plugins allow. > > I think there are multiple ways to avoid the nuclear outcome. > > Coming to a conclusion before the soft freeze is the nicest one. > > Making an exception for late merging is another one, but Peter may > prefer not to. > > Yet another one is merging the pull request before the soft freeze with > the understanding that it'll be reverted unless we come to a positive > conclusion before say -rc0 (Nov 5). I'm confident we can work it out in > Lyon. I'm happy with any of these (and we have a longstanding rule that as long as a version of the pullreq was on list before soft freeze it's ok to apply before hardfreeze, even if it needed to go through a few versions or was otherwise a bit delayed). In practice, since I'm on holiday Mon/Tues and this hotel wifi is awful it's quite likely that I wouldn't get round to actually processing a pullreq with the TCG plugins in it before we all get a chance to talk face-to-face on Wednesday anyhow :-) Alex: I suggest you send out a pullreq with the plugins stuff (I've just applied your testing pullreq), and then we can make sure it gets over the "passes merge build/tests" hurdle. thanks -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On Fri, 25 Oct 2019 at 21:24, Markus Armbruster <armbru@redhat.com> wrote: >> Alex Bennée <alex.bennee@linaro.org> writes: >> > I'd rather not unless we can make an exception for late merging of the >> > PR. I've worked quite hard to make sure everything is ready for the 4.2 >> > window and I'd rather not miss a whole release cycle on a >> > misunderstanding of what these plugins allow. >> >> I think there are multiple ways to avoid the nuclear outcome. >> >> Coming to a conclusion before the soft freeze is the nicest one. >> >> Making an exception for late merging is another one, but Peter may >> prefer not to. >> >> Yet another one is merging the pull request before the soft freeze with >> the understanding that it'll be reverted unless we come to a positive >> conclusion before say -rc0 (Nov 5). I'm confident we can work it out in >> Lyon. > > I'm happy with any of these (and we have a longstanding rule > that as long as a version of the pullreq was on list before soft > freeze it's ok to apply before hardfreeze, even if it needed to > go through a few versions or was otherwise a bit delayed). > > In practice, since I'm on holiday Mon/Tues and this hotel wifi is > awful it's quite likely that I wouldn't get round to actually processing > a pullreq with the TCG plugins in it before we all get a chance > to talk face-to-face on Wednesday anyhow :-) I do actually have a little bit in my talk about the history of plugins and the worries about GPL circumnavigation in my talk on Friday but that doesn't stop us previewing it on Wednesday ;-) > > Alex: I suggest you send out a pullreq with the plugins stuff > (I've just applied your testing pullreq), and then we can > make sure it gets over the "passes merge build/tests" hurdle. I'll spin a new PR. I split the testing changes (and reverted the netbsd autoinstall patch again) and sent that on Friday. Would it be OK still to base the plugins PR on top of the new testing PR to avoid the conflicts in Travis? > > thanks > -- PMM -- Alex Bennée
Markus Armbruster <armbru@redhat.com> writes: > Alex Bennée <alex.bennee@linaro.org> writes: > >> Markus Armbruster <armbru@redhat.com> writes: >> >>> I hate to interfere with the merging of working code for non-technical >>> reasons.... >>> >>> This is a plugin interface. As I wrote in reply to v4, I'd like to see >>> a pragmatic argument why abuse of the plugin interface to circumvent the >>> GPL is not practical. This might include "not a stable interface", "you >>> have to link with a truckload of gpl code", "the set of things you can >>> do is deliberately extremely limited". [...] >>> If merging this could be delayed until the licensing ramifications have >>> become a bit more clear, I'd be obliged. >> >> I'd rather not unless we can make an exception for late merging of the >> PR. I've worked quite hard to make sure everything is ready for the 4.2 >> window and I'd rather not miss a whole release cycle on a >> misunderstanding of what these plugins allow. > > I think there are multiple ways to avoid the nuclear outcome. > > Coming to a conclusion before the soft freeze is the nicest one. > > Making an exception for late merging is another one, but Peter may > prefer not to. > > Yet another one is merging the pull request before the soft freeze with > the understanding that it'll be reverted unless we come to a positive > conclusion before say -rc0 (Nov 5). I'm confident we can work it out in > Lyon. The series has since been merged, so just for the record: we did. The plugin interface looks useful for its stated purposes, yet pretty useless for GPL circumvention. We'll evolve it deliberately to preserve that property. Alex, thank you for your patience.
On Wed, 6 Nov 2019 at 12:42, Markus Armbruster <armbru@redhat.com> wrote: > > Markus Armbruster <armbru@redhat.com> writes: > > > Alex Bennée <alex.bennee@linaro.org> writes: > > > >> Markus Armbruster <armbru@redhat.com> writes: > >> > >>> I hate to interfere with the merging of working code for non-technical > >>> reasons.... > >>> > >>> This is a plugin interface. As I wrote in reply to v4, I'd like to see > >>> a pragmatic argument why abuse of the plugin interface to circumvent the > >>> GPL is not practical. This might include "not a stable interface", "you > >>> have to link with a truckload of gpl code", "the set of things you can > >>> do is deliberately extremely limited". > [...] > >>> If merging this could be delayed until the licensing ramifications have > >>> become a bit more clear, I'd be obliged. > >> > >> I'd rather not unless we can make an exception for late merging of the > >> PR. I've worked quite hard to make sure everything is ready for the 4.2 > >> window and I'd rather not miss a whole release cycle on a > >> misunderstanding of what these plugins allow. > > > > I think there are multiple ways to avoid the nuclear outcome. > > > > Coming to a conclusion before the soft freeze is the nicest one. > > > > Making an exception for late merging is another one, but Peter may > > prefer not to. > > > > Yet another one is merging the pull request before the soft freeze with > > the understanding that it'll be reverted unless we come to a positive > > conclusion before say -rc0 (Nov 5). I'm confident we can work it out in > > Lyon. > > The series has since been merged, so just for the record: we did. The > plugin interface looks useful for its stated purposes, yet pretty > useless for GPL circumvention. We'll evolve it deliberately to preserve > that property. The one specific thing that did come out of discussions at Lyon was that we'd like to have a basic "check the version" to catch mismatched/out-of-date plugins; Alex has a patch on list for that. thanks -- PMM
Adding debug makes things run a bit slower so lets not hammer all the targets. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index d0b9e099b9c..7d90b87540f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -124,12 +124,13 @@ matrix: - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + # --enable-debug implies --enable-debug-tcg, also runs quite a bit slower - env: - - CONFIG="--enable-debug --enable-debug-tcg --disable-user" + - CONFIG="--enable-debug --target-list=${MAIN_SOFTMMU_TARGETS}" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug" - # TCG debug can be run just on it's own and is mostly agnostic to user/softmmu distinctions + # TCG debug can be run just on its own and is mostly agnostic to user/softmmu distinctions - env: - CONFIG="--enable-debug-tcg --disable-system" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug" -- 2.20.1
From: Thomas Huth <thuth@redhat.com> This library is needed to compile the VDE network backend. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20191009170701.14756-2-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index 7d90b87540f..7be2a9949f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ addons: - libssh-dev - liburcu-dev - libusb-1.0-0-dev + - libvdeplug-dev - libvte-2.91-dev - sparse - uuid-dev -- 2.20.1
From: Thomas Huth <thuth@redhat.com> We've removed support for SDL 1.2 quite a while ago already, so let's use SDL 2 now in Travis to get test coverage for SDL again. And while we're at it, also add libsdl2-image-dev which can be used by QEMU nowadays, too. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20191009170701.14756-3-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.travis.yml b/.travis.yml index 7be2a9949f5..b446e04e8ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,8 @@ addons: - libpixman-1-dev - libpng12-dev - librados-dev - - libsdl1.2-dev + - libsdl2-dev + - libsdl2-image-dev - libseccomp-dev - libspice-protocol-dev - libspice-server-dev @@ -309,7 +310,8 @@ matrix: - libpixman-1-dev - libpng12-dev - librados-dev - - libsdl1.2-dev + - libsdl2-dev + - libsdl2-image-dev - libseccomp-dev - libspice-protocol-dev - libspice-server-dev -- 2.20.1
From: Thomas Huth <thuth@redhat.com> libgnutls-dev and libpng12-dev are not available in newer versions of Ubuntu anymore, so installing these packages fails e.g. in the new arm64 containers on Travis. Let's use newer versions of these packages by default instead. (The old versions still get tested in the "gcc-9" build). Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20191009170701.14756-4-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.travis.yml b/.travis.yml index b446e04e8ae..e65e53f3d7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ addons: - libcap-dev - libcap-ng-dev - libgcc-4.8-dev - - libgnutls-dev + - libgnutls28-dev - libgtk-3-dev - libiscsi-dev - liblttng-ust-dev @@ -37,7 +37,7 @@ addons: - libnfs-dev - libnss3-dev - libpixman-1-dev - - libpng12-dev + - libpng-dev - librados-dev - libsdl2-dev - libsdl2-image-dev -- 2.20.1
From: Thomas Huth <thuth@redhat.com> The "command -v ccache && ccache ..." likely were supposed to test the availability of ccache before running the program. But this shell construct causes Travis to abort if ccache is not available. Use an if-statement instead to fix this problem. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191009170701.14756-5-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.travis.yml b/.travis.yml index e65e53f3d7e..7e0d4ad2b31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,13 +91,13 @@ git: before_script: - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi - - command -v ccache && ccache --zero-stats + - if command -v ccache ; then ccache --zero-stats ; fi - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; } script: - make -j3 && travis_retry ${TEST_CMD} after_script: - - command -v ccache && ccache --show-stats + - if command -v ccache ; then ccache --show-stats ; fi matrix: -- 2.20.1
From: Philippe Mathieu-Daudé <philmd@redhat.com> Add a job to generate the release tarball and build/install few QEMU targets from it. Ideally we should build the 'efi' target from the 'roms' directory, but it is too time consuming. This job is only triggered when a tag starting with 'v' is pushed, which is the case with release candidate tags. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191007160450.3619-1-philmd@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.travis.yml b/.travis.yml index 7e0d4ad2b31..f2b679fe701 100644 --- a/.travis.yml +++ b/.travis.yml @@ -343,3 +343,26 @@ matrix: - CONFIG="--target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" - TEST_CMD="make -j3 check-tcg V=1" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + + + # Release builds + # The make-release script expect a QEMU version, so our tag must start with a 'v'. + # This is the case when release candidate tags are created. + - if: tag IS present AND tag =~ /^v\d+\.\d+(\.\d+)?(-\S*)?$/ + env: + # We want to build from the release tarball + - BUILD_DIR="release/build/dir" SRC_DIR="../../.." + - BASE_CONFIG="--prefix=$PWD/dist" + - CONFIG="--target-list=x86_64-softmmu,aarch64-softmmu,armeb-linux-user,ppc-linux-user" + - TEST_CMD="make install -j3" + - QEMU_VERSION="${TRAVIS_TAG:1}" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + before_script: + - command -v ccache && ccache --zero-stats + - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR} + script: + - make -C ${SRC_DIR} qemu-${QEMU_VERSION}.tar.bz2 + - ls -l ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2 + - tar -xf ${SRC_DIR}/qemu-${QEMU_VERSION}.tar.bz2 && cd qemu-${QEMU_VERSION} + - ./configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; } + - make install -- 2.20.1
According to: https://docs.travis-ci.com/user/reference/osx/#macos-version we have 10.3 available so lets use it. I don't know what Apple's deprecation policy is for Xcode because it requires an AppleID to find out. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index f2b679fe701..da6a2063fca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -247,7 +247,7 @@ matrix: - env: - CONFIG="--target-list=i386-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,x86_64-softmmu" os: osx - osx_image: xcode10.2 + osx_image: xcode10.3 compiler: clang -- 2.20.1
CirrusCI provides a mojave-xcode alias for the latest Xcode available. Let's use it to make sure we track the latest releases. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.cirrus.yml b/.cirrus.yml index 8326a3a4b16..27efc48619b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -25,3 +25,14 @@ macos_task: - ./configure --python=/usr/local/bin/python3 || { cat config.log; exit 1; } - gmake -j$(sysctl -n hw.ncpu) - gmake check -j$(sysctl -n hw.ncpu) + +macos_xcode_task: + osx_instance: + # this is an alias for the latest Xcode + image: mojave-xcode + install_script: + - brew install pkg-config gnu-sed glib pixman make sdl2 + script: + - ./configure --cc=clang || { cat config.log; exit 1; } + - gmake -j$(sysctl -n hw.ncpu) + - gmake check -j$(sysctl -n hw.ncpu) -- 2.20.1
From: Eduardo Habkost <ehabkost@redhat.com> The mechanism will be used to work around issues related to IPv6 on the netbsd image builder. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191018181705.17957-3-ehabkost@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 4921e47f9f2..59bd1d31fbe 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -57,6 +57,8 @@ class BaseVM(object): arch = "#arch" # command to halt the guest, can be overridden by subclasses poweroff = "poweroff" + # enable IPv6 networking + ipv6 = True def __init__(self, debug=False, vcpus=None): self._guest = None self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-", @@ -81,7 +83,8 @@ class BaseVM(object): self._args = [ \ "-nodefaults", "-m", "4G", "-cpu", "max", - "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22", + "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22" + + (",ipv6=no" if not self.ipv6 else ""), "-device", "virtio-net-pci,netdev=vnet", "-vnc", "127.0.0.1:0,to=20"] if vcpus and vcpus > 1: -- 2.20.1
From: Eduardo Habkost <ehabkost@redhat.com> Workaround for issues when the host has no IPv6 connectivity. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20191018181705.17957-4-ehabkost@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/tests/vm/netbsd b/tests/vm/netbsd index 9558a672efa..d4dd1929f2d 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -63,6 +63,13 @@ class NetBSDVM(basevm.BaseVM): """ poweroff = "/sbin/poweroff" + # Workaround for NetBSD + IPv6 + slirp issues. + # NetBSD seems to ignore the ICMPv6 Destination Unreachable + # messages generated by slirp. When the host has no IPv6 + # connectivity, this causes every connection to ftp.NetBSD.org + # take more than a minute to be established. + ipv6 = False + def build_image(self, img): cimg = self._download_with_cache(self.link, sha512sum=self.csum) img_tmp = img + ".tmp" -- 2.20.1
Hopefully we'll see the same benefits as the other builds. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index da6a2063fca..c43597f1331 100644 --- a/.travis.yml +++ b/.travis.yml @@ -189,6 +189,7 @@ matrix: - env: - CONFIG="--target-list=${MAIN_SOFTMMU_TARGETS} " + - CACHE_NAME="${TRAVIS_BRANCH}-linux-clang-sanitize" compiler: clang before_script: - ./configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log && exit 1; } -- 2.20.1
From: Thomas Huth <thuth@redhat.com> The libvdeplug-dev package is required to compile-test net/vde.c. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <20191016131002.29663-1-thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed8067f5cf9..be57c6a454a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ before_script: build-system1: script: - apt-get install -y -qq libgtk-3-dev libvte-dev nettle-dev libcacard-dev - libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev + libusb-dev libvde-dev libspice-protocol-dev libgl1-mesa-dev libvdeplug-dev - ./configure --enable-werror --target-list="aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu lm32-softmmu moxie-softmmu microblazeel-softmmu mips64el-softmmu m68k-softmmu ppc-softmmu riscv64-softmmu sparc-softmmu" -- 2.20.1
This adds a whole bunch of asserts which will catch bugs you might introduce into the TCG code. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index c43597f1331..ba3a8d4cfc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -334,14 +334,14 @@ matrix: # Run check-tcg against linux-user - env: - - CONFIG="--disable-system" + - CONFIG="--disable-system --enable-debug-tcg" - TEST_CMD="make -j3 check-tcg V=1" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" # Run check-tcg against softmmu targets - env: - - CONFIG="--target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" + - CONFIG="--enable-debug-tcg --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" - TEST_CMD="make -j3 check-tcg V=1" - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" -- 2.20.1
This isn't the latest one available on hub.docker.com but it does match the ID reported by the Xenial builds running on Travis: instance: ... travis-ci-sardonyx-xenial-1553530528-f909ac5 Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/tests/docker/dockerfiles/travis.docker b/tests/docker/dockerfiles/travis.docker index ea14da29d97..e8eb48dccfd 100644 --- a/tests/docker/dockerfiles/travis.docker +++ b/tests/docker/dockerfiles/travis.docker @@ -1,4 +1,8 @@ -FROM travisci/ci-sardonyx:packer-1546978056-2c98a19 +# +# Travis Image - this is broadly the same image that we run our CI +# tests on. +# +FROM travisci/ci-sardonyx:packer-1552557266-f909ac5 ENV DEBIAN_FRONTEND noninteractive ENV LANG en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> tb_flush will be called by the plugin module from a safe work environment. Prepare for that. Suggested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 66d4bc4341a..0a08fcda3e8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1268,8 +1268,13 @@ void tb_flush(CPUState *cpu) { if (tcg_enabled()) { unsigned tb_flush_count = atomic_mb_read(&tb_ctx.tb_flush_count); - async_safe_run_on_cpu(cpu, do_tb_flush, - RUN_ON_CPU_HOST_INT(tb_flush_count)); + + if (cpu_in_exclusive_context(cpu)) { + do_tb_flush(cpu, RUN_ON_CPU_HOST_INT(tb_flush_count)); + } else { + async_safe_run_on_cpu(cpu, do_tb_flush, + RUN_ON_CPU_HOST_INT(tb_flush_count)); + } } } -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Add the API first to ease review. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h new file mode 100644 index 00000000000..d9c1ca3b4cf --- /dev/null +++ b/include/qemu/qemu-plugin.h @@ -0,0 +1,351 @@ +/* + * Copyright (C) 2017, Emilio G. Cota <cota@braap.org> + * Copyright (C) 2019, Linaro + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef QEMU_PLUGIN_API_H +#define QEMU_PLUGIN_API_H + +#include <inttypes.h> +#include <stdbool.h> + +/* + * For best performance, build the plugin with -fvisibility=hidden so that + * QEMU_PLUGIN_LOCAL is implicit. Then, just mark qemu_plugin_install with + * QEMU_PLUGIN_EXPORT. For more info, see + * https://gcc.gnu.org/wiki/Visibility + */ +#if defined _WIN32 || defined __CYGWIN__ + #ifdef BUILDING_DLL + #define QEMU_PLUGIN_EXPORT __declspec(dllexport) + #else + #define QEMU_PLUGIN_EXPORT __declspec(dllimport) + #endif + #define QEMU_PLUGIN_LOCAL +#else + #if __GNUC__ >= 4 + #define QEMU_PLUGIN_EXPORT __attribute__((visibility("default"))) + #define QEMU_PLUGIN_LOCAL __attribute__((visibility("hidden"))) + #else + #define QEMU_PLUGIN_EXPORT + #define QEMU_PLUGIN_LOCAL + #endif +#endif + +typedef uint64_t qemu_plugin_id_t; + +/** + * qemu_plugin_install() - Install a plugin + * @id: this plugin's opaque ID + * @argc: number of arguments + * @argv: array of arguments (@argc elements) + * + * All plugins must export this symbol. + * + * Note: Calling qemu_plugin_uninstall() from this function is a bug. To raise + * an error during install, return !0. + * + * Note: @argv remains valid throughout the lifetime of the loaded plugin. + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, int argc, + char **argv); + +/* + * Prototypes for the various callback styles we will be registering + * in the following functions. + */ +typedef void (*qemu_plugin_simple_cb_t)(qemu_plugin_id_t id); + +typedef void (*qemu_plugin_udata_cb_t)(qemu_plugin_id_t id, void *userdata); + +typedef void (*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id, + unsigned int vcpu_index); + +typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index, + void *userdata); + +/** + * qemu_plugin_uninstall() - Uninstall a plugin + * @id: this plugin's opaque ID + * @cb: callback to be called once the plugin has been removed + * + * Do NOT assume that the plugin has been uninstalled once this function + * returns. Plugins are uninstalled asynchronously, and therefore the given + * plugin receives callbacks until @cb is called. + * + * Note: Calling this function from qemu_plugin_install() is a bug. + */ +void qemu_plugin_uninstall(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb); + +/** + * qemu_plugin_reset() - Reset a plugin + * @id: this plugin's opaque ID + * @cb: callback to be called once the plugin has been reset + * + * Unregisters all callbacks for the plugin given by @id. + * + * Do NOT assume that the plugin has been reset once this function returns. + * Plugins are reset asynchronously, and therefore the given plugin receives + * callbacks until @cb is called. + */ +void qemu_plugin_reset(qemu_plugin_id_t id, qemu_plugin_simple_cb_t cb); + +/** + * qemu_plugin_register_vcpu_init_cb() - register a vCPU initialization callback + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called every time a vCPU is initialized. + * + * See also: qemu_plugin_register_vcpu_exit_cb() + */ +void qemu_plugin_register_vcpu_init_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_simple_cb_t cb); + +/** + * qemu_plugin_register_vcpu_exit_cb() - register a vCPU exit callback + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called every time a vCPU exits. + * + * See also: qemu_plugin_register_vcpu_init_cb() + */ +void qemu_plugin_register_vcpu_exit_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_simple_cb_t cb); + +/** + * qemu_plugin_register_vcpu_idle_cb() - register a vCPU idle callback + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called every time a vCPU idles. + */ +void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_simple_cb_t cb); + +/** + * qemu_plugin_register_vcpu_resume_cb() - register a vCPU resume callback + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called every time a vCPU resumes execution. + */ +void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_simple_cb_t cb); + +/* + * Opaque types that the plugin is given during the translation and + * instrumentation phase. + */ +struct qemu_plugin_tb; +struct qemu_plugin_insn; + +enum qemu_plugin_cb_flags { + QEMU_PLUGIN_CB_NO_REGS, /* callback does not access the CPU's regs */ + QEMU_PLUGIN_CB_R_REGS, /* callback reads the CPU's regs */ + QEMU_PLUGIN_CB_RW_REGS, /* callback reads and writes the CPU's regs */ +}; + +enum qemu_plugin_mem_rw { + QEMU_PLUGIN_MEM_R = 1, + QEMU_PLUGIN_MEM_W, + QEMU_PLUGIN_MEM_RW, +}; + +/** + * qemu_plugin_register_vcpu_tb_trans_cb() - register a translate cb + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called every time a translation occurs. The @cb + * function is passed an opaque qemu_plugin_type which it can query + * for additional information including the list of translated + * instructions. At this point the plugin can register further + * callbacks to be triggered when the block or individual instruction + * executes. + */ +typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id, + struct qemu_plugin_tb *tb); + +void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_tb_trans_cb_t cb); + +/** + * qemu_plugin_register_vcpu_tb_trans_exec_cb() - register execution callback + * @tb: the opaque qemu_plugin_tb handle for the translation + * @cb: callback function + * @flags: does the plugin read or write the CPU's registers? + * @userdata: any plugin data to pass to the @cb? + * + * The @cb function is called every time a translated unit executes. + */ +void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, + qemu_plugin_vcpu_udata_cb_t cb, + enum qemu_plugin_cb_flags flags, + void *userdata); + +enum qemu_plugin_op { + QEMU_PLUGIN_INLINE_ADD_U64, +}; + +/** + * qemu_plugin_register_vcpu_tb_trans_exec_inline() - execution inline op + * @tb: the opaque qemu_plugin_tb handle for the translation + * @op: the type of qemu_plugin_op (e.g. ADD_U64) + * @ptr: the target memory location for the op + * @imm: the op data (e.g. 1) + * + * Insert an inline op to every time a translated unit executes. + * Useful if you just want to increment a single counter somewhere in + * memory. + */ +void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb, + enum qemu_plugin_op op, + void *ptr, uint64_t imm); + +/** + * qemu_plugin_register_vcpu_insn_exec_cb() - register insn execution cb + * @insn: the opaque qemu_plugin_insn handle for an instruction + * @cb: callback function + * @flags: does the plugin read or write the CPU's registers? + * @userdata: any plugin data to pass to the @cb? + * + * The @cb function is called every time an instruction is executed + */ +void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, + qemu_plugin_vcpu_udata_cb_t cb, + enum qemu_plugin_cb_flags flags, + void *userdata); + +/** + * qemu_plugin_register_vcpu_insn_exec_inline() - insn execution inline op + * @insn: the opaque qemu_plugin_insn handle for an instruction + * @cb: callback function + * @op: the type of qemu_plugin_op (e.g. ADD_U64) + * @ptr: the target memory location for the op + * @imm: the op data (e.g. 1) + * + * Insert an inline op to every time an instruction executes. Useful + * if you just want to increment a single counter somewhere in memory. + */ +void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn, + enum qemu_plugin_op op, + void *ptr, uint64_t imm); + +/* + * Helpers to query information about the instructions in a block + */ +size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb); + +uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb); + +struct qemu_plugin_insn * +qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx); + +const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn); + +size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn); + +uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); +void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); + +/* + * Memory Instrumentation + * + * The anonymous qemu_plugin_meminfo_t and qemu_plugin_hwaddr types + * can be used in queries to QEMU to get more information about a + * given memory access. + */ +typedef uint32_t qemu_plugin_meminfo_t; +struct qemu_plugin_hwaddr; + +/* meminfo queries */ +unsigned int qemu_plugin_mem_size_shift(qemu_plugin_meminfo_t info); +bool qemu_plugin_mem_is_sign_extended(qemu_plugin_meminfo_t info); +bool qemu_plugin_mem_is_big_endian(qemu_plugin_meminfo_t info); +bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info); + +/* + * qemu_plugin_get_hwaddr(): + * @vaddr: the virtual address of the memory operation + * + * For system emulation returns a qemu_plugin_hwaddr handle to query + * details about the actual physical address backing the virtual + * address. For linux-user guests it just returns NULL. + * + * This handle is *only* valid for the duration of the callback. Any + * information about the handle should be recovered before the + * callback returns. + */ +struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info, + uint64_t vaddr); + +bool qemu_plugin_hwaddr_is_io(struct qemu_plugin_hwaddr *hwaddr); +uint64_t qemu_plugin_hwaddr_to_raddr(const struct qemu_plugin_hwaddr *haddr); + +typedef void +(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, + qemu_plugin_meminfo_t info, uint64_t vaddr, + void *userdata); + +void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, + qemu_plugin_vcpu_mem_cb_t cb, + enum qemu_plugin_cb_flags flags, + enum qemu_plugin_mem_rw rw, + void *userdata); + +void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, + enum qemu_plugin_mem_rw rw, + enum qemu_plugin_op op, void *ptr, + uint64_t imm); + + + +typedef void +(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index, + int64_t num, uint64_t a1, uint64_t a2, + uint64_t a3, uint64_t a4, uint64_t a5, + uint64_t a6, uint64_t a7, uint64_t a8); + +void qemu_plugin_register_vcpu_syscall_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_syscall_cb_t cb); + +typedef void +(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_idx, + int64_t num, int64_t ret); + +void +qemu_plugin_register_vcpu_syscall_ret_cb(qemu_plugin_id_t id, + qemu_plugin_vcpu_syscall_ret_cb_t cb); + + +/** + * qemu_plugin_vcpu_for_each() - iterate over the existing vCPU + * @id: plugin ID + * @cb: callback function + * + * The @cb function is called once for each existing vCPU. + * + * See also: qemu_plugin_register_vcpu_init_cb() + */ +void qemu_plugin_vcpu_for_each(qemu_plugin_id_t id, + qemu_plugin_vcpu_simple_cb_t cb); + +void qemu_plugin_register_flush_cb(qemu_plugin_id_t id, + qemu_plugin_simple_cb_t cb); + +void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, + qemu_plugin_udata_cb_t cb, void *userdata); + +/* returns -1 in user-mode */ +int qemu_plugin_n_vcpus(void); + +/* returns -1 in user-mode */ +int qemu_plugin_n_max_vcpus(void); + +#endif /* QEMU_PLUGIN_API_H */ -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> This is faster than removing elements one by one. Will gain a user soon. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 73bf4a984d8..4764d93ea3f 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -420,6 +420,16 @@ union { \ (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) +/* remove @left, @right and all elements in between from @head */ +#define QTAILQ_REMOVE_SEVERAL(head, left, right, field) do { \ + if (((right)->field.tqe_next) != NULL) \ + (right)->field.tqe_next->field.tqe_circ.tql_prev = \ + (left)->field.tqe_circ.tql_prev; \ + else \ + (head)->tqh_circ.tql_prev = (left)->field.tqe_circ.tql_prev; \ + (left)->field.tqe_circ.tql_prev->tql_next = (right)->field.tqe_next; \ + } while (/*CONSTCOND*/0) + #define QTAILQ_FOREACH(var, head, field) \ for ((var) = ((head)->tqh_first); \ (var); \ -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Suggested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 04795c49bf4..e4206cb1735 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -504,7 +504,15 @@ void mmap_lock(void); void mmap_unlock(void); bool have_mmap_lock(void); -static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) +/** + * get_page_addr_code() - user-mode version + * @env: CPUArchState + * @addr: guest virtual address of guest code + * + * Returns @addr. + */ +static inline tb_page_addr_t get_page_addr_code(CPUArchState *env, + target_ulong addr) { return addr; } @@ -512,8 +520,18 @@ static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong static inline void mmap_lock(void) {} static inline void mmap_unlock(void) {} -/* cputlb.c */ -tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr); +/** + * get_page_addr_code() - full-system version + * @env: CPUArchState + * @addr: guest virtual address of guest code + * + * If we cannot translate and execute from the entire RAM page, or if + * the region is not backed by RAM, returns -1. Otherwise, returns the + * ram_addr_t corresponding to the guest code at @addr. + * + * Note: this function can trigger an exception. + */ +tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr); void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); void tlb_set_dirty(CPUState *cpu, target_ulong vaddr); -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Will gain a user soon. Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index e9cf172762e..7c778f96f3b 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -1249,6 +1249,11 @@ static inline void tcg_gen_ld_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o) glue(tcg_gen_ld_,PTR)((NAT)r, a, o); } +static inline void tcg_gen_st_ptr(TCGv_ptr r, TCGv_ptr a, intptr_t o) +{ + glue(tcg_gen_st_, PTR)((NAT)r, a, o); +} + static inline void tcg_gen_discard_ptr(TCGv_ptr a) { glue(tcg_gen_discard_,PTR)((NAT)a); -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Plugins might allocate per-TB data that then they get passed each time a TB is executed (via the *userdata pointer). Notify plugin code every time a code cache flush occurs, so that plugins can then reclaim the memory of the per-TB data. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 0a08fcda3e8..6d1b0ecd69f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1231,6 +1231,8 @@ static gboolean tb_host_size_iter(gpointer key, gpointer value, gpointer data) /* flush all the translation blocks */ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) { + bool did_flush = false; + mmap_lock(); /* If it is already been done on request of another CPU, * just retry. @@ -1238,6 +1240,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) if (tb_ctx.tb_flush_count != tb_flush_count.host_int) { goto done; } + did_flush = true; if (DEBUG_TB_FLUSH_GATE) { size_t nb_tbs = tcg_nb_tbs(); @@ -1262,6 +1265,9 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) done: mmap_unlock(); + if (did_flush) { + qemu_plugin_flush_cb(); + } } void tb_flush(CPUState *cpu) -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> By adding it to plugin-gen's header file, we can export is as an inline, since tcg.h is included in the header (we need tcg_ctx). Signed-off-by: Emilio G. Cota <cota@braap.org> [AJB: use g_byte_array] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index de519883b16..4834a9e2f40 100644 --- a/include/exec/plugin-gen.h +++ b/include/exec/plugin-gen.h @@ -27,6 +27,17 @@ void plugin_gen_insn_end(void); void plugin_gen_disable_mem_helpers(void); void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info); +static inline void plugin_insn_append(const void *from, size_t size) +{ + struct qemu_plugin_insn *insn = tcg_ctx->plugin_insn; + + if (insn == NULL) { + return; + } + + insn->data = g_byte_array_append(insn->data, from, size); +} + #else /* !CONFIG_PLUGIN */ static inline @@ -51,6 +62,9 @@ static inline void plugin_gen_disable_mem_helpers(void) static inline void plugin_gen_empty_mem_callback(TCGv addr, uint32_t info) { } +static inline void plugin_insn_append(const void *from, size_t size) +{ } + #endif /* CONFIG_PLUGIN */ #endif /* QEMU_PLUGIN_GEN_H */ -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Now the arm_ld*_code functions are only used at translate time we can just pass down to translator_ld functions. Signed-off-by: Emilio G. Cota <cota@braap.org> [AJB: convert from plugin_insn_append to translator_ld] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/target/arm/arm_ldst.h b/target/arm/arm_ldst.h index 5e0ac8bef06..45edb108f6a 100644 --- a/target/arm/arm_ldst.h +++ b/target/arm/arm_ldst.h @@ -20,25 +20,20 @@ #ifndef ARM_LDST_H #define ARM_LDST_H -#include "exec/cpu_ldst.h" +#include "exec/translator.h" #include "qemu/bswap.h" /* Load an instruction and return it in the standard little-endian order */ static inline uint32_t arm_ldl_code(CPUARMState *env, target_ulong addr, bool sctlr_b) { - uint32_t insn = cpu_ldl_code(env, addr); - if (bswap_code(sctlr_b)) { - return bswap32(insn); - } - return insn; + return translator_ldl_swap(env, addr, bswap_code(sctlr_b)); } /* Ditto, for a halfword (Thumb) instruction */ static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr, bool sctlr_b) { - uint16_t insn; #ifndef CONFIG_USER_ONLY /* In big-endian (BE32) mode, adjacent Thumb instructions have been swapped within each word. Undo that now. */ @@ -46,11 +41,7 @@ static inline uint16_t arm_lduw_code(CPUARMState *env, target_ulong addr, addr ^= 2; } #endif - insn = cpu_lduw_code(env, addr); - if (bswap_code(sctlr_b)) { - return bswap16(insn); - } - return insn; + return translator_lduw_swap(env, addr, bswap_code(sctlr_b)); } #endif -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/ppc/translate.c b/target/ppc/translate.c index adb8fd516f1..f5fe5d06118 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -7853,11 +7853,9 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) LOG_DISAS("nip=" TARGET_FMT_lx " super=%d ir=%d\n", ctx->base.pc_next, ctx->mem_idx, (int)msr_ir); - if (unlikely(need_byteswap(ctx))) { - ctx->opcode = bswap32(cpu_ldl_code(env, ctx->base.pc_next)); - } else { - ctx->opcode = cpu_ldl_code(env, ctx->base.pc_next); - } + ctx->opcode = translator_ldl_swap(env, ctx->base.pc_next, + need_byteswap(ctx)); + LOG_DISAS("translate opcode %08x (%02x %02x %02x %02x) (%s)\n", ctx->opcode, opc1(ctx->opcode), opc2(ctx->opcode), opc3(ctx->opcode), opc4(ctx->opcode), -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> There is a small wrinkle with the gUSA instruction. The translator effectively treats a (known) gUSA sequence as a single instruction. For the purposes of the plugin we end up with a long multi-instruction qemu_plugin_insn. If the known sequence isn't detected we shall never run this translation anyway. Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 5a7d8c45355..922785e225e 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -1917,7 +1917,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env) /* Read all of the insns for the region. */ for (i = 0; i < max_insns; ++i) { - insns[i] = cpu_lduw_code(env, pc + i * 2); + insns[i] = translator_lduw(env, pc + i * 2); } ld_adr = ld_dst = ld_mop = -1; @@ -2332,7 +2332,7 @@ static void sh4_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) } #endif - ctx->opcode = cpu_lduw_code(env, ctx->base.pc_next); + ctx->opcode = translator_lduw(env, ctx->base.pc_next); decode_opc(ctx); ctx->base.pc_next += 2; } -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/i386/translate.c b/target/i386/translate.c index 868b0acafe8..77e932d8276 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -1925,28 +1925,28 @@ static uint64_t advance_pc(CPUX86State *env, DisasContext *s, int num_bytes) static inline uint8_t x86_ldub_code(CPUX86State *env, DisasContext *s) { - return cpu_ldub_code(env, advance_pc(env, s, 1)); + return translator_ldub(env, advance_pc(env, s, 1)); } static inline int16_t x86_ldsw_code(CPUX86State *env, DisasContext *s) { - return cpu_ldsw_code(env, advance_pc(env, s, 2)); + return translator_ldsw(env, advance_pc(env, s, 2)); } static inline uint16_t x86_lduw_code(CPUX86State *env, DisasContext *s) { - return cpu_lduw_code(env, advance_pc(env, s, 2)); + return translator_lduw(env, advance_pc(env, s, 2)); } static inline uint32_t x86_ldl_code(CPUX86State *env, DisasContext *s) { - return cpu_ldl_code(env, advance_pc(env, s, 4)); + return translator_ldl(env, advance_pc(env, s, 4)); } #ifdef TARGET_X86_64 static inline uint64_t x86_ldq_code(CPUX86State *env, DisasContext *s) { - return cpu_ldq_code(env, advance_pc(env, s, 8)); + return translator_ldq(env, advance_pc(env, s, 8)); } #endif -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/hppa/translate.c b/target/hppa/translate.c index c1b2822f605..2f8d407a82b 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -4221,7 +4221,7 @@ static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { /* Always fetch the insn, even if nullified, so that we check the page permissions for execute. */ - uint32_t insn = cpu_ldl_code(env, ctx->base.pc_next); + uint32_t insn = translator_ldl(env, ctx->base.pc_next); /* Set up the IA queue for the next insn. This will be overwritten by a branch. */ -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 24c1dd3408a..fcdb7bc8e4e 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -384,7 +384,7 @@ static TCGv gen_ldst(DisasContext *s, int opsize, TCGv addr, TCGv val, static inline uint16_t read_im16(CPUM68KState *env, DisasContext *s) { uint16_t im; - im = cpu_lduw_code(env, s->pc); + im = translator_lduw(env, s->pc); s->pc += 2; return im; } -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/alpha/translate.c b/target/alpha/translate.c index a69f58bf658..f7f1ed0f411 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -2987,7 +2987,7 @@ static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *ctx = container_of(dcbase, DisasContext, base); CPUAlphaState *env = cpu->env_ptr; - uint32_t insn = cpu_ldl_code(env, ctx->base.pc_next); + uint32_t insn = translator_ldl(env, ctx->base.pc_next); ctx->base.pc_next += 4; ctx->base.is_jmp = translate_one(ctx, insn); -- 2.20.1
Hi, I'm experiencing several issues related to sound using usb-audio when running qemu-system-ppc in Linux and Windows. Guests tried are Mac OS 9.2 and Mac OS X 10.0, 10.1, 10.2 and 10.3. (10.4 and 10.5 never have the usb-audio device available for audio playback, even though the device is recognised in the OS X system profiler.) It is hit and miss whether the audio device is actually available upon boot in 9.2 and the other versions of OS X. Qemu version tried is current master (Oct 25th), Windows version is cross-compiled from Fedora 30. I do not think there is any regression going on here, these are just issues that have been present for a long time. General issue: when audio is played, it almost always sounds crackling. For reasons of size, I uploaded 3 logs obtained in Linux running Mac OS X 10.3 with -trace "usb*" to: https://surfdrive.surf.nl/files/index.php/s/YfVVxEE3cHXkFPf/download 1. Log_no_audio_available.txt 2. Log_audio_available_2_sounds_played.txt 3. Log_audio_available_multi_sounds_played_untill_hangup.txt General issue in Linux (fedora 30)(which seems related to bug https://bugs.launchpad.net/qemu/+bug/1623998): [hsp@fedora30 qemu-master]$ ./startqemu.sh pulseaudio: set_sink_input_volume() failed pulseaudio: Reason: Invalid argument pulseaudio: set_sink_input_mute() failed pulseaudio: Reason: Invalid argument General issue in Windows 10: I always get to a point where this is logged: dsound: Could not lock playback buffer dsound: Reason: An invalid parameter was passed to the returning function dsound: Failed to lock buffer Linux specific. Qemu invocation for Mac OS 9.2: ./qemu-system-ppc -L pc-bios -boot c -M mac99 -m 512 \ -drive file=~/Mac-disks/9.2.img,format=raw,media=disk \ -serial stdio -sdl -device usb-audio -trace "*aud*" This immediately starts logging: 7380@1571817102.833929:audio_timer_start interval 10 ms 7380@1571817125.207880:audio_timer_delayed interval 16 ms 7380@1571817129.046816:audio_timer_delayed interval 16 ms Any movement of a window on the Linux desktop results in additional audio_timer_delayed logging. The audio_timer_delayed never stops. In Mac OS 9.2, the desktop icons disappear after some seconds of running, so the system cannot be stopped normally. Running the GTK GUI, only this is logged (no additional logging when moving windows). 14130@1571988483.402017:audio_timer_start interval 10 ms But the icons on the desktop also disappear. When running Mac OS X 10.X and clicking some system sounds, I see: 12134@1571818709.446031:audio_timer_start interval 10 ms 12134@1571818710.195023:audio_timer_stop 12134@1571818714.951030:audio_timer_start interval 10 ms 12134@1571818715.432959:audio_timer_stop 12134@1571818717.171045:audio_timer_start interval 10 ms 12134@1571818717.714323:audio_timer_stop 12134@1571818718.072381:audio_timer_start interval 10 ms 12134@1571818719.114544:audio_timer_stop After randomly clicking some system sounds more, the timer starts delaying and no longer stops: 12134@1571818893.564793:audio_timer_stop 12134@1571818895.698040:audio_timer_start interval 10 ms 12134@1571818899.961673:audio_timer_delayed interval 15 ms 12134@1571818900.472716:audio_timer_delayed interval 15 ms 12134@1571818902.759007:audio_timer_delayed interval 15 ms 12134@1571818905.803400:audio_timer_delayed interval 15 ms But the systems stays responsive, so can be shut down. Windows specific. Invocation: qemu-system-ppc.exe -L pc-bios -boot c -M mac99 -m 512 ^ -drive file=C:\Mac-disks\9.2.img,format=raw,media=disk ^ -serial stdio -sdl -device usb-audio -trace "*aud*" This immediately starts logging the audio_timer_start interval and never stops. Icons disappear from the desktop after some seconds. When running Mac OS X 10.X, playing just two system sounds results in: 2380@1571822566.040790:audio_timer_start interval 10 ms 2380@1571822566.108279:audio_timer_delayed interval 22 ms 2380@1571822566.128820:audio_timer_delayed interval 20 ms 2380@1571822566.150509:audio_timer_delayed interval 22 ms 2380@1571822566.172112:audio_timer_delayed interval 21 ms ...... 2380@1571822566.561345:audio_timer_delayed interval 21 ms 2380@1571822566.583846:audio_timer_delayed interval 22 ms 2380@1571822566.600482:audio_timer_delayed interval 15 ms 2380@1571822566.610111:audio_timer_stop 2380@1571822572.226433:audio_timer_start interval 10 ms 2380@1571822572.250866:audio_timer_delayed interval 24 ms 2380@1571822572.269819:audio_timer_delayed interval 18 ms ...... 2380@1571822572.452403:audio_timer_delayed interval 20 ms 2380@1571822572.474190:audio_timer_delayed interval 21 ms 2380@1571822572.509474:audio_timer_delayed interval 35 ms dsound: Could not lock playback buffer dsound: Reason: An invalid parameter was passed to the returning function dsound: Failed to lock buffer 2380@1571822572.560505:audio_timer_delayed interval 51 ms 2380@1571822572.581102:audio_timer_delayed interval 19 ms 2380@1571822572.600912:audio_timer_delayed interval 19 ms There is no saying when audio_timer_delayed will start displaying constantly. Only when one set of: 2260@1571823472.652244:audio_timer_start interval 10 ms 2260@1571823473.198349:audio_timer_stop Is following directly after each other, sound is played somewhat correctly. After randomly clicking several system sounds, the audio_timer_delayed message never stops. Thanks for looking into this. If there is any additional information needed, or disk images of Mac OS 9.2 or OS X 10.3 are required, please let me know. Best, Howard
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: Palmer Dabbelt <palmer@sifive.com> diff --git a/target/riscv/translate.c b/target/riscv/translate.c index adeddb85f67..b26533d4fd7 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -779,7 +779,7 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) DisasContext *ctx = container_of(dcbase, DisasContext, base); CPURISCVState *env = cpu->env_ptr; - ctx->opcode = cpu_ldl_code(env, ctx->base.pc_next); + ctx->opcode = translator_ldl(env, ctx->base.pc_next); decode_opc(ctx); ctx->base.pc_next = ctx->pc_succ_insn; -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/sparc/translate.c b/target/sparc/translate.c index c68bf4a2e41..edc23a7c403 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -5884,7 +5884,7 @@ static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) CPUSPARCState *env = cs->env_ptr; unsigned int insn; - insn = cpu_ldl_code(env, dc->pc); + insn = translator_ldl(env, dc->pc); dc->base.pc_next += 4; disas_sparc_insn(dc, insn); -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index d20e60ce770..a99f5296e2f 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -859,7 +859,7 @@ static int arg_copy_compare(const void *a, const void *b) static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) { xtensa_isa isa = dc->config->isa; - unsigned char b[MAX_INSN_LENGTH] = {cpu_ldub_code(env, dc->pc)}; + unsigned char b[MAX_INSN_LENGTH] = {translator_ldub(env, dc->pc)}; unsigned len = xtensa_op0_insn_len(dc, b[0]); xtensa_format fmt; int slot, slots; @@ -883,7 +883,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) dc->base.pc_next = dc->pc + len; for (i = 1; i < len; ++i) { - b[i] = cpu_ldub_code(env, dc->pc + i); + b[i] = translator_ldub(env, dc->pc + i); } xtensa_insnbuf_from_chars(isa, dc->insnbuf, b, len); fmt = xtensa_format_decode(isa, dc->insnbuf); -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c index 6addbac8d63..8dd28d6cf17 100644 --- a/target/openrisc/translate.c +++ b/target/openrisc/translate.c @@ -1645,7 +1645,7 @@ static void openrisc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) { DisasContext *dc = container_of(dcbase, DisasContext, base); OpenRISCCPU *cpu = OPENRISC_CPU(cs); - uint32_t insn = cpu_ldl_code(&cpu->env, dc->base.pc_next); + uint32_t insn = translator_ldl(&cpu->env, dc->base.pc_next); if (!decode(dc, insn)) { gen_illegal_exception(dc); -- 2.20.1
From: "Emilio G. Cota" <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 70c66c538cf..f977682be79 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -16,6 +16,7 @@ #include "exec/gen-icount.h" #include "exec/log.h" #include "exec/translator.h" +#include "exec/plugin-gen.h" /* Pairs with tcg_clear_temp_count. To be called by #TranslatorOps.{translate_insn,tb_stop} if @@ -34,6 +35,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb, int max_insns) { int bp_insn = 0; + bool plugin_enabled; /* Initialize DisasContext */ db->tb = tb; @@ -55,11 +57,17 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ + plugin_enabled = plugin_gen_tb_start(cpu, tb); + while (true) { db->num_insns++; ops->insn_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ + if (plugin_enabled) { + plugin_gen_insn_start(cpu, db); + } + /* Pass breakpoint hits to target for further processing */ if (!db->singlestep_enabled && unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { @@ -99,6 +107,14 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, break; } + /* + * We can't instrument after instructions that change control + * flow although this only really affects post-load operations. + */ + if (plugin_enabled) { + plugin_gen_insn_end(); + } + /* Stop translation if the output buffer is full, or we have executed all of the allowed instructions. */ if (tcg_op_buf_full() || db->num_insns >= db->max_insns) { @@ -111,6 +127,10 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, ops->tb_stop(db, cpu); gen_tb_end(db->tb, db->num_insns - bp_insn); + if (plugin_enabled) { + plugin_gen_tb_end(cpu); + } + /* The disas_log hook may use these values rather than recompute. */ db->tb->size = db->pc_next - db->pc_first; db->tb->icount = db->num_insns; -- 2.20.1
This adds the basic boilerplate feature enable option for the build. We shall expand it later. [AJB: split from larger patch] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/configure b/configure index d6fbcf45e4f..2995559ed21 100755 --- a/configure +++ b/configure @@ -498,6 +498,7 @@ libxml2="" debug_mutex="no" libpmem="" default_devices="yes" +plugins="no" supported_cpu="no" supported_os="no" @@ -1529,6 +1530,10 @@ for opt do ;; --disable-xkbcommon) xkbcommon=no ;; + --enable-plugins) plugins="yes" + ;; + --disable-plugins) plugins="no" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1710,6 +1715,8 @@ Advanced options (experts only): --enable-profiler profiler support --enable-debug-stack-usage track the maximum stack usage of stacks created by qemu_alloc_stack + --enable-plugins + enable plugins via shared library loading Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -6442,6 +6449,7 @@ echo "capstone $capstone" echo "libpmem support $libpmem" echo "libudev $libudev" echo "default devices $default_devices" +echo "plugin support $plugins" if test "$supported_cpu" = "no"; then echo @@ -7272,6 +7280,11 @@ if test "$sheepdog" = "yes" ; then echo "CONFIG_SHEEPDOG=y" >> $config_host_mak fi +if test "$plugins" = "yes" ; then + echo "CONFIG_PLUGIN=y" >> $config_host_mak + LIBS="-ldl $LIBS" +fi + if test "$tcg_interpreter" = "yes"; then QEMU_INCLUDES="-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" elif test "$ARCH" = "sparc64" ; then -- 2.20.1
From: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> [ cota: s/instrument/plugin ] Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/linux-user/main.c b/linux-user/main.c index 560d053f724..6ff7851e86f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -34,6 +34,7 @@ #include "qemu/error-report.h" #include "qemu/help_option.h" #include "qemu/module.h" +#include "qemu/plugin.h" #include "cpu.h" #include "exec/exec-all.h" #include "tcg.h" @@ -398,6 +399,15 @@ static void handle_arg_abi_call0(const char *arg) } #endif +static QemuPluginList plugins = QTAILQ_HEAD_INITIALIZER(plugins); + +#ifdef CONFIG_PLUGIN +static void handle_arg_plugin(const char *arg) +{ + qemu_plugin_opt_parse(arg, &plugins); +} +#endif + struct qemu_argument { const char *argv; const char *env; @@ -449,6 +459,10 @@ static const struct qemu_argument arg_table[] = { "", "Seed for pseudo-random number generator"}, {"trace", "QEMU_TRACE", true, handle_arg_trace, "", "[[enable=]<pattern>][,events=<file>][,file=<file>]"}, +#ifdef CONFIG_PLUGIN + {"plugin", "QEMU_PLUGIN", true, handle_arg_plugin, + "", "[file=]<file>[,arg=<string>]"}, +#endif {"version", "QEMU_VERSION", false, handle_arg_version, "", "display version information and exit"}, #if defined(TARGET_XTENSA) @@ -643,6 +657,7 @@ int main(int argc, char **argv, char **envp) cpu_model = NULL; qemu_add_opts(&qemu_trace_opts); + qemu_plugin_add_opts(); optind = parse_args(argc, argv); @@ -650,6 +665,9 @@ int main(int argc, char **argv, char **envp) exit(1); } trace_init_file(trace_file); + if (qemu_plugin_load_list(&plugins)) { + exit(1); + } /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); -- 2.20.1
Since moving where the tests are run the path to config-host.mak has been wrong. This doesn't affect much but things like the time fallback for CONFIG_DEBUG_TCG and will also get in the way of checking for PLUGINS support. Fixes: fc76c56d3f4 Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 5a9a6faba4e..84abbd24f34 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -30,7 +30,7 @@ # all: --include ../../config-host.mak +-include ../../../config-host.mak -include ../config-$(TARGET).mak # for including , in command strings -- 2.20.1
This will important for ensuring the plugin test variants will also work. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target index c1173ead422..24c7f2e7616 100644 --- a/tests/tcg/cris/Makefile.target +++ b/tests/tcg/cris/Makefile.target @@ -47,7 +47,7 @@ CRT_FILES = crt.o sys.o $(CC) $(ASFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT_FILES) # The default CPU breaks (possibly as it's max?) so force crisv17 -$(CRIS_RUNS): QEMU_OPTS=-cpu crisv17 +QEMU_OPTS=-cpu crisv17 # Additional runners to run under GNU SIM CRIS_RUNS_ON_SIM=$(patsubst %, %-on-sim, $(CRIS_RUNS)) -- 2.20.1
This is a very slow running test which we only enable explicitly. However having it in the TESTS lists would confuse additional tests like the plugins test which want to run on all currently enabled tests. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index 08c5736a4d4..43ee2e181e2 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -7,10 +7,8 @@ VPATH += $(I386_SRC) I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c)) ALL_X86_TESTS=$(I386_SRCS:.c=) -I386_TESTS:=$(filter-out test-i386-ssse3, $(ALL_X86_TESTS)) +SKIP_I386_TESTS=test-i386-ssse3 X86_64_TESTS:=$(filter test-i386-ssse3, $(ALL_X86_TESTS)) -# Update TESTS -TESTS=$(MULTIARCH_TESTS) $(I386_TESTS) # # hello-i386 is a barebones app @@ -36,9 +34,12 @@ run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref $(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)") $(call diff-out,test-i386-fprem, test-i386-fprem.ref) else -run-test-i386-fprem: test-i386-fprem - $(call skip-test, $<, "SLOW") +SKIP_I386_TESTS+=test-i386-fprem endif +# Update TESTS +I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) +TESTS=$(MULTIARCH_TESTS) $(I386_TESTS) + # On i386 and x86_64 Linux only supports 4k pages (large pages are a different hack) EXTRA_RUNS+=run-test-mmap-4096 -- 2.20.1
We don't need much for these. However I do wonder why these aren't just null inlines in exec-all.h Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index e2d23edafe0..677191a69cf 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "cpu.h" #include "tcg/tcg.h" #include "exec/exec-all.h" -- 2.20.1
This gets around a build problem with --disable-tcg. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index eadcf29d0c4..d85e610e85b 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -22,7 +22,9 @@ #include "cpu.h" #include "exec/tb-context.h" +#ifdef CONFIG_TCG #include "exec/cpu_ldst.h" +#endif #include "sysemu/cpus.h" /* allow to see translation results - the slowdown should be negligible, so we leave it */ -- 2.20.1
check-tcg will automatically run the plugins against most TCG tests if it is enabled in the build. We exclude sparc64-linux-user for now as there are pending patches that need to be merged fixing it's fork implementation. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> diff --git a/.travis.yml b/.travis.yml index ba3a8d4cfc9..e3f10a93683 100644 --- a/.travis.yml +++ b/.travis.yml @@ -339,6 +339,14 @@ matrix: - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + # Run check-tcg against linux-user (with plugins) + # we skip sparc64-linux-user until it has been fixed somewhat + - env: + - CONFIG="--disable-system --enable-plugins --target-list-exclude=sparc64-linux-user" + - TEST_CMD="make -j3 check-tcg V=1" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + + # Run check-tcg against softmmu targets - env: - CONFIG="--enable-debug-tcg --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" @@ -346,6 +354,13 @@ matrix: - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + # Run check-tcg against softmmu targets (with plugins) + - env: + - CONFIG="--enable-plugins --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" + - TEST_CMD="make -j3 check-tcg V=1" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + + # Release builds # The make-release script expect a QEMU version, so our tag must start with a 'v'. # This is the case when release candidate tags are created. -- 2.20.1
It's quite common to have a mini comment inside braces to acknowledge we know it's empty. Expand the inline detection to allow closing braces before the end of line. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Aaron Lindsay <aaron@os.amperecomputing.com> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aa9a354a0e7..db67b4da872 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1639,7 +1639,7 @@ sub process { # Block comment styles # Block comments use /* on a line of its own - if ($rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ + if ($rawline !~ m@^\+.*/\*.*\*/[ \t)}]*$@ && #inline /*...*/ $rawline =~ m@^\+.*/\*\*?+[ \t]*[^ \t]@) { # /* or /** non-blank WARN("Block comments use a leading /* on a separate line\n" . $herecurr); } -- 2.20.1
Signed-off-by: Alex Bennée <alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index ed41d7d1b6c..ade2187eae4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2328,6 +2328,12 @@ M: Richard Henderson <rth@twiddle.net> S: Maintained F: tcg/ +TCG Plugins +M: Alex Bennée <alex.bennee@linaro.org> +S: Maintained +F: plugins/ +F: tests/plugin + AArch64 TCG target M: Claudio Fontana <claudio.fontana@huawei.com> M: Claudio Fontana <claudio.fontana@gmail.com> -- 2.20.1
Create a new cache for the --enable-debug-tcg builds which is separate from the normal debug builds which generate different code. We also enable debug-tcg for the new plugins based builds as we want to ensure any breakage to TCG is picked up by the sanity checks. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> diff --git a/.travis.yml b/.travis.yml index e3f10a93683..34bc8134f5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -135,7 +135,7 @@ matrix: # TCG debug can be run just on its own and is mostly agnostic to user/softmmu distinctions - env: - CONFIG="--enable-debug-tcg --disable-system" - - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg" - env: @@ -336,29 +336,29 @@ matrix: - env: - CONFIG="--disable-system --enable-debug-tcg" - TEST_CMD="make -j3 check-tcg V=1" - - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg" # Run check-tcg against linux-user (with plugins) # we skip sparc64-linux-user until it has been fixed somewhat - env: - - CONFIG="--disable-system --enable-plugins --target-list-exclude=sparc64-linux-user" + - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user" - TEST_CMD="make -j3 check-tcg V=1" - - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg" # Run check-tcg against softmmu targets - env: - CONFIG="--enable-debug-tcg --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" - TEST_CMD="make -j3 check-tcg V=1" - - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg" # Run check-tcg against softmmu targets (with plugins) - env: - - CONFIG="--enable-plugins --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" + - CONFIG="--enable-plugins --enable-debug-tcg --target-list=xtensa-softmmu,arm-softmmu,aarch64-softmmu,alpha-softmmu" - TEST_CMD="make -j3 check-tcg V=1" - - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default" + - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg" # Release builds -- 2.20.1
© 2016 - 2024 Red Hat, Inc.