mbox series

[v5,00/12] TCG Plugin inline operation enhancement

Message ID 20240226091446.479436-1-pierrick.bouvier@linaro.org (mailing list archive)
Headers show
Series TCG Plugin inline operation enhancement | expand

Message

Pierrick Bouvier Feb. 26, 2024, 9:14 a.m. UTC
This series adds a new thread-safe API to declare inline operation
inside plugins. As well, it removes the existing non thread-safe API,
and migrates all existing plugins to use it.

Tested on Linux (user, system) for i386, x86_64 and aarch64.

To give some context, this a long term series of work around plugins,
with the goal to be able to do basic operations in a more performant and
accurate way. This will mean to add more inline operations and
conditional callbacks.

One final target of this work is to implement a plugin that implements
the icount=auto feature, and allow QEMU to run at a given "frequency"
based on number of instructions executed, without QEMU needing to keep
track of this.

Another final target is to be able to detect control flow changes in an
efficient and elegant way, by combining inline operation and conditional
callbacks.

v5
--

- fix bound for qemu_plugin_u64_loop
- skip double API bump for plugins
- rebase on top of 20240223162202.1936541-1-alex.bennee@linaro.org

Only existing plugins changes still need a review.

v4
--

- split scoreboard/qemu_plugin_u64 patches
- use list instead of hash table to keep track of scoreboards
- remove immediate in tcg code gen

v3
--

- introduce qemu_plugin_num_vcpus (how many cpus were initialized)
- fix order of plugin init/idle/resume callbacks
- scoreboard:
  - renamed qemu_plugin_u64_t -> qemu_plugin_u64
  - some functions rename for scoreboard api
  - qemu_plugin_u64 has only value based function (vs address before)
- various cleanup thanks to review of previous series

v2
--

Implement scoreboard API (cpu local storage), so plugins don't have to deal
with how many cpus are used.

Since plugins have been modified again, I didn't transfer any reviewed-by on
those commits.

Pierrick Bouvier (12):
  plugins: scoreboard API
  plugins: define qemu_plugin_u64
  plugins: implement inline operation relative to cpu_index
  plugins: add inline operation per vcpu
  tests/plugin: add test plugin for inline operations
  tests/plugin/mem: migrate to new per_vcpu API
  tests/plugin/insn: migrate to new per_vcpu API
  tests/plugin/bb: migrate to new per_vcpu API
  contrib/plugins/hotblocks: migrate to new per_vcpu API
  contrib/plugins/howvec: migrate to new per_vcpu API
  plugins: remove non per_vcpu inline operation from API
  plugins: cleanup codepath for previous inline operation

 include/qemu/plugin.h        |   7 ++
 include/qemu/qemu-plugin.h   | 142 ++++++++++++++++++++------
 plugins/plugin.h             |  17 +++-
 accel/tcg/plugin-gen.c       |  69 ++++++++++---
 contrib/plugins/hotblocks.c  |  50 ++++++----
 contrib/plugins/howvec.c     |  53 +++++++---
 plugins/api.c                |  92 ++++++++++++++---
 plugins/core.c               |  79 +++++++++++++--
 tests/plugin/bb.c            |  63 +++++-------
 tests/plugin/inline.c        | 186 +++++++++++++++++++++++++++++++++++
 tests/plugin/insn.c          | 106 ++++++++++----------
 tests/plugin/mem.c           |  40 +++++---
 plugins/qemu-plugins.symbols |  13 ++-
 tests/plugin/meson.build     |   2 +-
 14 files changed, 702 insertions(+), 217 deletions(-)
 create mode 100644 tests/plugin/inline.c