Skip to content

Support for TCG plugins

Alex Bennée qemu-arm qemu-devel qemu-riscv 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest54 patches 7 repliesIn review
  2. v555 patches 34 repliesSuperseded
  3. v454 patches 50 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches10 repliesSuperseded

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/54trace: expand mem_info:size_shift to 4 bitstrace-events trace/mem-internal.h+5 -50 replies
2/54trace: add mmu_index to mem_infoaccel/tcg/atomic_template.h accel/tcg/cputlb.c accel/tcg/user-exec.c +7 more+59 -390 replies
3/54cpu: introduce cpu_in_exclusive_context()accel/tcg/cpu-exec.c cpus-common.c include/hw/core/cpu.h+18 -40 replies
4/54translate-all: use cpu_in_exclusive_work_context() in tb_flushaccel/tcg/translate-all.c+7 -20 replies
5/54docs/devel: add plugins.rst design documentdocs/devel/index.rst docs/devel/plugins.rst+113 -00 replies
6/54plugin: add user-facing APIinclude/qemu/qemu-plugin.h+351 -00 replies
7/54plugin: add core codeMakefile Makefile.target configure +6 more+1241 -10 replies
8/54plugin: add implementation of the apiinclude/qemu/qemu-plugin.h plugins/Makefile.objs plugins/api.c+278 -30 replies
9/54queue: add QTAILQ_REMOVE_SEVERALinclude/qemu/queue.h+10 -00 replies
10/54cputlb: document get_page_addr_codeinclude/exec/exec-all.h+21 -30 replies
11/54cputlb: introduce get_page_addr_code_hostpaccel/tcg/cputlb.c include/exec/exec-all.h+51 -10 replies
12/54tcg: add tcg_gen_st_ptrtcg/tcg-op.h+5 -00 replies
13/54plugin-gen: add module for TCG-related codeaccel/tcg/Makefile.objs accel/tcg/plugin-gen.c accel/tcg/plugin-helpers.h +8 more+1054 -00 replies
14/54atomic_template: add inline trace/plugin helpersaccel/tcg/atomic_common.inc.c accel/tcg/atomic_template.h accel/tcg/cputlb.c +1 more+111 -390 replies
15/54tcg: let plugins instrument virtual memory accessesaccel/tcg/atomic_common.inc.c accel/tcg/atomic_template.h accel/tcg/cpu-exec.c +5 more+74 -360 replies
16/54plugins: implement helpers for resolving hwaddraccel/tcg/cputlb.c include/qemu/plugin-memory.h include/qemu/qemu-plugin.h +1 more+139 -00 replies
17/54translate-all: notify plugin code of tb_flushaccel/tcg/translate-all.c+6 -00 replies
18/54*-user: notify plugin of exitbsd-user/syscall.c linux-user/exit.c+4 -00 replies
19/54*-user: plugin syscallsbsd-user/syscall.c include/user/syscall-trace.h linux-user/syscall.c+59 -90 replies
20/54cpu: hook plugin vcpu eventscpus.c exec.c hw/core/cpu.c+14 -00 replies
21/54plugin-gen: add plugin_insn_appendinclude/exec/plugin-gen.h+14 -00 replies
22/54translator: add translator_ld{ub,sw,uw,l,q}include/exec/cpu_ldst.h include/exec/translator.h+72 -10 replies
23/54target/arm: fetch code with translator_ldtarget/arm/arm_ldst.h+3 -120 replies
24/54target/ppc: fetch code with translator_ldtarget/ppc/translate.c+3 -50 replies
25/54target/sh4: fetch code with translator_ldtarget/sh4/translate.c+2 -20 replies
26/54target/i386: fetch code with translator_ldtarget/i386/translate.c+5 -50 replies
27/54target/hppa: fetch code with translator_ldtarget/hppa/translate.c+1 -10 replies
28/54target/m68k: fetch code with translator_ldtarget/m68k/translate.c+1 -10 replies
29/54target/alpha: fetch code with translator_ldtarget/alpha/translate.c+1 -10 replies
30/54target/riscv: fetch code with translator_ldtarget/riscv/translate.c+1 -10 replies
31/54target/sparc: fetch code with translator_ldtarget/sparc/translate.c+1 -10 replies
32/54target/xtensa: fetch code with translator_ldtarget/xtensa/translate.c+2 -20 replies
33/54target/openrisc: fetch code with translator_ldtarget/openrisc/translate.c+1 -10 replies
34/54translator: inject instrumentation from pluginsaccel/tcg/translator.c+20 -00 replies
35/54configure: add --enable-pluginsconfigure+13 -00 replies
36/54plugin: add API symbols to qemu-plugins.symbolsMakefile configure plugins/.gitignore +2 more+133 -00 replies
37/54plugin: expand the plugin_init function to include an info blockinclude/qemu/qemu-plugin.h plugins/loader.c+43 -64 replies
38/54plugin: add qemu_plugin_insn_disas helperdisas.c include/disas/disas.h include/qemu/qemu-plugin.h +2 more+130 -10 replies
39/54plugin: add qemu_plugin_outs helperinclude/qemu/log.h include/qemu/qemu-plugin.h plugins/api.c +2 more+19 -01 reply
40/54vl: support -plugin optionqemu-options.hx vl.c+28 -00 replies
41/54linux-user: support -plugin optionlinux-user/main.c+18 -00 replies
42/54tests/plugin: add sample pluginsconfigure tests/plugin/Makefile tests/plugin/bb.c +3 more+281 -00 replies
43/54tests/tcg/Makefile.target: fix path to config-host.maktests/tcg/Makefile.target+1 -10 replies
44/54tests/tcg: set QEMU_OPTS for all cris runstests/tcg/cris/Makefile.target+1 -10 replies
45/54tests/tcg: move "virtual" tests to EXTRA_TESTStests/tcg/Makefile.target tests/tcg/aarch64/Makefile.softmmu-target+4 -20 replies
46/54tests/tcg: drop test-i386-fprem from TESTS when not SLOWtests/tcg/i386/Makefile.target+6 -50 replies
47/54tests/tcg: enable plugin testingtests/Makefile.include tests/tcg/Makefile.target tests/tcg/aarch64/Makefile.target +2 more+60 -10 replies
48/54tests/plugin: add a hotblocks plugintests/plugin/Makefile tests/plugin/hotblocks.c+144 -00 replies
49/54tests/plugin: add instruction execution breakdowntests/plugin/Makefile tests/plugin/howvec.c+353 -00 replies
50/54tests/plugin: add hotpages to analyse memory access patternstests/plugin/Makefile tests/plugin/hotpages.c+192 -00 replies
51/54accel/stubs: reduce headers from tcg-stubaccel/stubs/tcg-stub.c+0 -10 replies
52/54include/exec: wrap cpu_ldst.h in CONFIG_TCGinclude/exec/exec-all.h+2 -00 replies
53/54.travis.yml: add --enable-plugins tests.travis.yml+15 -00 replies
54/54scripts/checkpatch.pl: don't complain about (foo, /* empty */)scripts/checkpatch.pl+1 -11 reply

Reviews trailers per patch

52 of 54 patches have a Reviewed-by or Acked-by.

PatchRichard HendersonAlex BennéeAlistair FrancisDavid GibsonAaron Lindsay
1/54R-b R-b
2/54
3/54R-b R-b
4/54R-b R-b
5/54R-b
6/54R-b
7/54R-b
8/54R-b
9/54R-b
10/54R-b
11/54R-b
12/54R-b
13/54R-b
14/54R-b
15/54R-b
16/54R-b
17/54R-b R-b
18/54R-b R-b
19/54R-b
20/54R-b
21/54R-b
22/54R-b
23/54R-b
24/54R-b A-b
25/54R-b
26/54R-b
27/54R-b
28/54R-b
29/54R-b
30/54R-b R-b
31/54R-b
32/54R-b
33/54R-b
34/54R-b
35/54R-b
36/54R-b
37/54
38/54R-b
39/54R-b
40/54R-b
41/54R-b
42/54R-b
43/54R-b
44/54R-b
45/54R-b
46/54R-b
47/54R-b
48/54R-b
49/54R-b
50/54R-b
51/54R-b
52/54R-b
53/54R-b
54/54R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v6 thread

Cover letter [PATCH for 4.2 v6 00/54] Support for TCG plugins

Hi,

This is the latest iteration of the TCG plugins series. From the documentation:

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.

This is mostly a adding signoffs and some patch re-organisation and splitting. For reference the longer notes about what API tweaks didn't make it into this iteration can be found in the previous series:

Subject: [PATCH for 4.2 v5 00/55] Support for TCG plugins
Date: Mon, 14 Oct 2019 11:48:53 +0100
Message-Id: <[email protected]>

Changes of note:

- now use gmodule to load symbols instead of dlsym
- re-jigged translator_ld to avoid creating more alias functions
- moved configure change to final place
- moved additional API bits to before examples
- merged api changes to examples into final single commit versions
- tweaked hwaddr API to talk of device_offset

Most of the checkpatch formatting complaints I think are overly picky given the attempt to make table look nice or not wrap for the sake of going one character over. I've included a checkpatch patch to stop bothering me about (foo, /* empty */) comments. As ever there are more details bellow the ---

Only a few more un-reviewed patches before I can send the PR:

02 - trace add mmu_index to mem_info
37 - plugin expand the plugin_init function to include 39 - plugin add qemu_plugin_outs helper
54 - scripts chec.pl don t complain about foo em

Alex Bennée (20):
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
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 */)

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

Lluís Vilanova (2):
vl: support -plugin option
linux-user: support -plugin option

 .travis.yml                               |  15 +
 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                        |  60 +-
 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          |  37 +-
 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/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                                 |  21 +
 tests/Makefile.include                    |  11 +-
 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 +-
 trace-events                              |   8 +-
 trace/mem-internal.h                      |  39 +-
 trace/mem.h                               |   7 +-
 util/log.c                                |   3 +
 vl.c                                      |  11 +
 91 files changed, 5159 insertions(+), 162 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
Signature · 1 line
2.20.1