Skip to content

perf tool: Haswell LBR call stack support (user)

[email protected] lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 1 replyIn review
  2. v53 patches 14 repliesSuperseded
  3. v43 patches 5 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches21 repliesSuperseded
v23 patches3 repliesSuperseded
v12 patches12 repliesSuperseded

Changes in v6 from the cover letter

- Only remove the 2/3 and part of 1/3 which have already been merged.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf tools: enable LBR call stack supporttools/perf/Documentation/perf-record.txt tools/perf/builtin-record.c tools/perf/builtin-report.c +3 more+40 -60 replies
2/2perf tools: Construct LBR call chaintools/perf/util/evsel.h tools/perf/util/machine.c tools/perf/util/session.c+153 -170 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchJiri Olsa
1/2T-b
2/2T-b

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

Read the v6 thread

Cover letter [PATCH V6 0/2] perf tool: Haswell LBR call stack support (user)

From: Kan Liang <[email protected]>

This is the user space patch for Haswell LBR call stack support. For many profiling tasks we need the callgraph. For example we often need to see the caller of a lock or the caller of a memcpy or other library function to actually tune the program. Frame pointer unwinding is efficient and works well. But frame pointers are off by default on 64bit code (and on modern 32bit gccs), so there are many binaries around that do not use frame pointers. Profiling unchanged production code is very useful in practice. On some CPUs frame pointer also has a high cost. Dwarf2 unwinding also does not always work and is extremely slow (upto 20% overhead).

Haswell has a new feature that utilizes the existing Last Branch Record facility to record call chains. When the feature is enabled, function call will be collected as normal, but as return instructions are executed the last captured branch record is popped from the on-chip LBR registers. The LBR call stack facility provides an alternative to get callgraph. It has some limitations too, but should work in most cases and is significantly faster than dwarf. Frame pointer unwinding is still the best default, but LBR call stack is a good alternative when nothing else works.

Please find the kernel part patch at https://lkml.org/lkml/2014/11/6/432

Changes since v1
- Update help document
- Force exclude_user to 0 with warning in LBR call stack
- Dump both lbr and fp info when report -D
- Reconstruct thread__resolve_callchain_sample and split it into two patches
- Use has_branch_callstack function to check LBR call stack available

Changes since v2
- Rebase to 025ce5d33373

Changes since v3
- Rebase to cc502c23aadf
- Separated function for lbr call stack sample resolve and print
- Some minor changes according to comments

Changes since V4
- Rebase to 09a6a1b
- Falling back to framepointers if LBR not availabe, and warning user

Changes since V5
- Only remove the 2/3 and part of 1/3 which have already been merged.

Kan Liang (2):
perf tools: enable LBR call stack support
perf tools: Construct LBR call chain

 tools/perf/Documentation/perf-record.txt |   8 ++-
 tools/perf/builtin-record.c              |   6 +-
 tools/perf/builtin-report.c              |   2 +
 tools/perf/util/callchain.c              |   8 +++
 tools/perf/util/callchain.h              |   1 +
 tools/perf/util/evsel.c                  |  21 ++++++-
 tools/perf/util/evsel.h                  |   4 ++
 tools/perf/util/machine.c                | 102 +++++++++++++++++++++++++++----
 tools/perf/util/session.c                |  64 +++++++++++++++++--
 9 files changed, 193 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.3.2