Skip to content

perf tools: Fix vmlinux search path initialization

Namhyung Kim lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13perf script: Fix possible memory leakstools/perf/builtin-script.c+22 -133 replies
2/13perf tools: Fix a memory leak in vmlinux_path__init()tools/perf/util/symbol.c+1 -10 replies
3/13perf annotate: Move session handling out of __cmd_annotate()tools/perf/builtin-annotate.c+40 -352 replies
4/13perf buildid-cache: Move session handling into cmd_buildid_cache()tools/perf/builtin-buildid-cache.c+21 -140 replies
5/13perf inject: Move session handling out of __cmd_inject()tools/perf/builtin-inject.c+17 -120 replies
6/13perf kmem: Move session handling out of __cmd_kmem()tools/perf/builtin-kmem.c+28 -210 replies
7/13perf kvm: Move call to symbol__init() after creating sessiontools/perf/builtin-kvm.c+2 -20 replies
8/13perf lock: Move call to symbol__init() after creating sessiontools/perf/builtin-lock.c+2 -10 replies
9/13perf sched: Move call to symbol__init() after creating sessiontools/perf/builtin-sched.c+2 -10 replies
10/13perf script: Move call to symbol__init() after creating sessiontools/perf/builtin-script.c+3 -20 replies
11/13perf timechart: Move call to symbol__init() after creating sessiontools/perf/builtin-timechart.c+2 -20 replies
12/13perf trace: Move call to symbol__init() after creating sessiontools/perf/builtin-trace.c+3 -30 replies
13/13perf tools: Check recorded kernel version when finding vmlinuxtools/perf/builtin-annotate.c tools/perf/builtin-buildid-cache.c tools/perf/builtin-diff.c +16 more+39 -300 replies

Reviews trailers per patch

None of the 13 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJiri Olsa
SeriesA-b
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13

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

Read the v1 thread

Cover letter [PATCHSET 00/13] perf tools: Fix vmlinux search path initialization

Hello,

Currently, when perf reports kernel symbols, it tries to look up the sample ip from kallsyms/vmlinux in the build-id cache, and then a running kernel. This can be a problem if it's recorded on a different kernel and failed to find it from the build-id cache for some reason.

We can fix it by using --symfs option but it's annoying for user to do it always. As we already have the kernel version info in the perf.data file, it'd be better to change it to use the info to search the correct file automatically.

Minchan Kim reported this during his kernel work. And this patchset fixes it by using the recorded kernel info.

The patch 1 and 2 are independent fixes so can be applied separately. The patch 3 to 12 are preparation for the patch 13 which move symbol__init() after creating a session.

Before:

  $ perf report
  ...
  # Samples: 4K of event 'cpu-clock'
  # Event count (approx.): 1067250000
  #
  # Overhead  Command     Shared Object      Symbol
  # ........  ..........  .................  ..............................
      71.87%     swapper  [kernel.kallsyms]  [k] recover_probed_instruction

After:

  # Overhead  Command     Shared Object      Symbol
  # ........  ..........  .................  ....................
      71.87%     swapper  [kernel.kallsyms]  [k] native_safe_halt

You can also get it from 'perf/vmlinux-v1' branch on my tree:

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Any comments are welcome.

Thanks,
Namhyung

Namhyung Kim (13):
perf script: Fix possible memory leaks
perf tools: Fix a memory leak in vmlinux_path__init() perf annotate: Move session handling out of __cmd_annotate() perf buildid-cache: Move session handling into cmd_buildid_cache() perf inject: Move session handling out of __cmd_inject() perf kmem: Move session handling out of __cmd_kmem() perf kvm: Move call to symbol__init() after creating session perf lock: Move call to symbol__init() after creating session perf sched: Move call to symbol__init() after creating session perf script: Move call to symbol__init() after creating session perf timechart: Move call to symbol__init() after creating session perf trace: Move call to symbol__init() after creating session perf tools: Check recorded kernel version when finding vmlinux

 tools/perf/builtin-annotate.c      | 75 ++++++++++++++++++++------------------
 tools/perf/builtin-buildid-cache.c | 37 +++++++++++--------
 tools/perf/builtin-diff.c          |  2 +-
 tools/perf/builtin-inject.c        | 31 +++++++++-------
 tools/perf/builtin-kmem.c          | 49 ++++++++++++++-----------
 tools/perf/builtin-kvm.c           |  6 +--
 tools/perf/builtin-lock.c          |  3 +-
 tools/perf/builtin-mem.c           |  2 +-
 tools/perf/builtin-record.c        |  2 +-
 tools/perf/builtin-report.c        |  2 +-
 tools/perf/builtin-sched.c         |  3 +-
 tools/perf/builtin-script.c        | 40 ++++++++++++--------
 tools/perf/builtin-timechart.c     |  4 +-
 tools/perf/builtin-top.c           |  2 +-
 tools/perf/builtin-trace.c         |  8 ++--
 tools/perf/tests/builtin-test.c    |  2 +-
 tools/perf/util/probe-event.c      |  2 +-
 tools/perf/util/symbol.c           | 26 ++++++++-----
 tools/perf/util/symbol.h           |  3 +-
 19 files changed, 172 insertions(+), 127 deletions(-)
Signature · 1 line
2.0.0