[PATCH v4 0/3] tcg: add perfmap and jitdump

Ilya Leoshkevich posted 3 patches 1 year, 3 months ago
accel/tcg/debuginfo.c     |  96 ++++++++++
accel/tcg/debuginfo.h     |  77 ++++++++
accel/tcg/meson.build     |   2 +
accel/tcg/perf.c          | 375 ++++++++++++++++++++++++++++++++++++++
accel/tcg/perf.h          |  49 +++++
accel/tcg/translate-all.c |   7 +
docs/devel/tcg.rst        |  23 +++
hw/core/loader.c          |   5 +
linux-user/elfload.c      |   3 +
linux-user/exit.c         |   2 +
linux-user/main.c         |  15 ++
linux-user/meson.build    |   1 +
linux-user/signal.c       |   8 +-
meson.build               |   8 +
qemu-options.hx           |  20 ++
softmmu/vl.c              |  11 ++
tcg/tcg.c                 |   2 +
17 files changed, 701 insertions(+), 3 deletions(-)
create mode 100644 accel/tcg/debuginfo.c
create mode 100644 accel/tcg/debuginfo.h
create mode 100644 accel/tcg/perf.c
create mode 100644 accel/tcg/perf.h
[PATCH v4 0/3] tcg: add perfmap and jitdump
Posted by Ilya Leoshkevich 1 year, 3 months ago
v3:
https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg02072.html

v3 -> v4:
* s/unsigned long long/uint64_t/g (Richard).
* Fix address resolution with TARGET_TB_PCREL again.
  * Open question: do we need something like get_pc_from_opc()?
    See FIXME in patch 3.

v2:
https://lists.gnu.org/archive/html/qemu-devel/2022-11/msg02385.html
https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg01026.html

v2 -> v3:
* Enable only for CONFIG_LINUX (Alex).
* Use qemu_get_thread_id() instead of gettid() (Alex).
* Fix CI (Alex).
  https://gitlab.com/iii-i/qemu/-/pipelines/743684604
* Drop unnecessary #includes (Alex).
* Drop the constification change (Alex/Richard).
* Split debuginfo support into a separate patch.
* Fix partial perfmap/jitdump files when terminating due to a signal.
* Fix debuginfo strings being accessed outside of debuginfo lock.
* Fix address resolution with TARGET_TB_PCREL.
* Add DEBUGINFOD_URLS= to the doc; without it perf inject is
  unacceptably slow.
* Note: it's better to test this with the latest perf
  (6.2.rc3.g7dd4b804e080 worked fine for me). There has been at least
  one breakage in the JIT area recently (fixed by 6d518ac7be62).

v1:
https://lists.nongnu.org/archive/html/qemu-devel/2022-10/msg01824.html
https://lists.nongnu.org/archive/html/qemu-devel/2022-11/msg01073.html

v1 -> v2:
* Use QEMU_LOCK_GUARD (Alex).
* Handle TARGET_TB_PCREL (Alex).
* Support ELF -kernels, add a note about this (Alex). Tested with
  qemu-system-x86_64 and Linux kernel - it's not fast, but it works.
* Minor const correctness and style improvements.

Ilya Leoshkevich (3):
  linux-user: Clean up when exiting due to a signal
  accel/tcg: Add debuginfo support
  tcg: add perfmap and jitdump

 accel/tcg/debuginfo.c     |  96 ++++++++++
 accel/tcg/debuginfo.h     |  77 ++++++++
 accel/tcg/meson.build     |   2 +
 accel/tcg/perf.c          | 375 ++++++++++++++++++++++++++++++++++++++
 accel/tcg/perf.h          |  49 +++++
 accel/tcg/translate-all.c |   7 +
 docs/devel/tcg.rst        |  23 +++
 hw/core/loader.c          |   5 +
 linux-user/elfload.c      |   3 +
 linux-user/exit.c         |   2 +
 linux-user/main.c         |  15 ++
 linux-user/meson.build    |   1 +
 linux-user/signal.c       |   8 +-
 meson.build               |   8 +
 qemu-options.hx           |  20 ++
 softmmu/vl.c              |  11 ++
 tcg/tcg.c                 |   2 +
 17 files changed, 701 insertions(+), 3 deletions(-)
 create mode 100644 accel/tcg/debuginfo.c
 create mode 100644 accel/tcg/debuginfo.h
 create mode 100644 accel/tcg/perf.c
 create mode 100644 accel/tcg/perf.h

-- 
2.39.0
Re: [PATCH v4 0/3] tcg: add perfmap and jitdump
Posted by Richard Henderson 1 year, 3 months ago
On 1/12/23 07:20, Ilya Leoshkevich wrote:
> v3 -> v4:
> * s/unsigned long long/uint64_t/g (Richard).
> * Fix address resolution with TARGET_TB_PCREL again.
>    * Open question: do we need something like get_pc_from_opc()?
>      See FIXME in patch 3.

Looks good.  I'll queue this to tcg-next.

Ideally, we'd update the dockerfiles so that libdw is present during CI, mostly ensuring 
that the code builds everywhere.  However, my attempts to do so failed.  I suspect that 
we'd need some sort of update to lcitool to make that happen.

Alex or Thomas, any ideas there?


r~