[PATCH v2 00/14] TCG Plugin inline operation enhancement

Pierrick Bouvier posted 14 patches 10 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MAINTAINERS                     |   1 +
accel/tcg/plugin-gen.c          |  64 +++++++++--
contrib/plugins/execlog.c       |   6 +-
contrib/plugins/hotblocks.c     |  46 ++++----
contrib/plugins/howvec.c        |  50 ++++++---
docs/devel/multi-thread-tcg.rst |   1 +
include/qemu/plugin.h           |   9 ++
include/qemu/qemu-plugin.h      | 135 ++++++++++++++++++-----
plugins/api.c                   |  74 ++++++++++---
plugins/core.c                  | 112 +++++++++++++++++++-
plugins/plugin.h                |  13 ++-
plugins/qemu-plugins.symbols    |   9 ++
tests/plugin/bb.c               |  63 +++++------
tests/plugin/inline.c           | 182 ++++++++++++++++++++++++++++++++
tests/plugin/insn.c             | 106 +++++++++----------
tests/plugin/mem.c              |  39 ++++---
tests/plugin/meson.build        |   2 +-
17 files changed, 704 insertions(+), 208 deletions(-)
create mode 100644 tests/plugin/inline.c
[PATCH v2 00/14] TCG Plugin inline operation enhancement
Posted by Pierrick Bouvier 10 months ago
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.

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.

 Branches:
          base:  upstream/staging
          topic: plugin_inline_per_vcpu

 Pierrick Bouvier (15):
       [TO_REMOVE] commit support
       plugins: implement inline operation relative to cpu_index
       plugins: scoreboard API
       docs/devel: plugins can trigger a tb flush
       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: register inline op with a qemu_plugin_u64_t
       MAINTAINERS: Add myself as reviewer for TCG Plugins
       contrib/plugins/execlog: fix new warnings

  .gitignore                      |   1 +
  Dockerfile                      |  23 +++++
  MAINTAINERS                     |   1 +
  accel/tcg/plugin-gen.c          |  64 +++++++++++---
  build.sh                        |  18 ++++
  contrib/plugins/execlog.c       |   6 +-
  contrib/plugins/hotblocks.c     |  46 +++++-----
  contrib/plugins/howvec.c        |  50 +++++++----
  docs/devel/multi-thread-tcg.rst |   1 +
  include/qemu/plugin.h           |   9 ++
  include/qemu/qemu-plugin.h      | 135 ++++++++++++++++++++++-------
  mt.cpp                          |  44 ++++++++++
  plugins/api.c                   |  74 ++++++++++++----
  plugins/core.c                  | 112 +++++++++++++++++++++++--
  plugins/plugin.h                |  13 ++-
  plugins/qemu-plugins.symbols    |   9 ++
  run.sh                          |  22 +++++
  test.sh                         |  34 ++++++++
  tests/plugin/bb.c               |  63 ++++++--------
  tests/plugin/inline.c           | 182 ++++++++++++++++++++++++++++++++++++++++
  tests/plugin/insn.c             | 106 +++++++++++------------
  tests/plugin/mem.c              |  39 +++++----
  tests/plugin/meson.build        |   2 +-
  23 files changed, 846 insertions(+), 208 deletions(-)

Pierrick Bouvier (14):
  plugins: implement inline operation relative to cpu_index
  plugins: scoreboard API
  docs/devel: plugins can trigger a tb flush
  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: register inline op with a qemu_plugin_u64_t
  MAINTAINERS: Add myself as reviewer for TCG Plugins
  contrib/plugins/execlog: fix new warnings

 MAINTAINERS                     |   1 +
 accel/tcg/plugin-gen.c          |  64 +++++++++--
 contrib/plugins/execlog.c       |   6 +-
 contrib/plugins/hotblocks.c     |  46 ++++----
 contrib/plugins/howvec.c        |  50 ++++++---
 docs/devel/multi-thread-tcg.rst |   1 +
 include/qemu/plugin.h           |   9 ++
 include/qemu/qemu-plugin.h      | 135 ++++++++++++++++++-----
 plugins/api.c                   |  74 ++++++++++---
 plugins/core.c                  | 112 +++++++++++++++++++-
 plugins/plugin.h                |  13 ++-
 plugins/qemu-plugins.symbols    |   9 ++
 tests/plugin/bb.c               |  63 +++++------
 tests/plugin/inline.c           | 182 ++++++++++++++++++++++++++++++++
 tests/plugin/insn.c             | 106 +++++++++----------
 tests/plugin/mem.c              |  39 ++++---
 tests/plugin/meson.build        |   2 +-
 17 files changed, 704 insertions(+), 208 deletions(-)
 create mode 100644 tests/plugin/inline.c

-- 
2.43.0
Re: [PATCH v2 00/14] TCG Plugin inline operation enhancement
Posted by Pierrick Bouvier 9 months, 3 weeks ago
A polite ping to request review on this series, especially for 
scoreboard [02/14] which is the main addition compared to v1.

On 1/18/24 07:23, Pierrick Bouvier wrote:
> 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.
> 
> 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.
> 
>   Branches:
>            base:  upstream/staging
>            topic: plugin_inline_per_vcpu
> 
>   Pierrick Bouvier (15):
>         [TO_REMOVE] commit support
>         plugins: implement inline operation relative to cpu_index
>         plugins: scoreboard API
>         docs/devel: plugins can trigger a tb flush
>         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: register inline op with a qemu_plugin_u64_t
>         MAINTAINERS: Add myself as reviewer for TCG Plugins
>         contrib/plugins/execlog: fix new warnings
> 
>    .gitignore                      |   1 +
>    Dockerfile                      |  23 +++++
>    MAINTAINERS                     |   1 +
>    accel/tcg/plugin-gen.c          |  64 +++++++++++---
>    build.sh                        |  18 ++++
>    contrib/plugins/execlog.c       |   6 +-
>    contrib/plugins/hotblocks.c     |  46 +++++-----
>    contrib/plugins/howvec.c        |  50 +++++++----
>    docs/devel/multi-thread-tcg.rst |   1 +
>    include/qemu/plugin.h           |   9 ++
>    include/qemu/qemu-plugin.h      | 135 ++++++++++++++++++++++-------
>    mt.cpp                          |  44 ++++++++++
>    plugins/api.c                   |  74 ++++++++++++----
>    plugins/core.c                  | 112 +++++++++++++++++++++++--
>    plugins/plugin.h                |  13 ++-
>    plugins/qemu-plugins.symbols    |   9 ++
>    run.sh                          |  22 +++++
>    test.sh                         |  34 ++++++++
>    tests/plugin/bb.c               |  63 ++++++--------
>    tests/plugin/inline.c           | 182 ++++++++++++++++++++++++++++++++++++++++
>    tests/plugin/insn.c             | 106 +++++++++++------------
>    tests/plugin/mem.c              |  39 +++++----
>    tests/plugin/meson.build        |   2 +-
>    23 files changed, 846 insertions(+), 208 deletions(-)
> 
> Pierrick Bouvier (14):
>    plugins: implement inline operation relative to cpu_index
>    plugins: scoreboard API
>    docs/devel: plugins can trigger a tb flush
>    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: register inline op with a qemu_plugin_u64_t
>    MAINTAINERS: Add myself as reviewer for TCG Plugins
>    contrib/plugins/execlog: fix new warnings
> 
>   MAINTAINERS                     |   1 +
>   accel/tcg/plugin-gen.c          |  64 +++++++++--
>   contrib/plugins/execlog.c       |   6 +-
>   contrib/plugins/hotblocks.c     |  46 ++++----
>   contrib/plugins/howvec.c        |  50 ++++++---
>   docs/devel/multi-thread-tcg.rst |   1 +
>   include/qemu/plugin.h           |   9 ++
>   include/qemu/qemu-plugin.h      | 135 ++++++++++++++++++-----
>   plugins/api.c                   |  74 ++++++++++---
>   plugins/core.c                  | 112 +++++++++++++++++++-
>   plugins/plugin.h                |  13 ++-
>   plugins/qemu-plugins.symbols    |   9 ++
>   tests/plugin/bb.c               |  63 +++++------
>   tests/plugin/inline.c           | 182 ++++++++++++++++++++++++++++++++
>   tests/plugin/insn.c             | 106 +++++++++----------
>   tests/plugin/mem.c              |  39 ++++---
>   tests/plugin/meson.build        |   2 +-
>   17 files changed, 704 insertions(+), 208 deletions(-)
>   create mode 100644 tests/plugin/inline.c
>