Skip to content

perf trace: Fix support for the new BPF feature in clang 12

Howard Chu linux-perf-users lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 14 repliesIn review
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Resolved a clang-16 build error pointed out by Namhyung Kim <[email protected]>

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf build: Change the clang check back to 12.0.1tools/perf/Makefile.config+2 -20 replies
2/2perf trace: Rewrite BPF code to pass the verifiertools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c+67 -550 replies

Reviews trailers per patch

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

PatchJames Clark
SeriesT-b
1/2
2/2

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

Read the v2 thread

Cover letter [PATCH v2 0/2] perf trace: Fix support for the new BPF feature in clang 12

Changes in v2:
- Resolved a clang-16 build error pointed out by Namhyung Kim <[email protected]>

The new augmentation feature in perf trace, along with the protocol change (from payload to payload->value), breaks the clang 12 build.

perf trace actually builds for any clang version newer than clang 16. However, as pointed out by Namhyung Kim <[email protected]> and Ian Rogers <[email protected]>, clang 16, which was released in 2023, is still too new for most users. Additionally, as James Clark <[email protected]> noted, some commonly used distributions do not yet support clang 16. Therefore, breaking BPF features between clang 12 and clang 15 is not a good approach.

This patch series rewrites the BPF program in a way that allows it to pass the BPF verifier, even when the BPF bytecode is generated by older versions of clang.

However, I have only tested it till clang 14, as older versions are not supported by my distribution.

Howard Chu (2):
perf build: Change the clang check back to 12.0.1 perf trace: Rewrite BPF code to pass the verifier

 tools/perf/Makefile.config                    |   4 +-
 .../bpf_skel/augmented_raw_syscalls.bpf.c     | 122 ++++++++++--------
 2 files changed, 69 insertions(+), 57 deletions(-)
Signature · 1 line
2.43.0