mbox series

[v4,0/7] Measure Tiny Code Generation Quality

Message ID 20190720010235.32444-1-vandersonmr2@gmail.com (mailing list archive)
Headers show
Series Measure Tiny Code Generation Quality | expand

Message

vandersonmr July 20, 2019, 1:02 a.m. UTC
This patch is part of Google Summer of Code (GSoC) 2019.
More about the project can be found in:
https://wiki.qemu.org/Internships/ProjectIdeas/TCGCodeQuality

The goal of this patch is to add infrastructure to collect
execution and JIT statistics during the emulation with accel/TCG.
The statistics are stored in TBStatistic structures (TBStats)
with each TB having its respective TBStats.

We added -d tb_stats and HMP tb_stats commands to allow the control
of this statistics collection. And info tb, tbs, and coverset commands
were also added to allow dumping and exploring all this information 
while emulating.

Collecting these statistics and information is useful to understand
qemu performance and to help to add the support for traces to QEMU. 

vandersonmr (7):
  accel: introducing TBStatistics structure
  accel: collecting TB execution count
  accel: collecting JIT statistics
  accel: replacing part of CONFIG_PROFILER with TBStats
  log: adding -d tb_stats to control tbstats
  monitor: adding tb_stats hmp command
  monitor: adding info tbs, tb, and coverset

 accel/tcg/Makefile.objs      |   2 +-
 accel/tcg/tb-stats.c         | 489 +++++++++++++++++++++++++++++++++++
 accel/tcg/tcg-runtime.c      |   7 +
 accel/tcg/tcg-runtime.h      |   2 +
 accel/tcg/translate-all.c    |  93 ++++++-
 accel/tcg/translator.c       |   6 +
 disas.c                      | 108 ++++++++
 hmp-commands-info.hx         |  23 ++
 hmp-commands.hx              |  17 ++
 include/disas/disas.h        |   1 +
 include/exec/exec-all.h      |  15 +-
 include/exec/gen-icount.h    |   9 +
 include/exec/tb-context.h    |  12 +
 include/exec/tb-hash.h       |   7 +
 include/exec/tb-stats.h      | 113 ++++++++
 include/qemu/log-for-trace.h |   2 +
 include/qemu/log.h           |  16 ++
 linux-user/exit.c            |   4 +
 monitor/misc.c               | 111 ++++++++
 tcg/tcg.c                    | 114 +++-----
 tcg/tcg.h                    |  12 +-
 util/log.c                   |  99 ++++++-
 22 files changed, 1144 insertions(+), 118 deletions(-)
 create mode 100644 accel/tcg/tb-stats.c
 create mode 100644 include/exec/tb-stats.h

Comments

Alex Bennée July 26, 2019, 12:51 p.m. UTC | #1
vandersonmr <vandersonmr2@gmail.com> writes:

> This patch is part of Google Summer of Code (GSoC) 2019.
> More about the project can be found in:
> https://wiki.qemu.org/Internships/ProjectIdeas/TCGCodeQuality
>
> The goal of this patch is to add infrastructure to collect
> execution and JIT statistics during the emulation with accel/TCG.
> The statistics are stored in TBStatistic structures (TBStats)
> with each TB having its respective TBStats.
>
> We added -d tb_stats and HMP tb_stats commands to allow the control
> of this statistics collection. And info tb, tbs, and coverset commands
> were also added to allow dumping and exploring all this information
> while emulating.

Hmm with:

  -d tb_stats:10:all

I'm seeing the following bt:

  Thread 4 "qemu-system-aar" received signal SIGABRT, Aborted.
  [Switching to Thread 0x7fffe5285700 (LWP 898)]
  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) bt
  #0  0x00007ffff51787bb in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007ffff5163535 in __GI_abort () at abort.c:79
  #2  0x0000555555bab663 in OP_E (bytemode=2, sizeflag=3) at /home/alex/lsrc/qemu.git/disas/i386.c:5094
  #3  0x0000555555ba972f in print_insn (pc=140735911299712, info=0x7fffe5281c00) at /home/alex/lsrc/qemu.git/disas/i386.c:4071
  #4  0x0000555555ba8623 in print_insn_i386 (pc=140735911299712, info=0x7fffe5281c00) at /home/alex/lsrc/qemu.git/disas/i386.c:3705
  #5  0x0000555555881241 in get_num_insts (code=0x7fffa2000a80 <code_gen_buffer+33557075>, size=88) at /home/alex/lsrc/qemu.git/disas.c:575
  #6  0x00005555558d89f1 in tb_gen_code (cpu=0x555556a1f6a0, pc=18446743524230025728, cs_base=0, flags=2415924229, cflags=-16252928) at /home/alex/lsrc/qemu.git/accel/tcg/translate-all.c:1881
  #7  0x00005555558d4984 in tb_find (cpu=0x555556a1f6a0, last_tb=0x0, tb_exit=0, cf_mask=524288) at /home/alex/lsrc/qemu.git/accel/tcg/cpu-exec.c:409
  #8  0x00005555558d524f in cpu_exec (cpu=0x555556a1f6a0) at /home/alex/lsrc/qemu.git/accel/tcg/cpu-exec.c:731
  #9  0x0000555555884806 in tcg_cpu_exec (cpu=0x555556a1f6a0) at /home/alex/lsrc/qemu.git/cpus.c:1435
  #10 0x000055555588505c in qemu_tcg_cpu_thread_fn (arg=0x555556a1f6a0) at /home/alex/lsrc/qemu.git/cpus.c:1743
  #11 0x0000555556010875 in qemu_thread_start (args=0x555556a75450) at /home/alex/lsrc/qemu.git/util/qemu-thread-posix.c:502
  #12 0x00007ffff530bfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
  #13 0x00007ffff523a4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95


>
> Collecting these statistics and information is useful to understand
> qemu performance and to help to add the support for traces to QEMU.
>
> vandersonmr (7):
>   accel: introducing TBStatistics structure
>   accel: collecting TB execution count
>   accel: collecting JIT statistics
>   accel: replacing part of CONFIG_PROFILER with TBStats
>   log: adding -d tb_stats to control tbstats
>   monitor: adding tb_stats hmp command
>   monitor: adding info tbs, tb, and coverset
>
>  accel/tcg/Makefile.objs      |   2 +-
>  accel/tcg/tb-stats.c         | 489 +++++++++++++++++++++++++++++++++++
>  accel/tcg/tcg-runtime.c      |   7 +
>  accel/tcg/tcg-runtime.h      |   2 +
>  accel/tcg/translate-all.c    |  93 ++++++-
>  accel/tcg/translator.c       |   6 +
>  disas.c                      | 108 ++++++++
>  hmp-commands-info.hx         |  23 ++
>  hmp-commands.hx              |  17 ++
>  include/disas/disas.h        |   1 +
>  include/exec/exec-all.h      |  15 +-
>  include/exec/gen-icount.h    |   9 +
>  include/exec/tb-context.h    |  12 +
>  include/exec/tb-hash.h       |   7 +
>  include/exec/tb-stats.h      | 113 ++++++++
>  include/qemu/log-for-trace.h |   2 +
>  include/qemu/log.h           |  16 ++
>  linux-user/exit.c            |   4 +
>  monitor/misc.c               | 111 ++++++++
>  tcg/tcg.c                    | 114 +++-----
>  tcg/tcg.h                    |  12 +-
>  util/log.c                   |  99 ++++++-
>  22 files changed, 1144 insertions(+), 118 deletions(-)
>  create mode 100644 accel/tcg/tb-stats.c
>  create mode 100644 include/exec/tb-stats.h


--
Alex Bennée