Skip to content

perf tools: Add support for build id with different sizes

Jiri Olsa lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 6 repliesIn review
  2. v19 patches 14 repliesSuperseded

Changes in v2 from the cover letter

- rebased on current perf/core
- updated test to build its own binaries [Namhyung]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9perf tools: Use build_id object in dsotools/perf/bench/inject-buildid.c tools/perf/builtin-buildid-cache.c tools/perf/builtin-inject.c +12 more+34 -290 replies
2/9perf tools: Pass build_id object to filename__read_build_idtools/perf/bench/inject-buildid.c tools/perf/builtin-buildid-cache.c tools/perf/builtin-inject.c +8 more+60 -570 replies
3/9perf tools: Pass build id object to sysfs__read_build_idtools/perf/util/build-id.c tools/perf/util/dso.c tools/perf/util/symbol-elf.c +3 more+16 -230 replies
4/9perf tools: Pass build_id object to build_id__sprintftools/perf/builtin-buildid-cache.c tools/perf/tests/sdt.c tools/perf/util/annotate.c +9 more+43 -350 replies
5/9perf tools: Pass build_id object to dso__set_build_idtools/perf/util/dso.c tools/perf/util/dso.h tools/perf/util/header.c +2 more+8 -62 replies
6/9perf tools: Pass build_id object to dso__build_id_equaltools/perf/util/dso.c tools/perf/util/dso.h tools/perf/util/symbol-elf.c +1 more+11 -60 replies
7/9perf tools: Add size to struct perf_record_header_build_idtools/lib/perf/include/perf/event.h tools/perf/util/build-id.c tools/perf/util/header.c+23 -74 replies
8/9perf tools: Align buildid list output for short build idstools/perf/util/dso.c tools/perf/util/dso.h tools/perf/util/dsos.c+5 -40 replies
9/9perf tools: Add build id shell testtools/perf/tests/shell/buildid.sh+101 -00 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchIan Rogers
1/9A-b
2/9A-b
3/9A-b
4/9A-b
5/9A-b
6/9A-b
7/9A-b
8/9A-b
9/9A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 0/9] perf tools: Add support for build id with different sizes

hi,
currently we support only one storage size (20 bytes) for build ids. That fits for SHA1 build ids, but there can in theory be any size. The gcc linker supports also MD5, which is 16 bytes.

Currently the MD5 build id will be stored in .debug cache with additional zeros, like:

  $ find ~/.debug
  .../.debug/.build-id/a5/0e350e97c43b4708d09bcd85ebfff700000000
  ...
  .../buildid-ex-md5/a50e350e97c43b4708d09bcd85ebfff700000000
  .../buildid-ex-md5/a50e350e97c43b4708d09bcd85ebfff700000000/elf
  .../buildid-ex-md5/a50e350e97c43b4708d09bcd85ebfff700000000/probes

And the same reflected in buildid-list as well:

  $ perf buildid-list
  17f4e448cc746582ea1881528deb549f7fdb3fd5 [kernel.kallsyms]
  a50e350e97c43b4708d09bcd85ebfff700000000 .../buildid-ex-md5

This will cause problems in future when we will ask debuginfod for binaries/debuginfo based on build id.

This patchset is adding 'struct build_id' object, that holds the build id data and size and use it to store build ids and changes all related functions to use it.

Also available in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/build_id_size

v2 changes:
- rebased on current perf/core
- updated test to build its own binaries [Namhyung]

thanks,
jirka

---
Jiri Olsa (9):
perf tools: Use build_id object in dso
perf tools: Pass build_id object to filename__read_build_id perf tools: Pass build id object to sysfs__read_build_id perf tools: Pass build_id object to build_id__sprintf perf tools: Pass build_id object to dso__set_build_id perf tools: Pass build_id object to dso__build_id_equal perf tools: Add size to struct perf_record_header_build_id perf tools: Align buildid list output for short build ids perf tools: Add build id shell test

 tools/lib/perf/include/perf/event.h                    |  12 +++++++++++-
 tools/perf/bench/inject-buildid.c                      |   4 ++--
 tools/perf/builtin-buildid-cache.c                     |  25 ++++++++++++------------
 tools/perf/builtin-inject.c                            |   4 +---
 tools/perf/tests/pe-file-parsing.c                     |  10 +++++-----
 tools/perf/tests/sdt.c                                 |   6 +++---
 tools/perf/tests/shell/buildid.sh                      | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/annotate.c                             |   3 +--
 tools/perf/util/build-id.c                             |  48 +++++++++++++++++++++++++++-------------------
 tools/perf/util/build-id.h                             |   8 +++++++-
 tools/perf/util/dso.c                                  |  23 ++++++++++------------
 tools/perf/util/dso.h                                  |   7 +++----
 tools/perf/util/dsos.c                                 |   9 +++++----
 tools/perf/util/header.c                               |  15 ++++++++++-----
 tools/perf/util/map.c                                  |   4 +---
 tools/perf/util/probe-event.c                          |   9 ++++++---
 tools/perf/util/probe-finder.c                         |   8 +++++---
 tools/perf/util/scripting-engines/trace-event-python.c |   2 +-
 tools/perf/util/symbol-elf.c                           |  35 +++++++++++++++++++--------------
 tools/perf/util/symbol-minimal.c                       |  31 +++++++++++++++---------------
 tools/perf/util/symbol.c                               |  15 +++++++--------
 tools/perf/util/symbol.h                               |   5 +++--
 tools/perf/util/synthetic-events.c                     |   2 +-
 23 files changed, 260 insertions(+), 126 deletions(-)
 create mode 100755 tools/perf/tests/shell/buildid.sh