Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL New Arnaldo Carvalho de Melo 2 participants 49 messages Sep 1, 2019 – Sep 2, 2019

Subsystems (4)
lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo/Thomas,

Please consider pulling,

Best regards,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 39c2ca43465e0f52ebba3ee96fd03436367c1880:

Merge tag 'perf-core-for-mingo-5.4-20190829' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2019-08-29 20:56:32 +0200)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.4-20190901

for you to fetch changes up to ae31a514a134d9e4ca1d7b0f0a19b5934747d79f:

objtool: Ignore intentional differences for the x86 insn decoder (2019-08-31 22:27:52 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

objtool:

Josh Poimboeuf:

- Move x86 insn decoder to a common location.

Arnaldo Carvalho de Melo:

- Ignore intentional differences for the x86 insn decoder.

build:

Arnaldo Carvalho de Melo:

- Ignore intentional differences for the x86 insn decoder.

Intel PT:

Josh Poimboeuf:

- Use shared x86 insn decoder.

metric groups:

Jin Yao:

- Scale the metric result.

- Support multiple events.

perf c2c:

Jiri Olsa:

- Display proper cpu count in nodes column.

Miscellaneous:

Kyle Meyer:

- Replace MAX_NR_CPUS with perf_env::nr_cpus_online, i.e. with the number of online CPUs as detected at tool start and/or recorded in the perf.data file.

libtraceevent:

Tzvetomir Stoyanov:

- Simplify the tep_print_event_* APIs.

- Remove tep_register_trace_clock().

- Change users plugin directory.

Cleanups:

Arnaldo Carvalho de Melo:

- Continue taming the includes hell: remove needless include directives, fix the fallout, rinse, repeat.

----------------------------------------------------------------
Arnaldo Carvalho de Melo (29):
perf tools: Remove needless libtraceevent include directives perf header: Move CPUINFO_PROC to the only file where it is used perf tools: Move everything related to sys_perf_event_open() to perf-sys.h perf time-utils: Adopt rdclock() from perf.h
perf tools: Remove needless perf.h include directive from headers perf tools: Remove perf.h from source files not needing it perf tools: Remove debug.h from header files not needing it perf debug: Remove needless include directives from debug.h perf env: Remove env.h from other headers where just a fwd decl is needed perf event: Remove needless include directives from event.h perf dso: Adopt DSO related macros from symbol.h
perf symbol: Move C++ demangle defines to the only file using it perf symbols: Add missing linux/refcount.h to symbol.h
perf symbols: Move symsrc prototypes to a separate header perf dsos: Move the dsos struct and its methods to separate source files perf hist: Remove needless ui/progress.h from hist.h
perf tools: Move 'struct events_stats' and prototypes to separate header perf tools: Remove needless sort.h include directives
perf probe: No need for symbol.h, symbol_conf is enough
perf tools: Remove needless map.h include directives
perf tools: Remove needless thread.h include directives
perf tools: Remove needless thread_map.h include directives perf tools: Remove needless evlist.h include directives
perf tools: Remove needless evlist.h include directives
perf auxtrace: Uninline functions that touch perf_session perf symbols: Move mem_info and branch_info out of symbol.h perf build: Ignore intentional differences for the x86 insn decoder
objtool: Update sync-check.sh from perf's check-headers.sh
objtool: Ignore intentional differences for the x86 insn decoder

Jin Yao (3):
perf pmu: Change convert_scale from static to global perf metricgroup: Scale the metric result
perf metricgroup: Support multiple events for metricgroup

Jiri Olsa (1):
perf c2c: Display proper cpu count in nodes column

Josh Poimboeuf (4):
objtool: Move x86 insn decoder to a common location
perf: Update .gitignore file
perf intel-pt: Remove inat.c from build dependency list perf intel-pt: Use shared x86 insn decoder

Kyle Meyer (7):
perf timechart: Refactor svg_build_topology_map()
perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf stat: Replace MAX_NR_CPUS with cpu__max_cpu() perf session: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf machine: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf header: Replace MAX_NR_CPUS with cpu__max_cpu()
libperf: Warn when exceeding MAX_NR_CPUS in cpumap

Tzvetomir Stoyanov (3):
libtraceevent, perf tools: Changes in tep_print_event_* APIs
libtraceevent: Remove tep_register_trace_clock()
libtraceevent: Change users plugin directory

 .../x86/include/asm}/inat.h                        |    0
 .../arch/x86/include/asm/inat_types.h              |    0
 .../x86/include/asm}/insn.h                        |    0
 .../{objtool => }/arch/x86/include/asm/orc_types.h |    0
 tools/{objtool => }/arch/x86/lib/inat.c            |    2 +-
 tools/{objtool => }/arch/x86/lib/insn.c            |    4 +-
 .../{objtool => }/arch/x86/lib/x86-opcode-map.txt  |    0
 .../arch/x86/tools/gen-insn-attr-x86.awk           |    0
 tools/lib/traceevent/Makefile                      |    6 +-
 tools/lib/traceevent/event-parse-api.c             |   40 -
 tools/lib/traceevent/event-parse-local.h           |    6 -
 tools/lib/traceevent/event-parse.c                 |  333 +++---
 tools/lib/traceevent/event-parse.h                 |   30 +-
 tools/lib/traceevent/event-plugin.c                |    2 +-
 tools/objtool/Makefile                             |    4 +-
 tools/objtool/arch/x86/Build                       |    4 +-
 tools/objtool/arch/x86/decode.c                    |    4 +-
 tools/objtool/arch/x86/include/asm/inat.h          |  230 -----
 tools/objtool/arch/x86/include/asm/insn.h          |  216 ----
 tools/objtool/sync-check.sh                        |   44 +-
 tools/perf/.gitignore                              |    3 +
 tools/perf/arch/arm/annotate/instructions.c        |    1 +
 tools/perf/arch/arm/util/auxtrace.c                |    1 +
 tools/perf/arch/arm/util/cs-etm.c                  |    4 +-
 tools/perf/arch/arm64/annotate/instructions.c      |    1 +
 tools/perf/arch/arm64/util/sym-handling.c          |    8 +-
 tools/perf/arch/common.c                           |    3 +
 tools/perf/arch/common.h                           |    4 +-
 tools/perf/arch/powerpc/util/mem-events.c          |    1 +
 tools/perf/arch/powerpc/util/perf_regs.c           |    1 -
 tools/perf/arch/powerpc/util/sym-handling.c        |    1 +
 tools/perf/arch/powerpc/util/unwind-libdw.c        |    1 +
 tools/perf/arch/x86/tests/bp-modify.c              |    1 +
 tools/perf/arch/x86/tests/insn-x86.c               |    3 +-
 tools/perf/arch/x86/tests/intel-cqm.c              |    1 -
 tools/perf/arch/x86/tests/perf-time-to-tsc.c       |    2 +
 tools/perf/arch/x86/tests/rdpmc.c                  |    4 +-
 tools/perf/arch/x86/util/archinsn.c                |    3 +-
 tools/perf/arch/x86/util/perf_regs.c               |    4 +-
 tools/perf/arch/x86/util/tsc.c                     |    2 +-
 tools/perf/bench/epoll-ctl.c                       |    1 +
 tools/perf/bench/epoll-wait.c                      |    1 +
 tools/perf/bench/mem-functions.c                   |    3 +-
 tools/perf/bench/numa.c                            |    1 -
 tools/perf/bench/sched-messaging.c                 |    1 -
 tools/perf/bench/sched-pipe.c                      |    1 -
 tools/perf/builtin-annotate.c                      |    4 +-
 tools/perf/builtin-bench.c                         |    1 -
 tools/perf/builtin-buildid-cache.c                 |    5 +-
 tools/perf/builtin-buildid-list.c                  |    4 +-
 tools/perf/builtin-c2c.c                           |    7 +-
 tools/perf/builtin-config.c                        |    3 +-
 tools/perf/builtin-data.c                          |    2 +
 tools/perf/builtin-diff.c                          |    2 +
 tools/perf/builtin-ftrace.c                        |    5 +-
 tools/perf/builtin-help.c                          |    5 +-
 tools/perf/builtin-inject.c                        |    2 +-
 tools/perf/builtin-kallsyms.c                      |    1 +
 tools/perf/builtin-kmem.c                          |    5 +-
 tools/perf/builtin-kvm.c                           |    5 +-
 tools/perf/builtin-list.c                          |    5 +-
 tools/perf/builtin-lock.c                          |    4 +-
 tools/perf/builtin-mem.c                           |    2 +
 tools/perf/builtin-probe.c                         |    5 +-
 tools/perf/builtin-record.c                        |    2 +
 tools/perf/builtin-report.c                        |    7 +
 tools/perf/builtin-sched.c                         |    3 +-
 tools/perf/builtin-script.c                        |    4 +-
 tools/perf/builtin-stat.c                          |    3 +-
 tools/perf/builtin-timechart.c                     |   10 +-
 tools/perf/builtin-top.c                           |    5 +-
 tools/perf/builtin-trace.c                         |    4 +
 tools/perf/builtin-version.c                       |    2 +-
 tools/perf/check-headers.sh                        |   11 +-
 tools/perf/lib/cpumap.c                            |    6 +
 tools/perf/perf-sys.h                              |   51 +-
 tools/perf/perf.c                                  |    7 +-
 tools/perf/perf.h                                  |   21 -
 tools/perf/scripts/perl/Perf-Trace-Util/Context.c  |    1 -
 .../perf/scripts/python/Perf-Trace-Util/Context.c  |    1 -
 tools/perf/tests/attr.c                            |    3 +-
 tools/perf/tests/backward-ring-buffer.c            |    2 +
 tools/perf/tests/bp_account.c                      |    3 +-
 tools/perf/tests/bp_signal.c                       |    3 +-
 tools/perf/tests/bp_signal_overflow.c              |    3 +-
 tools/perf/tests/bpf.c                             |    2 +
 tools/perf/tests/builtin-test.c                    |    1 +
 tools/perf/tests/code-reading.c                    |    8 +
 tools/perf/tests/dso-data.c                        |    1 +
 tools/perf/tests/dwarf-unwind.c                    |    1 +
 tools/perf/tests/event-times.c                     |    2 +
 tools/perf/tests/event_update.c                    |    3 +
 tools/perf/tests/expr.c                            |    1 +
 tools/perf/tests/hists_common.c                    |    3 +-
 tools/perf/tests/hists_cumulate.c                  |    2 +-
 tools/perf/tests/hists_filter.c                    |    2 -
 tools/perf/tests/hists_link.c                      |    2 -
 tools/perf/tests/hists_output.c                    |    2 +-
 tools/perf/tests/keep-tracking.c                   |    2 +
 tools/perf/tests/kmod-path.c                       |    2 +
 tools/perf/tests/llvm.c                            |    2 +-
 tools/perf/tests/mem.c                             |    1 +
 tools/perf/tests/mem2node.c                        |    2 +
 tools/perf/tests/mmap-basic.c                      |    3 +
 tools/perf/tests/openat-syscall-all-cpus.c         |    1 +
 tools/perf/tests/openat-syscall-tp-fields.c        |    1 +
 tools/perf/tests/openat-syscall.c                  |    1 +
 tools/perf/tests/parse-events.c                    |    1 +
 tools/perf/tests/perf-record.c                     |    1 +
 tools/perf/tests/sample-parsing.c                  |    2 +
 tools/perf/tests/sdt.c                             |    3 +-
 tools/perf/tests/sw-clock.c                        |    2 +
 tools/perf/tests/switch-tracking.c                 |    2 +
 tools/perf/tests/task-exit.c                       |    2 +
 tools/perf/tests/thread-map.c                      |    7 +
 tools/perf/tests/thread-mg-share.c                 |    1 -
 tools/perf/tests/unit_number__scnprintf.c          |    1 +
 tools/perf/tests/vmlinux-kallsyms.c                |    1 +
 tools/perf/tests/wp.c                              |    5 +
 tools/perf/ui/browser.c                            |    1 -
 tools/perf/ui/browsers/annotate.c                  |    2 +
 tools/perf/ui/browsers/header.c                    |    1 -
 tools/perf/ui/browsers/hists.c                     |    6 +
 tools/perf/ui/browsers/map.c                       |    1 +
 tools/perf/ui/browsers/res_sample.c                |    3 +
 tools/perf/ui/browsers/scripts.c                   |    4 +-
 tools/perf/ui/gtk/annotate.c                       |    1 +
 tools/perf/ui/gtk/browser.c                        |    2 -
 tools/perf/ui/gtk/helpline.c                       |    1 +
 tools/perf/ui/gtk/hists.c                          |    1 -
 tools/perf/ui/gtk/setup.c                          |    1 -
 tools/perf/ui/gtk/util.c                           |    1 +
 tools/perf/ui/helpline.h                           |    2 -
 tools/perf/ui/hist.c                               |    4 +
 tools/perf/ui/progress.c                           |    1 -
 tools/perf/ui/setup.c                              |    3 +-
 tools/perf/ui/stdio/hist.c                         |    1 +
 tools/perf/ui/tui/helpline.c                       |    2 +
 tools/perf/ui/tui/progress.c                       |    1 -
 tools/perf/ui/tui/setup.c                          |    3 +-
 tools/perf/ui/tui/util.c                           |    1 -
 tools/perf/ui/util.c                               |    2 +-
 tools/perf/util/Build                              |    1 +
 tools/perf/util/annotate.c                         |    5 +-
 tools/perf/util/arm-spe.c                          |    4 +-
 tools/perf/util/auxtrace.c                         |   33 +
 tools/perf/util/auxtrace.h                         |   52 +-
 tools/perf/util/bpf-event.c                        |    1 +
 tools/perf/util/bpf-event.h                        |    1 +
 tools/perf/util/bpf-loader.c                       |    2 +-
 tools/perf/util/bpf-prologue.c                     |    2 +-
 tools/perf/util/branch.c                           |    3 +-
 tools/perf/util/branch.h                           |    8 +
 tools/perf/util/build-id.c                         |    1 +
 tools/perf/util/cacheline.c                        |    1 -
 tools/perf/util/callchain.c                        |    3 +
 tools/perf/util/callchain.h                        |    1 +
 tools/perf/util/cgroup.c                           |    3 +-
 tools/perf/util/cloexec.c                          |    4 +-
 tools/perf/util/color.c                            |    3 +-
 tools/perf/util/color_config.c                     |    3 +-
 tools/perf/util/config.c                           |    4 +
 tools/perf/util/cpumap.c                           |    1 -
 tools/perf/util/cputopo.h                          |    1 -
 tools/perf/util/cs-etm.c                           |    6 +-
 tools/perf/util/cs-etm.h                           |    3 +-
 tools/perf/util/data.c                             |    1 +
 tools/perf/util/db-export.c                        |    1 +
 tools/perf/util/debug.c                            |    6 +-
 tools/perf/util/debug.h                            |    6 +-
 tools/perf/util/dso.c                              |  237 +----
 tools/perf/util/dso.h                              |   28 +-
 tools/perf/util/dsos.c                             |  232 +++++
 tools/perf/util/dsos.h                             |   44 +
 tools/perf/util/dwarf-aux.c                        |    1 +
 tools/perf/util/dwarf-aux.h                        |    2 +
 tools/perf/util/env.c                              |    1 +
 tools/perf/util/event.c                            |    5 +-
 tools/perf/util/event.h                            |   61 +-
 tools/perf/util/events_stats.h                     |   51 +
 tools/perf/util/evlist.c                           |    3 +
 tools/perf/util/evlist.h                           |    3 +-
 tools/perf/util/evsel.c                            |    2 +
 tools/perf/util/evsel.h                            |    1 +
 tools/perf/util/expr.y                             |    2 +
 tools/perf/util/genelf.c                           |    3 +-
 tools/perf/util/genelf_debug.c                     |    1 -
 tools/perf/util/header.c                           |   27 +-
 tools/perf/util/hist.c                             |    7 +
 tools/perf/util/hist.h                             |    6 +-
 tools/perf/util/intel-bts.c                        |    2 +-
 tools/perf/util/intel-pt-decoder/Build             |   22 +-
 .../util/intel-pt-decoder/gen-insn-attr-x86.awk    |  392 -------
 tools/perf/util/intel-pt-decoder/inat.c            |   82 --
 tools/perf/util/intel-pt-decoder/inat_types.h      |   15 -
 tools/perf/util/intel-pt-decoder/insn.c            |  593 -----------
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |    2 +-
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |   10 +-
 .../perf/util/intel-pt-decoder/x86-opcode-map.txt  | 1072 --------------------
 tools/perf/util/intel-pt.c                         |    2 +-
 tools/perf/util/jitdump.c                          |    1 +
 tools/perf/util/llvm-utils.c                       |    1 +
 tools/perf/util/llvm-utils.h                       |    2 +-
 tools/perf/util/lzma.c                             |    1 +
 tools/perf/util/machine.c                          |   18 +-
 tools/perf/util/machine.h                          |    3 +-
 tools/perf/util/map.c                              |    3 +
 tools/perf/util/mem-events.c                       |    2 +-
 tools/perf/util/mem-events.h                       |    9 +
 tools/perf/util/mem2node.c                         |    2 +
 tools/perf/util/mem2node.h                         |    3 +-
 tools/perf/util/metricgroup.c                      |   89 +-
 tools/perf/util/metricgroup.h                      |    1 +
 tools/perf/util/mmap.c                             |    4 +
 tools/perf/util/mmap.h                             |    1 +
 tools/perf/util/ordered-events.c                   |    1 +
 tools/perf/util/parse-branch-options.c             |    3 +-
 tools/perf/util/parse-events.c                     |    4 +-
 tools/perf/util/path.c                             |    3 +-
 tools/perf/util/path.h                             |    3 +
 tools/perf/util/perf-hooks.c                       |    1 +
 tools/perf/util/pmu.c                              |    9 +-
 tools/perf/util/pmu.h                              |    2 +
 tools/perf/util/probe-event.c                      |    6 +-
 tools/perf/util/probe-file.c                       |    4 +-
 tools/perf/util/probe-finder.c                     |    1 +
 tools/perf/util/pstack.c                           |    1 +
 tools/perf/util/python.c                           |    4 +
 tools/perf/util/record.c                           |    4 +
 tools/perf/util/s390-cpumsf.c                      |    2 +-
 tools/perf/util/s390-sample-raw.c                  |    2 -
 .../perf/util/scripting-engines/trace-event-perl.c |    2 +-
 .../util/scripting-engines/trace-event-python.c    |    3 +-
 tools/perf/util/session.c                          |   10 +-
 tools/perf/util/sort.c                             |    9 +-
 tools/perf/util/sort.h                             |    1 -
 tools/perf/util/stat-display.c                     |    1 +
 tools/perf/util/stat-shadow.c                      |   65 +-
 tools/perf/util/stat.c                             |    8 +-
 tools/perf/util/strbuf.c                           |    5 +
 tools/perf/util/svghelper.c                        |   54 +-
 tools/perf/util/svghelper.h                        |    4 +-
 tools/perf/util/symbol-elf.c                       |    7 +
 tools/perf/util/symbol-minimal.c                   |    2 +
 tools/perf/util/symbol.c                           |    5 +
 tools/perf/util/symbol.h                           |   63 +-
 tools/perf/util/symbol_fprintf.c                   |    1 +
 tools/perf/util/symsrc.h                           |   46 +
 tools/perf/util/target.c                           |    3 +
 tools/perf/util/thread-stack.c                     |    1 +
 tools/perf/util/thread.c                           |    2 +-
 tools/perf/util/time-utils.c                       |    1 -
 tools/perf/util/time-utils.h                       |    9 +
 tools/perf/util/top.c                              |    1 +
 tools/perf/util/top.h                              |    1 +
 tools/perf/util/trace-event-info.c                 |    1 -
 tools/perf/util/trace-event-parse.c                |    3 +-
 tools/perf/util/trace-event-read.c                 |    1 -
 tools/perf/util/trace-event-scripting.c            |    1 -
 tools/perf/util/trace-event.h                      |    1 -
 tools/perf/util/trigger.h                          |    1 -
 tools/perf/util/unwind-libdw.c                     |    1 +
 tools/perf/util/unwind-libunwind.c                 |    1 +
 tools/perf/util/util.c                             |    2 +-
 tools/perf/util/values.c                           |    1 +
 tools/perf/util/vdso.c                             |    1 +
 tools/perf/util/zlib.c                             |    1 +
 267 files changed, 1319 insertions(+), 3578 deletions(-)
 rename tools/{perf/util/intel-pt-decoder => arch/x86/include/asm}/inat.h (100%)
 rename tools/{objtool => }/arch/x86/include/asm/inat_types.h (100%)
 rename tools/{perf/util/intel-pt-decoder => arch/x86/include/asm}/insn.h (100%)
 rename tools/{objtool => }/arch/x86/include/asm/orc_types.h (100%)
 rename tools/{objtool => }/arch/x86/lib/inat.c (98%)
 rename tools/{objtool => }/arch/x86/lib/insn.c (99%)
 rename tools/{objtool => }/arch/x86/lib/x86-opcode-map.txt (100%)
 rename tools/{objtool => }/arch/x86/tools/gen-insn-attr-x86.awk (100%)
 delete mode 100644 tools/objtool/arch/x86/include/asm/inat.h
 delete mode 100644 tools/objtool/arch/x86/include/asm/insn.h
 create mode 100644 tools/perf/util/dsos.c
 create mode 100644 tools/perf/util/dsos.h
 create mode 100644 tools/perf/util/events_stats.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/insn.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt
 create mode 100644 tools/perf/util/symsrc.h

Test results:

The first ones are container based builds of tools/perf with and without libelf support. Where clang is available, it is also used to build perf with/without libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang when clang and its devel libraries are installed.

The objtool and samples/bpf/ builds are disabled now that I'm switching from using the sources in a local volume to fetching them from a http server to build it inside the container, to make it easier to build in a container cluster. Those will come back later.

Several are cross builds, the ones with -x-ARCH and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.

Clearlinux is failing when building with libpython, but that is not a perf regression, will try to remove one compiler warning that is causing the problem when building some of the glue code files in the python files, outside perf.

  # export PERF_TARBALL=http://192.168.124.1/perf/perf-5.3.0-rc6.tar.xz
  # dm
   1 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final)
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final)
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final)
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0)
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1)
   6 alpine:3.9                    : Ok   gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1)
   7 alpine:3.10                   : Ok   gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0)
   8 alpine:edge                   : Ok   gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 8.0.1 (tags/RELEASE_801/final) (based on LLVM 8.0.1)
   9 amazonlinux:1                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final)
  10 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2)
  11 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  12 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  13 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  14 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  15 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), clang version 3.4.2 (tags/RELEASE_34/dot2-final)
  16 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 9.2.1 20190816 gcc-9-branch@274554, clang version 8.0.0 (tags/RELEASE_800/final)
  17 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u2) 4.9.2, Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
  18 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final)
  19 debian:10                     : Ok   gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final)
  20 debian:experimental           : Ok   gcc (Debian 9.2.1-4) 9.2.1 20190821, clang version 7.0.1-9+b1 (tags/RELEASE_701/final)
  21 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0
  22 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0
  23 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 8.3.0-7) 8.3.0
  24 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0
  25 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7), clang version 3.4.2 (tags/RELEASE_34/dot2-final)
  26 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final)
  27 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final)
  28 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final)
  29 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  30 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final)
  31 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final)
  32 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final)
  33 fedora:28                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final)
  34 fedora:29                     : Ok   gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 7.0.1 (Fedora 7.0.1-6.fc29)
  35 fedora:30                     : Ok   gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1), clang version 8.0.0 (Fedora 8.0.0-1.fc30)
  36 fedora:30-x-ARC-glibc         : Ok   arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225
  37 fedora:30-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225
  38 fedora:31                     : Ok   gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2), clang version 8.0.0 (Fedora 8.0.0-3.fc31.1)
  39 fedora:rawhide                : Ok   gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2), clang version 8.0.0 (Fedora 8.0.0-3.fc31.1)
  40 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0
  41 mageia:5                      : Ok   gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final)
  42 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final)
  43 mageia:7                      : Ok   gcc (Mageia 8.3.1-0.20190524.1.mga7) 8.3.1 20190524, clang version 8.0.0 (Mageia 8.0.0-1.mga7)
  44 manjaro:latest                : Ok   gcc (GCC) 9.1.0, clang version 8.0.1 (tags/RELEASE_801/final)
  45 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], clang version 5.0.1 (tags/RELEASE_501/final 312548)
  46 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], clang version 7.0.1 (tags/RELEASE_701/final 349238)
  47 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553)
  48 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 9.2.1 20190820 [gcc-9-branch revision 274748], clang version 8.0.1 (tags/RELEASE_801/final 366581)
  49 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  50 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.1), clang version 3.4.2 (tags/RELEASE_34/dot2-final)
  51 oraclelinux:8                 : Ok   gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3.0.1), clang version 7.0.1 (tags/RELEASE_701/final)
  52 ubuntu:12.04                  : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
  53 ubuntu:14.04                  : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
  54 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
  55 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  56 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  57 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  58 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  59 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  60 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  61 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
  62 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0
  63 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0
  64 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  65 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  66 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  67 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  68 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  69 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  70 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  71 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
  72 ubuntu:18.10                  : Ok   gcc (Ubuntu 8.3.0-6ubuntu1~18.10.1) 8.3.0, clang version 7.0.0-3 (tags/RELEASE_700/final)
  73 ubuntu:19.04                  : Ok   gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0, clang version 8.0.0-3 (tags/RELEASE_800/final)
  74 ubuntu:19.04-x-alpha          : Ok   alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
  75 ubuntu:19.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0
  76 ubuntu:19.04-x-hppa           : Ok   hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
  77 ubuntu:19.10                  : Ok   gcc (Ubuntu 9.2.1-4ubuntu1) 9.2.1 20190821, clang version 9.0.0-+rc2-1~exp1 (tags/RELEASE_900/rc2)
  #
  # uname -a
  Linux quaco 5.2.6-200.fc30.x86_64 #1 SMP Mon Aug 5 13:20:47 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  # git log --oneline -1
  ae31a514a134 objtool: Ignore intentional differences for the x86 insn decoder
  # perf version --build-options
  perf version 5.3.rc6.gae31a514a134
                   dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
      dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                   glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
                    gtk2: [ on  ]  # HAVE_GTK2_SUPPORT
           syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                  libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                  libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
                 libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
  numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
                 libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
               libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
                libslang: [ on  ]  # HAVE_SLANG_SUPPORT
               libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
               libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
      libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                    zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                    lzma: [ on  ]  # HAVE_LZMA_SUPPORT
               get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                     bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                     aio: [ on  ]  # HAVE_AIO_SUPPORT
                    zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
  # perf test
   1: vmlinux symtab matches kallsyms                       : Ok
   2: Detect openat syscall event                           : Ok
   3: Detect openat syscall event on all cpus               : Ok
   4: Read samples using the mmap interface                 : Ok
   5: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Breakpoint accounting                                 : Ok
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Skip
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
  23: Number of exit events of a simple workload            : Ok
  24: Software clock events period values                   : Ok
  25: Object code reading                                   : Ok
  26: Sample parsing                                        : Ok
  27: Use a dummy software event to keep tracking           : Ok
  28: Parse with no sample_id_all bit set                   : Ok
  29: Filter hist entries                                   : Ok
  30: Lookup mmap thread                                    : Ok
  31: Share thread mg                                       : Ok
  32: Sort output of hist entries                           : Ok
  33: Cumulate child hist entries                           : Ok
  34: Track with sched_switch                               : Ok
  35: Filter fds with revents mask in a fdarray             : Ok
  36: Add fd to a fdarray, making it autogrow               : Ok
  37: kmod_path__parse                                      : Ok
  38: Thread map                                            : Ok
  39: LLVM search and compile                               :
  39.1: Basic BPF llvm compile                              : Ok
  39.2: kbuild searching                                    : Ok
  39.3: Compile source for BPF prologue generation          : Ok
  39.4: Compile source for BPF relocation                   : Ok
  40: Session topology                                      : Ok
  41: BPF filter                                            :
  41.1: Basic BPF filtering                                 : Ok
  41.2: BPF pinning                                         : Ok
  41.3: BPF prologue generation                             : Ok
  41.4: BPF relocation checker                              : Ok
  42: Synthesize thread map                                 : Ok
  43: Remove thread map                                     : Ok
  44: Synthesize cpu map                                    : Ok
  45: Synthesize stat config                                : Ok
  46: Synthesize stat                                       : Ok
  47: Synthesize stat round                                 : Ok
  48: Synthesize attr update                                : Ok
  49: Event times                                           : Ok
  50: Read backward ring buffer                             : Ok
  51: Print cpu map                                         : Ok
  52: Probe SDT events                                      : Ok
  53: is_printable_array                                    : Ok
  54: Print bitmap                                          : Ok
  55: perf hooks                                            : Ok
  56: builtin clang support                                 : Skip (not compiled in)
  57: unit_number__scnprintf                                : Ok
  58: mem2node                                              : Ok
  59: time utils                                            : Ok
  60: map_groups__merge_in                                  : Ok
  61: x86 rdpmc                                             : Ok
  62: Convert perf time to TSC                              : Ok
  63: DWARF unwind                                          : Ok
  64: x86 instruction decoder - new instructions            : Ok
  65: Intel PT packet decoder                               : Ok
  66: x86 bp modify                                         : Ok
  67: probe libc's inet_pton & backtrace it with ping       : Ok
  68: Use vfs_getname probe to get syscall args filenames   : Ok
  69: Add vfs_getname probe to get syscall args filenames   : Ok
  70: Check open filename arg using perf trace + vfs_getname: Ok
  71: Zstd perf.data compression/decompression              : Ok
  #
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
  - /home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP: make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP  feature-dump
  make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
           make_no_libunwind_O: make NO_LIBUNWIND=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
             make_util_map_o_O: make util/map.o
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
               make_no_slang_O: make NO_SLANG=1
                make_install_O: make install
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1 NO_LIBCAP=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
              make_clean_all_O: make clean all
                make_no_gtk2_O: make NO_GTK2=1
                   make_pure_O: make
              make_no_libelf_O: make NO_LIBELF=1
                  make_debug_O: make DEBUG=1
                make_no_newt_O: make NO_NEWT=1
           make_no_backtrace_O: make NO_BACKTRACE=1
             make_no_libperl_O: make NO_LIBPERL=1
                   make_help_O: make help
             make_no_libnuma_O: make NO_LIBNUMA=1
            make_no_demangle_O: make NO_DEMANGLE=1
                   make_tags_O: make tags
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
           make_no_libbionic_O: make NO_LIBBIONIC=1
           make_no_libpython_O: make NO_LIBPYTHON=1
  - /home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC: make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC  LDFLAGS='-static' feature-dump
  make FEATURE_DUMP_COPY=/home/acme/git/perf/tools/perf/BUILD_TEST_FEATURE_DUMP_STATIC LDFLAGS='-static' feature-dump
                 make_static_O: make LDFLAGS=-static
         make_with_clangllvm_O: make LIBCLANGLLVM=1
            make_install_bin_O: make install-bin
                 make_cscope_O: make cscope
                 make_perf_o_O: make perf.o
                    make_doc_O: make doc
              make_no_libbpf_O: make NO_LIBBPF=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
         make_install_prefix_O: make install prefix=/tmp/krava
        make_with_babeltrace_O: make LIBBABELTRACE=1
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $
author maintainer
#1 lore raw

PATCH 1/47 perf c2c: Display proper cpu count in nodes column

From: Jiri Olsa <[email protected]>

There's wrong bitmap considered when checking for cpu count of specific node.

We do the needed computation for 'set' variable, but at the end we use the 'c2c_he->cpuset' weight, which shows misleading numbers.

Fixes 1e181b92a2da ("perf c2c report: Add 'node' sort key")
Cc Alexander Shishkin <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/builtin-c2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-c2c.c +1 -1
index 73782d99ee5a..8335a4076a5a 100644
@@ -1107,7 +1107,7 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
 			break;
 		case 1:
 		{
-			int num = bitmap_weight(c2c_he->cpuset, c2c.cpus_cnt);
+			int num = bitmap_weight(set, c2c.cpus_cnt);
 			struct c2c_stats *stats = &c2c_he->node_stats[node];
 
 			ret = scnprintf(hpp->buf, hpp->size, "%2d{%2d ", node, num);
Signature · 1 line
2.21.0
author maintainer
#2 lore raw

PATCH 2/47 perf timechart: Refactor svg_build_topology_map()

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

Exchange the parameters of svg_build_topology_map() with 'struct perf_env *env' and adjust the function accordingly.

This patch should not change any behavior, it is merely refactoring for the following patch.

Committer notes:

No need to include env.h from svghelper.h, all it needs is a forward declaration for 'struct perf_env', so move the include directive to svghelper.c, where it is really needed.

---
 tools/perf/builtin-timechart.c |  5 +----
 tools/perf/util/svghelper.c    | 20 ++++++++++++--------
 tools/perf/util/svghelper.h    |  4 +++-
 3 files changed, 16 insertions(+), 13 deletions(-)
tools/perf/builtin-timechart.c +1 -4
index 7d6a6ecf4e02..1ff81a790931 100644
@@ -1518,10 +1518,7 @@ static int process_header(struct perf_file_section *section __maybe_unused,
 		if (!tchart->topology)
 			break;
 
-		if (svg_build_topology_map(ph->env.sibling_cores,
-					   ph->env.nr_sibling_cores,
-					   ph->env.sibling_threads,
-					   ph->env.nr_sibling_threads))
+		if (svg_build_topology_map(&ph->env))
 			fprintf(stderr, "problem building topology\n");
 		break;
 
tools/perf/util/svghelper.c +12 -8
index bbdd87163285..2e9971590590 100644
@@ -19,6 +19,7 @@
 #include <linux/zalloc.h>
 #include <perf/cpumap.h>
 
+#include "env.h"
 #include "perf.h"
 #include "svghelper.h"
 #include "cpumap.h"
@@ -752,23 +753,26 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 	return ret;
 }
 
-int svg_build_topology_map(char *sib_core, int sib_core_nr,
-			   char *sib_thr, int sib_thr_nr)
+int svg_build_topology_map(struct perf_env *env)
 {
 	int i;
 	struct topology t;
+	char *sib_core, *sib_thr;
 
-	t.sib_core_nr = sib_core_nr;
-	t.sib_thr_nr = sib_thr_nr;
-	t.sib_core = calloc(sib_core_nr, sizeof(cpumask_t));
-	t.sib_thr = calloc(sib_thr_nr, sizeof(cpumask_t));
+	t.sib_core_nr = env->nr_sibling_cores;
+	t.sib_thr_nr = env->nr_sibling_threads;
+	t.sib_core = calloc(env->nr_sibling_cores, sizeof(cpumask_t));
+	t.sib_thr = calloc(env->nr_sibling_threads, sizeof(cpumask_t));
+
+	sib_core = env->sibling_cores;
+	sib_thr = env->sibling_threads;
 
 	if (!t.sib_core || !t.sib_thr) {
 		fprintf(stderr, "topology: no memory\n");
 		goto exit;
 	}
 
-	for (i = 0; i < sib_core_nr; i++) {
+	for (i = 0; i < env->nr_sibling_cores; i++) {
 		if (str_to_bitmap(sib_core, &t.sib_core[i])) {
 			fprintf(stderr, "topology: can't parse siblings map\n");
 			goto exit;
@@ -777,7 +781,7 @@ int svg_build_topology_map(char *sib_core, int sib_core_nr,
 		sib_core += strlen(sib_core) + 1;
 	}
 
-	for (i = 0; i < sib_thr_nr; i++) {
+	for (i = 0; i < env->nr_sibling_threads; i++) {
 		if (str_to_bitmap(sib_thr, &t.sib_thr[i])) {
 			fprintf(stderr, "topology: can't parse siblings map\n");
 			goto exit;
tools/perf/util/svghelper.h +3 -1
index e55338d5c3bd..81823e8bae3e 100644
@@ -4,6 +4,8 @@
 
 #include <linux/types.h>
 
+struct perf_env;
+
 void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end);
 void svg_ubox(int Yslot, u64 start, u64 end, double height, const char *type, int fd, int err, int merges);
 void svg_lbox(int Yslot, u64 start, u64 end, double height, const char *type, int fd, int err, int merges);
@@ -28,7 +30,7 @@ void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc
 void svg_interrupt(u64 start, int row, const char *backtrace);
 void svg_text(int Yslot, u64 start, const char *text);
 void svg_close(void);
-int svg_build_topology_map(char *sib_core, int sib_core_nr, char *sib_thr, int sib_thr_nr);
+int svg_build_topology_map(struct perf_env *env);
 
 extern int svg_page_width;
 extern u64 svg_highlight;
Signature · 1 line
2.21.0
author maintainer
#3 lore raw

PATCH 3/47 perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

'nr_cpus', the number of CPUs online during a record session bound by MAX_NR_CPUS, can be used as a dynamic alternative for MAX_NR_CPUS in svg_build_topology_map().

The value of nr_cpus can be passed into str_to_bitmap(), scan_core_topology(), and svg_build_topology_map() to replace MAX_NR_CPUS as well.

---
 tools/perf/util/svghelper.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
tools/perf/util/svghelper.c +16 -17
index 2e9971590590..fef0f8a40e2f 100644
@@ -697,7 +697,8 @@ struct topology {
 	int sib_thr_nr;
 };
 
-static void scan_thread_topology(int *map, struct topology *t, int cpu, int *pos)
+static void scan_thread_topology(int *map, struct topology *t, int cpu,
+				 int *pos, int nr_cpus)
 {
 	int i;
 	int thr;
@@ -706,28 +707,24 @@ static void scan_thread_topology(int *map, struct topology *t, int cpu, int *pos
 		if (!test_bit(cpu, cpumask_bits(&t->sib_thr[i])))
 			continue;
 
-		for_each_set_bit(thr,
-				 cpumask_bits(&t->sib_thr[i]),
-				 MAX_NR_CPUS)
+		for_each_set_bit(thr, cpumask_bits(&t->sib_thr[i]), nr_cpus)
 			if (map[thr] == -1)
 				map[thr] = (*pos)++;
 	}
 }
 
-static void scan_core_topology(int *map, struct topology *t)
+static void scan_core_topology(int *map, struct topology *t, int nr_cpus)
 {
 	int pos = 0;
 	int i;
 	int cpu;
 
 	for (i = 0; i < t->sib_core_nr; i++)
-		for_each_set_bit(cpu,
-				 cpumask_bits(&t->sib_core[i]),
-				 MAX_NR_CPUS)
-			scan_thread_topology(map, t, cpu, &pos);
+		for_each_set_bit(cpu, cpumask_bits(&t->sib_core[i]), nr_cpus)
+			scan_thread_topology(map, t, cpu, &pos, nr_cpus);
 }
 
-static int str_to_bitmap(char *s, cpumask_t *b)
+static int str_to_bitmap(char *s, cpumask_t *b, int nr_cpus)
 {
 	int i;
 	int ret = 0;
@@ -740,7 +737,7 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 
 	for (i = 0; i < m->nr; i++) {
 		c = m->map[i];
-		if (c >= MAX_NR_CPUS) {
+		if (c >= nr_cpus) {
 			ret = -1;
 			break;
 		}
@@ -755,10 +752,12 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 
 int svg_build_topology_map(struct perf_env *env)
 {
-	int i;
+	int i, nr_cpus;
 	struct topology t;
 	char *sib_core, *sib_thr;
 
+	nr_cpus = min(env->nr_cpus_online, MAX_NR_CPUS);
+
 	t.sib_core_nr = env->nr_sibling_cores;
 	t.sib_thr_nr = env->nr_sibling_threads;
 	t.sib_core = calloc(env->nr_sibling_cores, sizeof(cpumask_t));
@@ -773,7 +772,7 @@ int svg_build_topology_map(struct perf_env *env)
 	}
 
 	for (i = 0; i < env->nr_sibling_cores; i++) {
-		if (str_to_bitmap(sib_core, &t.sib_core[i])) {
+		if (str_to_bitmap(sib_core, &t.sib_core[i], nr_cpus)) {
 			fprintf(stderr, "topology: can't parse siblings map\n");
 			goto exit;
 		}
@@ -782,7 +781,7 @@ int svg_build_topology_map(struct perf_env *env)
 	}
 
 	for (i = 0; i < env->nr_sibling_threads; i++) {
-		if (str_to_bitmap(sib_thr, &t.sib_thr[i])) {
+		if (str_to_bitmap(sib_thr, &t.sib_thr[i], nr_cpus)) {
 			fprintf(stderr, "topology: can't parse siblings map\n");
 			goto exit;
 		}
@@ -790,16 +789,16 @@ int svg_build_topology_map(struct perf_env *env)
 		sib_thr += strlen(sib_thr) + 1;
 	}
 
-	topology_map = malloc(sizeof(int) * MAX_NR_CPUS);
+	topology_map = malloc(sizeof(int) * nr_cpus);
 	if (!topology_map) {
 		fprintf(stderr, "topology: no memory\n");
 		goto exit;
 	}
 
-	for (i = 0; i < MAX_NR_CPUS; i++)
+	for (i = 0; i < nr_cpus; i++)
 		topology_map[i] = -1;
 
-	scan_core_topology(topology_map, &t);
+	scan_core_topology(topology_map, &t, nr_cpus);
 
 	return 0;
 
Signature · 1 line
2.21.0
author maintainer
#4 lore raw

PATCH 4/47 perf stat: Replace MAX_NR_CPUS with cpu__max_cpu()

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

The function cpu__max_cpu() returns the possible number of CPUs as defined in the sysfs and can be used as an alternative for MAX_NR_CPUS in zero_per_pkg() and check_per_pkg().

---
 tools/perf/util/stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/stat.c +2 -2
index 66f8808e57d3..f6eb6af5f151 100644
@@ -210,7 +210,7 @@ void perf_evlist__reset_stats(struct evlist *evlist)
 static void zero_per_pkg(struct evsel *counter)
 {
 	if (counter->per_pkg_mask)
-		memset(counter->per_pkg_mask, 0, MAX_NR_CPUS);
+		memset(counter->per_pkg_mask, 0, cpu__max_cpu());
 }
 
 static int check_per_pkg(struct evsel *counter,
@@ -229,7 +229,7 @@ static int check_per_pkg(struct evsel *counter,
 		return 0;
 
 	if (!mask) {
-		mask = zalloc(MAX_NR_CPUS);
+		mask = zalloc(cpu__max_cpu());
 		if (!mask)
 			return -ENOMEM;
 
Signature · 1 line
2.21.0
author maintainer
#5 lore raw

PATCH 5/47 perf session: Replace MAX_NR_CPUS with perf_env::nr_cpus_online

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

nr_cpus, the number of CPUs online during a record session bound by MAX_NR_CPUS, can be used as a dynamic alternative for MAX_NR_CPUS in perf_session__cpu_bitmap.

---
 tools/perf/util/session.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/session.c +2 -1
index 7350b0dfbc1e..13486bcf74a0 100644
@@ -2292,6 +2292,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
 {
 	int i, err = -1;
 	struct perf_cpu_map *map;
+	int nr_cpus = min(session->header.env.nr_cpus_online, MAX_NR_CPUS);
 
 	for (i = 0; i < PERF_TYPE_MAX; ++i) {
 		struct evsel *evsel;
@@ -2316,7 +2317,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
 	for (i = 0; i < map->nr; i++) {
 		int cpu = map->map[i];
 
-		if (cpu >= MAX_NR_CPUS) {
+		if (cpu >= nr_cpus) {
 			pr_err("Requested CPU %d too large. "
 			       "Consider raising MAX_NR_CPUS\n", cpu);
 			goto out_delete_map;
Signature · 1 line
2.21.0
author maintainer
#6 lore raw

PATCH 6/47 perf machine: Replace MAX_NR_CPUS with perf_env::nr_cpus_online

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

nr_cpus, the number of CPUs online during a record session bound by MAX_NR_CPUS, can be used as a dynamic alternative for MAX_NR_CPUS in __machine__synthesize_threads and machine__set_current_tid.

---
 tools/perf/util/machine.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
tools/perf/util/machine.c +7 -4
index 93483f1764d3..a1542b4c047b 100644
@@ -2619,7 +2619,9 @@ int __machine__synthesize_threads(struct machine *machine, struct perf_tool *too
 
 pid_t machine__get_current_tid(struct machine *machine, int cpu)
 {
-	if (cpu < 0 || cpu >= MAX_NR_CPUS || !machine->current_tid)
+	int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
+
+	if (cpu < 0 || cpu >= nr_cpus || !machine->current_tid)
 		return -1;
 
 	return machine->current_tid[cpu];
@@ -2629,6 +2631,7 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
 			     pid_t tid)
 {
 	struct thread *thread;
+	int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
 
 	if (cpu < 0)
 		return -EINVAL;
@@ -2636,14 +2639,14 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
 	if (!machine->current_tid) {
 		int i;
 
-		machine->current_tid = calloc(MAX_NR_CPUS, sizeof(pid_t));
+		machine->current_tid = calloc(nr_cpus, sizeof(pid_t));
 		if (!machine->current_tid)
 			return -ENOMEM;
-		for (i = 0; i < MAX_NR_CPUS; i++)
+		for (i = 0; i < nr_cpus; i++)
 			machine->current_tid[i] = -1;
 	}
 
-	if (cpu >= MAX_NR_CPUS) {
+	if (cpu >= nr_cpus) {
 		pr_err("Requested CPU %d too large. ", cpu);
 		pr_err("Consider raising MAX_NR_CPUS\n");
 		return -EINVAL;
Signature · 1 line
2.21.0
author maintainer
#7 lore raw

PATCH 7/47 perf header: Replace MAX_NR_CPUS with cpu__max_cpu()

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

The function cpu__max_cpu() returns the possible number of CPUs as defined in the sysfs and can be used as an alternative for MAX_NR_CPUS in write_cache.

MAX_CACHES is replaced by cpu__max_cpu() * MAX_CACHE_LVL.

---
 tools/perf/util/header.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/util/header.c +4 -3
index 0a842d9eff22..dd2bb0861ab1 100644
@@ -1122,16 +1122,17 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)
 	return 0;
 }
 
-#define MAX_CACHES (MAX_NR_CPUS * 4)
+#define MAX_CACHE_LVL 4
 
 static int write_cache(struct feat_fd *ff,
 		       struct evlist *evlist __maybe_unused)
 {
-	struct cpu_cache_level caches[MAX_CACHES];
+	u32 max_caches = cpu__max_cpu() * MAX_CACHE_LVL;
+	struct cpu_cache_level caches[max_caches];
 	u32 cnt = 0, i, version = 1;
 	int ret;
 
-	ret = build_caches(caches, MAX_CACHES, &cnt);
+	ret = build_caches(caches, max_caches, &cnt);
 	if (ret)
 		goto out;
 
Signature · 1 line
2.21.0
author maintainer
#8 lore raw

PATCH 8/47 libperf: Warn when exceeding MAX_NR_CPUS in cpumap

In reply to Arnaldo Carvalho de Melo

From: Kyle Meyer <[email protected]>

Display a warning when attempting to profile more than MAX_NR_CPU CPUs. This patch should not change any behavior.

---
 tools/perf/lib/cpumap.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/lib/cpumap.c +6 -0
index 2834753576b2..1f0e6f334237 100644
@@ -100,6 +100,9 @@ struct perf_cpu_map *perf_cpu_map__read(FILE *file)
 		if (prev >= 0) {
 			int new_max = nr_cpus + cpu - prev - 1;
 
+			WARN_ONCE(new_max >= MAX_NR_CPUS, "Perf can support %d CPUs. "
+							  "Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS);
+
 			if (new_max >= max_entries) {
 				max_entries = new_max + MAX_NR_CPUS / 2;
 				tmp = realloc(tmp_cpus, max_entries * sizeof(int));
@@ -192,6 +195,9 @@ struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list)
 			end_cpu = start_cpu;
 		}
 
+		WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. "
+						  "Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS);
+
 		for (; start_cpu <= end_cpu; start_cpu++) {
 			/* check for duplicates */
 			for (i = 0; i < nr_cpus; i++)
Signature · 1 line
2.21.0
author maintainer
#9 lore raw

PATCH 9/47 perf tools: Remove needless libtraceevent include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Remove traceevent/event-parse.h and traceevent/trace-seq.h from places where it is not needed.

Should avoid rebuilding those files when these traceevent headers get changed.

---
 tools/perf/builtin-timechart.c | 1 -
 tools/perf/util/session.c      | 1 -
 tools/perf/util/trace-event.h  | 1 -
 3 files changed, 3 deletions(-)
tools/perf/builtin-timechart.c +0 -1
index 1ff81a790931..1a74499f3311 100644
@@ -10,7 +10,6 @@
 
 #include <errno.h>
 #include <inttypes.h>
-#include <traceevent/event-parse.h>
 
 #include "builtin.h"
 #include "util/color.h"
tools/perf/util/session.c +0 -1
index 13486bcf74a0..9eb843e5e6f0 100644
@@ -4,7 +4,6 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
-#include <traceevent/event-parse.h>
 #include <api/fs/fs.h>
 
 #include <byteswap.h>
tools/perf/util/trace-event.h +0 -1
index 258d79071d81..2e158387b3d7 100644
@@ -3,7 +3,6 @@
 #define _PERF_UTIL_TRACE_EVENT_H
 
 #include <traceevent/event-parse.h>
-#include <traceevent/trace-seq.h>
 #include "parse-events.h"
 
 struct machine;
Signature · 1 line
2.21.0
author maintainer
#10 lore raw

PATCH 10/47 perf header: Move CPUINFO_PROC to the only file where it is used

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

To reduce perf-sys.h and eventually nuke it.

---
 tools/perf/perf-sys.h    | 44 ----------------------------------------
 tools/perf/util/header.c | 18 ++++++++++++++++
 2 files changed, 18 insertions(+), 44 deletions(-)
tools/perf/perf-sys.h +0 -44
index 3eb7a39169f6..6ffb0fbd6237 100644
@@ -10,50 +10,6 @@
 #include <linux/perf_event.h>
 #include <asm/barrier.h>
 
-#ifdef __powerpc__
-#define CPUINFO_PROC	{"cpu"}
-#endif
-
-#ifdef __s390__
-#define CPUINFO_PROC	{"vendor_id"}
-#endif
-
-#ifdef __sh__
-#define CPUINFO_PROC	{"cpu type"}
-#endif
-
-#ifdef __hppa__
-#define CPUINFO_PROC	{"cpu"}
-#endif
-
-#ifdef __sparc__
-#define CPUINFO_PROC	{"cpu"}
-#endif
-
-#ifdef __alpha__
-#define CPUINFO_PROC	{"cpu model"}
-#endif
-
-#ifdef __arm__
-#define CPUINFO_PROC	{"model name", "Processor"}
-#endif
-
-#ifdef __mips__
-#define CPUINFO_PROC	{"cpu model"}
-#endif
-
-#ifdef __arc__
-#define CPUINFO_PROC	{"Processor"}
-#endif
-
-#ifdef __xtensa__
-#define CPUINFO_PROC	{"core ID"}
-#endif
-
-#ifndef CPUINFO_PROC
-#define CPUINFO_PROC	{ "model name", }
-#endif
-
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
 		      pid_t pid, int cpu, int group_fd,
tools/perf/util/header.c +18 -0
index dd2bb0861ab1..d252124f926d 100644
@@ -436,7 +436,25 @@ static int __write_cpudesc(struct feat_fd *ff, const char *cpuinfo_proc)
 static int write_cpudesc(struct feat_fd *ff,
 		       struct evlist *evlist __maybe_unused)
 {
+#if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__)
+#define CPUINFO_PROC	{ "cpu", }
+#elif defined(__s390__)
+#define CPUINFO_PROC	{ "vendor_id", }
+#elif defined(__sh__)
+#define CPUINFO_PROC	{ "cpu type", }
+#elif defined(__alpha__) || defined(__mips__)
+#define CPUINFO_PROC	{ "cpu model", }
+#elif defined(__arm__)
+#define CPUINFO_PROC	{ "model name", "Processor", }
+#elif defined(__arc__)
+#define CPUINFO_PROC	{ "Processor", }
+#elif defined(__xtensa__)
+#define CPUINFO_PROC	{ "core ID", }
+#else
+#define CPUINFO_PROC	{ "model name", }
+#endif
 	const char *cpuinfo_procs[] = CPUINFO_PROC;
+#undef CPUINFO_PROC
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) {
Signature · 1 line
2.21.0
author maintainer
#11 lore raw

PATCH 11/47 perf tools: Move everything related to sys_perf_event_open() to perf-sys.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

And remove unneeded include directives from perf-sys.h to prune the header dependency tree.

Fixup the fallout in places where definitions were being used without the needed include directives that were being satisfied because they were in perf-sys.h.

---
 tools/perf/arch/common.c              |  1 +
 tools/perf/arch/x86/tests/rdpmc.c     |  2 +-
 tools/perf/arch/x86/util/perf_regs.c  |  2 +-
 tools/perf/arch/x86/util/tsc.c        |  1 +
 tools/perf/bench/epoll-ctl.c          |  1 +
 tools/perf/bench/epoll-wait.c         |  1 +
 tools/perf/bench/mem-functions.c      |  3 ++-
 tools/perf/builtin-sched.c            |  1 +
 tools/perf/perf-sys.h                 | 13 ++++++++++---
 tools/perf/perf.c                     |  1 +
 tools/perf/perf.h                     | 12 ------------
 tools/perf/tests/attr.c               |  2 +-
 tools/perf/tests/bp_account.c         |  2 +-
 tools/perf/tests/bp_signal.c          |  2 +-
 tools/perf/tests/bp_signal_overflow.c |  2 +-
 tools/perf/tests/wp.c                 |  2 ++
 tools/perf/util/auxtrace.h            |  1 +
 tools/perf/util/cloexec.c             |  2 +-
 tools/perf/util/evsel.c               |  1 +
 tools/perf/util/genelf.c              |  2 ++
 tools/perf/util/python.c              |  1 +
 tools/perf/util/record.c              |  1 +
 tools/perf/util/strbuf.c              |  1 +
 23 files changed, 34 insertions(+), 23 deletions(-)
tools/perf/arch/common.c +1 -0
index 1a9e22f78c22..a769382fb644 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "common.h"
 #include "../util/env.h"
 #include "../util/debug.h"
tools/perf/arch/x86/tests/rdpmc.c +1 -1
index 7a11f02d6c6c..345a6a0a328b 100644
@@ -7,7 +7,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <linux/types.h>
-#include "perf.h"
+#include "perf-sys.h"
 #include "debug.h"
 #include "tests/tests.h"
 #include "cloexec.h"
tools/perf/arch/x86/util/perf_regs.c +1 -1
index 0d7b77ff0ae6..74a606ea42d3 100644
@@ -4,7 +4,7 @@
 #include <regex.h>
 #include <linux/zalloc.h>
 
-#include "../../perf.h"
+#include "../../perf-sys.h"
 #include "../../util/perf_regs.h"
 #include "../../util/debug.h"
 
tools/perf/arch/x86/util/tsc.c +1 -0
index 81720e27f8a3..a6ba45d0db6e 100644
@@ -7,6 +7,7 @@
 
 #include "../../../perf.h"
 #include <linux/types.h>
+#include <asm/barrier.h>
 #include "../../../util/debug.h"
 #include "../../../util/tsc.h"
 
tools/perf/bench/epoll-ctl.c +1 -0
index 84658d45f349..d1caa4a0a12a 100644
@@ -14,6 +14,7 @@
 #include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <sys/time.h>
tools/perf/bench/epoll-wait.c +1 -0
index c27a65639cfb..f6b4472847d2 100644
@@ -63,6 +63,7 @@
 /* For the CLR_() macros */
 #include <string.h>
 #include <pthread.h>
+#include <unistd.h>
 
 #include <errno.h>
 #include <inttypes.h>
tools/perf/bench/mem-functions.c +2 -1
index 64dc994c72ea..9235b76501be 100644
@@ -8,7 +8,7 @@
  */
 
 #include "debug.h"
-#include "../perf.h"
+#include "../perf-sys.h"
 #include <subcmd/parse-options.h>
 #include "../util/header.h"
 #include "../util/cloexec.h"
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <linux/time64.h>
tools/perf/builtin-sched.c +1 -0
index 025151dcb651..91d0a9b10581 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "builtin.h"
 #include "perf.h"
+#include "perf-sys.h"
 
 #include "util/evlist.h"
 #include "util/cache.h"
tools/perf/perf-sys.h +10 -3
index 6ffb0fbd6237..63e4349a772a 100644
@@ -5,10 +5,17 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
-#include <linux/types.h>
 #include <linux/compiler.h>
-#include <linux/perf_event.h>
-#include <asm/barrier.h>
+
+struct perf_event_attr;
+
+extern bool test_attr__enabled;
+void test_attr__ready(void);
+void test_attr__init(void);
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+		     int fd, int group_fd, unsigned long flags);
+
+#define HAVE_ATTR_TEST
 
 static inline int
 sys_perf_event_open(struct perf_event_attr *attr,
tools/perf/perf.c +1 -0
index 34763a9b873d..a95a248a7421 100644
@@ -19,6 +19,7 @@
 #include "util/debug.h"
 #include "util/event.h"
 #include "util/util.h"
+#include "perf-sys.h"
 #include <api/fs/fs.h>
 #include <api/fs/tracing_path.h>
 #include <errno.h>
tools/perf/perf.h +0 -12
index d9e6b8b957b6..7a1a92127b9b 100644
@@ -4,18 +4,6 @@
 
 #include <time.h>
 #include <stdbool.h>
-#include <linux/types.h>
-#include <linux/stddef.h>
-#include <linux/perf_event.h>
-
-extern bool test_attr__enabled;
-void test_attr__ready(void);
-void test_attr__init(void);
-void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
-		     int fd, int group_fd, unsigned long flags);
-
-#define HAVE_ATTR_TEST
-#include "perf-sys.h"
 
 static inline unsigned long long rdclock(void)
 {
tools/perf/tests/attr.c +1 -1
index d8426547219b..87dc3e1174af 100644
@@ -30,7 +30,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include "../perf.h"
+#include "../perf-sys.h"
 #include <subcmd/exec-cmd.h>
 #include "tests.h"
 
tools/perf/tests/bp_account.c +1 -1
index 153624e2d0f5..c4a30318d7e0 100644
@@ -19,7 +19,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 
 volatile long the_var;
tools/perf/tests/bp_signal.c +1 -1
index 910e25e64188..2d292f8fb3dd 100644
@@ -25,7 +25,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "perf-sys.h"
 #include "cloexec.h"
 
 static int fd1;
tools/perf/tests/bp_signal_overflow.c +1 -1
index ca962559e845..101315a3b34f 100644
@@ -24,7 +24,7 @@
 
 #include "tests.h"
 #include "debug.h"
-#include "perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 
 static int overflows;
tools/perf/tests/wp.c +2 -0
index f89e6806557b..982ac55d69ea 100644
@@ -1,10 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/hw_breakpoint.h>
 #include "tests.h"
 #include "debug.h"
 #include "cloexec.h"
+#include "../perf-sys.h"
 
 #define WP_TEST_ASSERT_VAL(fd, text, val)       \
 do {                                            \
tools/perf/util/auxtrace.h +1 -0
index b213e6431d88..1fa8a965b03f 100644
@@ -15,6 +15,7 @@
 #include <linux/perf_event.h>
 #include <linux/types.h>
 #include <asm/bitsperlong.h>
+#include <asm/barrier.h>
 
 #include "../perf.h"
 #include "event.h"
tools/perf/util/cloexec.c +1 -1
index 06f48312c5ed..92d08198e64a 100644
@@ -2,7 +2,7 @@
 #include <errno.h>
 #include <sched.h>
 #include "util.h"
-#include "../perf.h"
+#include "../perf-sys.h"
 #include "cloexec.h"
 #include "asm/bug.h"
 #include "debug.h"
tools/perf/util/evsel.c +1 -0
index dbc04e1053a9..b6b406a1678f 100644
@@ -41,6 +41,7 @@
 #include "string2.h"
 #include "memswap.h"
 #include "util.h"
+#include "../perf-sys.h"
 #include "util/parse-branch-options.h"
 #include <internal/xyarray.h>
 
tools/perf/util/genelf.c +2 -0
index 7001247ebbd6..bc32f405b26e 100644
@@ -14,6 +14,7 @@
 #include <libelf.h>
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <fcntl.h>
@@ -25,6 +26,7 @@
 #include "perf.h"
 #include "genelf.h"
 #include "../util/jitdump.h"
+#include <linux/compiler.h>
 
 #ifndef NT_GNU_BUILD_ID
 #define NT_GNU_BUILD_ID 3
tools/perf/util/python.c +1 -0
index 11479a7ad1c7..9dd83871aafe 100644
@@ -14,6 +14,7 @@
 #include "thread_map.h"
 #include "mmap.h"
 #include "util.h"
+#include "../perf-sys.h"
 
 #if PY_MAJOR_VERSION < 3
 #define _PyUnicode_FromString(arg) \
tools/perf/util/record.c +1 -0
index 574507d46c98..c67a51397bc7 100644
@@ -10,6 +10,7 @@
 #include "util.h"
 #include "cloexec.h"
 #include "record.h"
+#include "../perf-sys.h"
 
 typedef void (*setup_probe_fn_t)(struct evsel *evsel);
 
tools/perf/util/strbuf.c +1 -0
index 2ce0dc887364..0afdbf38a2b2 100644
@@ -4,6 +4,7 @@
 #include <linux/zalloc.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 /*
  * Used as the default ->buf value, so that people can always assume
Signature · 1 line
2.21.0
author maintainer
#12 lore raw

PATCH 12/47 perf time-utils: Adopt rdclock() from perf.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Seems to be a better place for this function to live, further shrinking the hodge-podge that perf.h was.

---
 tools/perf/builtin-stat.c    | 1 +
 tools/perf/perf.h            | 9 ---------
 tools/perf/util/event.c      | 1 +
 tools/perf/util/time-utils.h | 9 +++++++++
 4 files changed, 11 insertions(+), 9 deletions(-)
tools/perf/builtin-stat.c +1 -0
index a7e8c26635db..2741bcb049fb 100644
@@ -62,6 +62,7 @@
 #include "util/string2.h"
 #include "util/metricgroup.h"
 #include "util/target.h"
+#include "util/time-utils.h"
 #include "util/top.h"
 #include "asm/bug.h"
 
tools/perf/perf.h +0 -9
index 7a1a92127b9b..74014033df60 100644
@@ -2,17 +2,8 @@
 #ifndef _PERF_PERF_H
 #define _PERF_PERF_H
 
-#include <time.h>
 #include <stdbool.h>
 
-static inline unsigned long long rdclock(void)
-{
-	struct timespec ts;
-
-	clock_gettime(CLOCK_MONOTONIC, &ts);
-	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
-}
-
 #ifndef MAX_NR_CPUS
 #define MAX_NR_CPUS			2048
 #endif
tools/perf/util/event.c +1 -0
index c9d1f83c747a..7fa7a303e476 100644
@@ -21,6 +21,7 @@
 #include "strlist.h"
 #include "thread.h"
 #include "thread_map.h"
+#include "time-utils.h"
 #include <linux/ctype.h>
 #include "map.h"
 #include "symbol.h"
tools/perf/util/time-utils.h +9 -0
index 72a42ea1d513..4f42988eb2f7 100644
@@ -3,6 +3,7 @@
 #define _TIME_UTILS_H_
 
 #include <stddef.h>
+#include <time.h>
 #include <linux/types.h>
 
 struct perf_time_interval {
@@ -34,4 +35,12 @@ int timestamp__scnprintf_nsec(u64 timestamp, char *buf, size_t sz);
 
 int fetch_current_timestamp(char *buf, size_t sz);
 
+static inline unsigned long long rdclock(void)
+{
+	struct timespec ts;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+}
+
 #endif
Signature · 1 line
2.21.0
author maintainer
#13 lore raw

PATCH 13/47 perf tools: Remove needless perf.h include directive from headers

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Its not needed there, add it to the places that need it and were getting it via those headers.

---
 tools/perf/builtin-c2c.c            | 1 +
 tools/perf/builtin-diff.c           | 1 +
 tools/perf/builtin-record.c         | 1 +
 tools/perf/builtin-script.c         | 1 +
 tools/perf/builtin-stat.c           | 1 +
 tools/perf/builtin-trace.c          | 1 +
 tools/perf/perf.c                   | 1 +
 tools/perf/ui/browsers/hists.c      | 1 +
 tools/perf/ui/browsers/res_sample.c | 1 +
 tools/perf/ui/browsers/scripts.c    | 1 +
 tools/perf/ui/hist.c                | 1 +
 tools/perf/ui/tui/setup.c           | 1 +
 tools/perf/util/auxtrace.h          | 1 -
 tools/perf/util/callchain.c         | 1 +
 tools/perf/util/event.c             | 1 +
 tools/perf/util/event.h             | 1 -
 tools/perf/util/evlist.c            | 1 +
 tools/perf/util/evlist.h            | 1 -
 tools/perf/util/mmap.c              | 1 +
 tools/perf/util/session.c           | 1 +
 tools/perf/util/top.c               | 1 +
 21 files changed, 18 insertions(+), 3 deletions(-)
tools/perf/builtin-c2c.c +1 -0
index 8335a4076a5a..25a5f186dfde 100644
@@ -35,6 +35,7 @@
 #include "thread.h"
 #include "mem2node.h"
 #include "symbol.h"
+#include "../perf.h"
 
 struct c2c_hists {
 	struct hists		hists;
tools/perf/builtin-diff.c +1 -0
index 51c37e53b3d8..ae4a8ebf90d2 100644
@@ -6,6 +6,7 @@
  * DSOs and symbol information, sort them and produce a diff.
  */
 #include "builtin.h"
+#include "perf.h"
 
 #include "util/debug.h"
 #include "util/event.h"
tools/perf/builtin-record.c +1 -0
index bd2a0cc6eb52..56705d2a6bec 100644
@@ -42,6 +42,7 @@
 #include "util/units.h"
 #include "util/bpf-event.h"
 #include "asm/bug.h"
+#include "perf.h"
 
 #include <errno.h>
 #include <inttypes.h>
tools/perf/builtin-script.c +1 -0
index 37297b67905d..f3b31c6ed15f 100644
@@ -53,6 +53,7 @@
 #include <perf/evlist.h>
 #include "util/record.h"
 #include "util/util.h"
+#include "perf.h"
 
 #include <linux/ctype.h>
 
tools/perf/builtin-stat.c +1 -0
index 2741bcb049fb..fa4212dac9bb 100644
@@ -41,6 +41,7 @@
  */
 
 #include "builtin.h"
+#include "perf.h"
 #include "util/cgroup.h"
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
tools/perf/builtin-trace.c +1 -0
index 6d9805a8791b..105695033ebc 100644
@@ -51,6 +51,7 @@
 #include "string2.h"
 #include "syscalltbl.h"
 #include "rb_resort.h"
+#include "../perf.h"
 
 #include <errno.h>
 #include <inttypes.h>
tools/perf/perf.c +1 -0
index a95a248a7421..237b9b3a1bf1 100644
@@ -8,6 +8,7 @@
  * perf top, perf record, perf report, etc.) are started.
  */
 #include "builtin.h"
+#include "perf.h"
 
 #include "util/env.h"
 #include <subcmd/exec-cmd.h>
tools/perf/ui/browsers/hists.c +1 -0
index 30547fdb0787..ccc37284860b 100644
@@ -22,6 +22,7 @@
 #include "../../util/top.h"
 #include "../../util/thread.h"
 #include "../../arch/common.h"
+#include "../../perf.h"
 
 #include "../browsers/hists.h"
 #include "../helpline.h"
tools/perf/ui/browsers/res_sample.c +1 -0
index 41a9d8923ec4..db3954fea74c 100644
@@ -8,6 +8,7 @@
 #include "time-utils.h"
 #include "../util.h"
 #include "../../util/util.h"
+#include "../../perf.h"
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
tools/perf/ui/browsers/scripts.c +1 -0
index 50e0c03171f2..e63f3778d75c 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "../../builtin.h"
+#include "../../perf.h"
 #include "../../util/sort.h"
 #include "../../util/util.h"
 #include "../../util/hist.h"
tools/perf/ui/hist.c +1 -0
index e5fb64347b2c..ae29f16979ac 100644
@@ -9,6 +9,7 @@
 #include "../util/sort.h"
 #include "../util/evsel.h"
 #include "../util/evlist.h"
+#include "../perf.h"
 
 /* hist period print (hpp) functions */
 
tools/perf/ui/tui/setup.c +1 -0
index 3ad0d3363ac6..2881982b483c 100644
@@ -11,6 +11,7 @@
 #include "../../util/cache.h"
 #include "../../util/debug.h"
 #include "../../util/util.h"
+#include "../../perf.h"
 #include "../browser.h"
 #include "../helpline.h"
 #include "../ui.h"
tools/perf/util/auxtrace.h +0 -1
index 1fa8a965b03f..bc39cc5610a8 100644
@@ -17,7 +17,6 @@
 #include <asm/bitsperlong.h>
 #include <asm/barrier.h>
 
-#include "../perf.h"
 #include "event.h"
 #include "session.h"
 #include "debug.h"
tools/perf/util/callchain.c +1 -0
index dd6e01000385..a47d0e8c2434 100644
@@ -28,6 +28,7 @@
 #include "callchain.h"
 #include "branch.h"
 #include "symbol.h"
+#include "../perf.h"
 
 #define CALLCHAIN_PARAM_DEFAULT			\
 	.mode		= CHAIN_GRAPH_ABS,	\
tools/perf/util/event.c +1 -0
index 7fa7a303e476..ef7fc574f701 100644
@@ -30,6 +30,7 @@
 #include "stat.h"
 #include "session.h"
 #include "bpf-event.h"
+#include "../perf.h"
 
 #define DEFAULT_PROC_MAP_PARSE_TIMEOUT 500
 
tools/perf/util/event.h +0 -1
index 4c0c5232bd41..f56d268f06e3 100644
@@ -9,7 +9,6 @@
 #include <linux/perf_event.h>
 #include <perf/event.h>
 
-#include "../perf.h"
 #include "build-id.h"
 #include "perf_regs.h"
 
tools/perf/util/evlist.c +1 -0
index 253dd8dd0e12..71b231c7097f 100644
@@ -17,6 +17,7 @@
 #include "debug.h"
 #include "units.h"
 #include "util.h"
+#include "../perf.h"
 #include "asm/bug.h"
 #include "bpf-event.h"
 #include <signal.h>
tools/perf/util/evlist.h +0 -1
index 16796de7af3f..ee288644e9e4 100644
@@ -9,7 +9,6 @@
 #include <api/fd/array.h>
 #include <stdio.h>
 #include <internal/evlist.h>
-#include "../perf.h"
 #include "event.h"
 #include "evsel.h"
 #include "mmap.h"
tools/perf/util/mmap.c +1 -0
index 5f3532e51ec9..28477ff5114e 100644
@@ -16,6 +16,7 @@
 #include "debug.h"
 #include "event.h"
 #include "mmap.h"
+#include "../perf.h"
 #include "util.h" /* page_size */
 
 size_t perf_mmap__mmap_len(struct perf_mmap *map)
tools/perf/util/session.c +1 -0
index 9eb843e5e6f0..82bd5d4361f0 100644
@@ -29,6 +29,7 @@
 #include "sample-raw.h"
 #include "stat.h"
 #include "util.h"
+#include "../perf.h"
 #include "arch/common.h"
 
 #ifdef HAVE_ZSTD_SUPPORT
tools/perf/util/top.c +1 -0
index e5b690cf2898..51fb574998bb 100644
@@ -12,6 +12,7 @@
 #include "parse-events.h"
 #include "symbol.h"
 #include "top.h"
+#include "../perf.h"
 #include <inttypes.h>
 
 #define SNPRINTF(buf, size, fmt, args...) \
Signature · 1 line
2.21.0
author maintainer
#14 lore raw

PATCH 14/47 perf tools: Remove perf.h from source files not needing it

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

With the movement of lots of stuff out of perf.h to other headers we ended up not needing it in lots of places, remove it from those places.

---
 tools/perf/arch/powerpc/util/perf_regs.c               | 1 -
 tools/perf/arch/x86/tests/intel-cqm.c                  | 1 -
 tools/perf/arch/x86/util/archinsn.c                    | 1 -
 tools/perf/arch/x86/util/tsc.c                         | 1 -
 tools/perf/bench/numa.c                                | 1 -
 tools/perf/bench/sched-messaging.c                     | 1 -
 tools/perf/bench/sched-pipe.c                          | 1 -
 tools/perf/builtin-bench.c                             | 1 -
 tools/perf/builtin-buildid-cache.c                     | 1 -
 tools/perf/builtin-buildid-list.c                      | 1 -
 tools/perf/builtin-config.c                            | 2 --
 tools/perf/builtin-ftrace.c                            | 1 -
 tools/perf/builtin-help.c                              | 1 -
 tools/perf/builtin-inject.c                            | 1 -
 tools/perf/builtin-list.c                              | 2 --
 tools/perf/builtin-probe.c                             | 1 -
 tools/perf/scripts/perl/Perf-Trace-Util/Context.c      | 1 -
 tools/perf/scripts/python/Perf-Trace-Util/Context.c    | 1 -
 tools/perf/tests/hists_common.c                        | 1 -
 tools/perf/tests/hists_cumulate.c                      | 1 -
 tools/perf/tests/hists_filter.c                        | 1 -
 tools/perf/tests/hists_link.c                          | 1 -
 tools/perf/tests/hists_output.c                        | 1 -
 tools/perf/ui/browser.c                                | 1 -
 tools/perf/util/bpf-loader.c                           | 1 -
 tools/perf/util/bpf-prologue.c                         | 1 -
 tools/perf/util/branch.c                               | 1 -
 tools/perf/util/cacheline.c                            | 1 -
 tools/perf/util/cgroup.c                               | 1 -
 tools/perf/util/cpumap.c                               | 1 -
 tools/perf/util/debug.c                                | 2 --
 tools/perf/util/event.c                                | 1 -
 tools/perf/util/genelf.c                               | 1 -
 tools/perf/util/genelf_debug.c                         | 1 -
 tools/perf/util/header.c                               | 1 -
 tools/perf/util/intel-pt.c                             | 1 -
 tools/perf/util/parse-branch-options.c                 | 1 -
 tools/perf/util/parse-events.c                         | 1 -
 tools/perf/util/scripting-engines/trace-event-perl.c   | 1 -
 tools/perf/util/scripting-engines/trace-event-python.c | 1 -
 tools/perf/util/svghelper.c                            | 1 -
 tools/perf/util/thread.c                               | 1 -
 tools/perf/util/time-utils.c                           | 1 -
 tools/perf/util/trace-event-info.c                     | 1 -
 tools/perf/util/trace-event-parse.c                    | 1 -
 tools/perf/util/trace-event-read.c                     | 1 -
 tools/perf/util/trace-event-scripting.c                | 1 -
 tools/perf/util/util.c                                 | 1 -
 48 files changed, 51 deletions(-)
tools/perf/arch/powerpc/util/perf_regs.c +0 -1
index f14102b85509..e9c436eeffc9 100644
@@ -4,7 +4,6 @@
 #include <regex.h>
 #include <linux/zalloc.h>
 
-#include "../../perf.h"
 #include "../../util/perf_regs.h"
 #include "../../util/debug.h"
 
tools/perf/arch/x86/tests/intel-cqm.c +0 -1
index 2a105e3b2ad1..3b5cc3373821 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "tests/tests.h"
-#include "perf.h"
 #include "cloexec.h"
 #include "debug.h"
 #include "evlist.h"
tools/perf/arch/x86/util/archinsn.c +0 -1
index 4237bb2e7fa2..62e8e1820132 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "archinsn.h"
 #include "util/intel-pt-decoder/insn.h"
 #include "machine.h"
tools/perf/arch/x86/util/tsc.c +0 -1
index a6ba45d0db6e..c5197a15119b 100644
@@ -5,7 +5,6 @@
 #include <linux/stddef.h>
 #include <linux/perf_event.h>
 
-#include "../../../perf.h"
 #include <linux/types.h>
 #include <asm/barrier.h>
 #include "../../../util/debug.h"
tools/perf/bench/numa.c +0 -1
index 513cb2f2fa32..62b8ef4bcb1f 100644
@@ -9,7 +9,6 @@
 /* For the CLR_() macros */
 #include <pthread.h>
 
-#include "../perf.h"
 #include "../builtin.h"
 #include <subcmd/parse-options.h>
 #include "../util/cloexec.h"
tools/perf/bench/sched-messaging.c +0 -1
index f9d7641ae833..c63eb9a46346 100644
@@ -10,7 +10,6 @@
  *
  */
 
-#include "../perf.h"
 #include "../util/util.h"
 #include <subcmd/parse-options.h>
 #include "../builtin.h"
tools/perf/bench/sched-pipe.c +0 -1
index 0591be008f2a..35b07f197d48 100644
@@ -9,7 +9,6 @@
  *  http://people.redhat.com/mingo/cfs-scheduler/tools/pipe-test-1m.c
  * Ported to perf by Hitoshi Mitake <[email protected]>
  */
-#include "../perf.h"
 #include "../util/util.h"
 #include <subcmd/parse-options.h>
 #include "../builtin.h"
tools/perf/builtin-bench.c +0 -1
index b8e7c38ef221..c06fe21c8613 100644
@@ -16,7 +16,6 @@
  *  futex ... Futex performance
  *  epoll ... Event poll performance
  */
-#include "perf.h"
 #include <subcmd/parse-options.h>
 #include "builtin.h"
 #include "bench/bench.h"
tools/perf/builtin-buildid-cache.c +0 -1
index 7dde3ef0398f..9e756004ef28 100644
@@ -14,7 +14,6 @@
 #include <errno.h>
 #include <unistd.h>
 #include "builtin.h"
-#include "perf.h"
 #include "namespaces.h"
 #include "util/cache.h"
 #include "util/debug.h"
tools/perf/builtin-buildid-list.c +0 -1
index f403e19488b5..72bdc0eba990 100644
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0
 /*
  * builtin-buildid-list.c
  *
tools/perf/builtin-config.c +0 -2
index 6c1284c87aaa..edfc8f76f1bd 100644
@@ -7,8 +7,6 @@
  */
 #include "builtin.h"
 
-#include "perf.h"
-
 #include "util/cache.h"
 #include <subcmd/parse-options.h>
 #include "util/util.h"
tools/perf/builtin-ftrace.c +0 -1
index 565db782c1b9..7374f86833fd 100644
@@ -6,7 +6,6 @@
  */
 
 #include "builtin.h"
-#include "perf.h"
 
 #include <errno.h>
 #include <unistd.h>
tools/perf/builtin-help.c +0 -1
index a83af92fb0d1..641d4a3f93c3 100644
@@ -4,7 +4,6 @@
  *
  * Builtin help command
  */
-#include "perf.h"
 #include "util/config.h"
 #include "builtin.h"
 #include <subcmd/exec-cmd.h>
tools/perf/builtin-inject.c +0 -1
index 040142581d20..ae46de46e826 100644
@@ -8,7 +8,6 @@
  */
 #include "builtin.h"
 
-#include "perf.h"
 #include "util/color.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
tools/perf/builtin-list.c +0 -2
index e0312a1c4792..dca0d33c1343 100644
@@ -10,8 +10,6 @@
  */
 #include "builtin.h"
 
-#include "perf.h"
-
 #include "util/parse-events.h"
 #include "util/cache.h"
 #include "util/pmu.h"
tools/perf/builtin-probe.c +0 -1
index 3d0ffd41fb55..f45fd7e9723e 100644
@@ -16,7 +16,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "perf.h"
 #include "builtin.h"
 #include "namespaces.h"
 #include "util/strlist.h"
tools/perf/scripts/perl/Perf-Trace-Util/Context.c +0 -1
index ead521dd8d79..25c47d23a130 100644
@@ -19,7 +19,6 @@
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
-#include "../../../perf.h"
 #include "../../../util/trace-event.h"
 
 #ifndef PERL_UNUSED_VAR
tools/perf/scripts/python/Perf-Trace-Util/Context.c +0 -1
index 217568bc29ce..0b7096847991 100644
@@ -6,7 +6,6 @@
  */
 
 #include <Python.h>
-#include "../../../perf.h"
 #include "../../../util/trace-event.h"
 
 #if PY_MAJOR_VERSION < 3
tools/perf/tests/hists_common.c +0 -1
index 469958cd7fe0..96ad95d3f338 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <inttypes.h>
-#include "perf.h"
 #include "util/debug.h"
 #include "util/map.h"
 #include "util/symbol.h"
tools/perf/tests/hists_cumulate.c +0 -1
index 1f3de85ae18b..93af420ad2e4 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "util/debug.h"
 #include "util/event.h"
 #include "util/map.h"
tools/perf/tests/hists_filter.c +0 -1
index a274716fc438..41dede2f40d8 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "util/debug.h"
 #include "util/map.h"
 #include "util/symbol.h"
tools/perf/tests/hists_link.c +0 -1
index b25383aa2e6e..012fe8ac0b24 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "tests.h"
 #include "debug.h"
 #include "symbol.h"
tools/perf/tests/hists_output.c +0 -1
index 009888adf4b3..07f4ca0704fb 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "util/debug.h"
 #include "util/event.h"
 #include "util/map.h"
tools/perf/ui/browser.c +0 -1
index c797a853d3a0..f93d40b1c203 100644
@@ -2,7 +2,6 @@
 #include "../util/util.h"
 #include "../util/string2.h"
 #include "../util/config.h"
-#include "../perf.h"
 #include "libslang.h"
 #include "ui.h"
 #include "util.h"
tools/perf/util/bpf-loader.c +0 -1
index 80a828e75cf6..c1a57323e25d 100644
@@ -14,7 +14,6 @@
 #include <linux/string.h>
 #include <linux/zalloc.h>
 #include <errno.h>
-#include "perf.h"
 #include "debug.h"
 #include "evlist.h"
 #include "bpf-loader.h"
tools/perf/util/bpf-prologue.c +0 -1
index 77e4891e17b0..09e6c76e1c3b 100644
@@ -8,7 +8,6 @@
  */
 
 #include <bpf/libbpf.h>
-#include "perf.h"
 #include "debug.h"
 #include "bpf-loader.h"
 #include "bpf-prologue.h"
tools/perf/util/branch.c +0 -1
index a4fce2729e50..02d6d839ff24 100644
@@ -1,4 +1,3 @@
-#include "perf.h"
 #include "util/util.h"
 #include "util/debug.h"
 #include "util/branch.h"
tools/perf/util/cacheline.c +0 -1
index 9361d3f61f75..e98b5250a517 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "cacheline.h"
-#include "../perf.h"
 #include <unistd.h>
 
 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
tools/perf/util/cgroup.c +0 -1
index f73599f271ff..96a931c6f728 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../perf.h"
 #include <subcmd/parse-options.h>
 #include "evsel.h"
 #include "cgroup.h"
tools/perf/util/cpumap.c +0 -1
index b9301e7e9c76..a22c1114e880 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <api/fs/fs.h>
-#include "../perf.h"
 #include "cpumap.h"
 #include "debug.h"
 #include "event.h"
tools/perf/util/debug.c +0 -2
index 3780fe42453b..c822c5943340 100644
@@ -1,8 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /* For general debugging purposes */
 
-#include "../perf.h"
-
 #include <inttypes.h>
 #include <string.h>
 #include <stdarg.h>
tools/perf/util/event.c +0 -1
index ef7fc574f701..54169ad335c7 100644
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
tools/perf/util/genelf.c +0 -1
index bc32f405b26e..f9f18b8b1df9 100644
@@ -23,7 +23,6 @@
 #include <dwarf.h>
 #endif
 
-#include "perf.h"
 #include "genelf.h"
 #include "../util/jitdump.h"
 #include <linux/compiler.h>
tools/perf/util/genelf_debug.c +0 -1
index 995e490c17fa..30e9f618f6cd 100644
@@ -24,7 +24,6 @@
 #include <err.h>
 #include <dwarf.h>
 
-#include "perf.h"
 #include "genelf.h"
 #include "../util/jitdump.h"
 
tools/perf/util/header.c +0 -1
index d252124f926d..20fb06162fd4 100644
@@ -26,7 +26,6 @@
 #include "evsel.h"
 #include "header.h"
 #include "memswap.h"
-#include "../perf.h"
 #include "trace-event.h"
 #include "session.h"
 #include "symbol.h"
tools/perf/util/intel-pt.c +0 -1
index 825a6a3b03a1..825e3690940d 100644
@@ -12,7 +12,6 @@
 #include <linux/types.h>
 #include <linux/zalloc.h>
 
-#include "../perf.h"
 #include "session.h"
 #include "machine.h"
 #include "memswap.h"
tools/perf/util/parse-branch-options.c +0 -1
index 4ed20c833d44..1430437b9d51 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "perf.h"
 #include "util/debug.h"
 #include <subcmd/parse-options.h>
 #include "util/parse-branch-options.h"
tools/perf/util/parse-events.c +0 -1
index 9101568946d2..5f1ba6820cdd 100644
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 #include <sys/param.h>
 #include "term.h"
-#include "../perf.h"
 #include "evlist.h"
 #include "evsel.h"
 #include <subcmd/parse-options.h>
tools/perf/util/scripting-engines/trace-event-perl.c +0 -1
index 01ebf10b8bf4..800e82d35230 100644
@@ -34,7 +34,6 @@
 #include <EXTERN.h>
 #include <perl.h>
 
-#include "../../perf.h"
 #include "../callchain.h"
 #include "../machine.h"
 #include "../map.h"
tools/perf/util/scripting-engines/trace-event-python.c +0 -1
index 78c8bc9380bd..abfde356be18 100644
@@ -31,7 +31,6 @@
 #include <linux/compiler.h>
 #include <linux/time64.h>
 
-#include "../../perf.h"
 #include "../counts.h"
 #include "../debug.h"
 #include "../callchain.h"
tools/perf/util/svghelper.c +0 -1
index fef0f8a40e2f..582f4a69cd48 100644
@@ -20,7 +20,6 @@
 #include <perf/cpumap.h>
 
 #include "env.h"
-#include "perf.h"
 #include "svghelper.h"
 #include "cpumap.h"
 
tools/perf/util/thread.c +0 -1
index dbcb9cfb0f2f..5ba1601e8860 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../perf.h"
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
tools/perf/util/time-utils.c +0 -1
index c2abc259b51d..9796a2e43f67 100644
@@ -10,7 +10,6 @@
 #include <math.h>
 #include <linux/ctype.h>
 
-#include "perf.h"
 #include "debug.h"
 #include "time-utils.h"
 #include "session.h"
tools/perf/util/trace-event-info.c +0 -1
index 2f8a0601a546..d63d542b2cde 100644
@@ -20,7 +20,6 @@
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
 
-#include "../perf.h"
 #include "trace-event.h"
 #include <api/fs/tracing_path.h>
 #include "evsel.h"
tools/perf/util/trace-event-parse.c +0 -1
index b3982e1bb4c5..8e31a63045c3 100644
@@ -7,7 +7,6 @@
 #include <string.h>
 #include <errno.h>
 
-#include "../perf.h"
 #include "debug.h"
 #include "trace-event.h"
 
tools/perf/util/trace-event-read.c +0 -1
index 13c1cf60d1bc..b6c0db068be0 100644
@@ -15,7 +15,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
 #include "debug.h"
tools/perf/util/trace-event-scripting.c +0 -1
index dfd2640c763a..714581b0de65 100644
@@ -10,7 +10,6 @@
 #include <string.h>
 #include <errno.h>
 
-#include "../perf.h"
 #include "debug.h"
 #include "trace-event.h"
 #include <linux/zalloc.h>
tools/perf/util/util.c +0 -1
index 44211e483fbf..607daec22943 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../perf.h"
 #include "util.h"
 #include "debug.h"
 #include "namespaces.h"
Signature · 1 line
2.21.0
author maintainer
#15 lore raw

PATCH 15/47 perf tools: Remove debug.h from header files not needing it

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

And fix the fallout, adding it to places that must have it since they use its definitions.

---
 tools/perf/arch/arm/util/auxtrace.c          | 1 +
 tools/perf/arch/arm/util/cs-etm.c            | 1 +
 tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 +
 tools/perf/tests/code-reading.c              | 1 +
 tools/perf/tests/keep-tracking.c             | 1 +
 tools/perf/tests/mmap-basic.c                | 1 +
 tools/perf/tests/sw-clock.c                  | 2 ++
 tools/perf/tests/switch-tracking.c           | 1 +
 tools/perf/tests/task-exit.c                 | 1 +
 tools/perf/ui/browsers/annotate.c            | 1 +
 tools/perf/ui/browsers/hists.c               | 1 +
 tools/perf/ui/hist.c                         | 1 +
 tools/perf/util/auxtrace.h                   | 2 +-
 tools/perf/util/config.c                     | 1 +
 tools/perf/util/hist.c                       | 1 +
 tools/perf/util/llvm-utils.h                 | 2 +-
 tools/perf/util/metricgroup.c                | 2 ++
 tools/perf/util/python.c                     | 1 +
 tools/perf/util/record.c                     | 1 +
 tools/perf/util/session.c                    | 1 +
 tools/perf/util/sort.c                       | 1 +
 tools/perf/util/stat.c                       | 1 +
 tools/perf/util/trigger.h                    | 1 -
 23 files changed, 24 insertions(+), 3 deletions(-)
tools/perf/arch/arm/util/auxtrace.c +1 -0
index 41b78f74599f..0a6e75b8777a 100644
@@ -9,6 +9,7 @@
 #include <linux/zalloc.h>
 
 #include "../../util/auxtrace.h"
+#include "../../util/debug.h"
 #include "../../util/evlist.h"
 #include "../../util/pmu.h"
 #include "cs-etm.h"
tools/perf/arch/arm/util/cs-etm.c +1 -0
index 9644e2d405f7..b74fd408d496 100644
@@ -15,6 +15,7 @@
 #include <linux/zalloc.h>
 
 #include "cs-etm.h"
+#include "../../util/debug.h"
 #include "../../util/record.h"
 #include "../../util/auxtrace.h"
 #include "../../util/cpumap.h"
tools/perf/arch/x86/tests/perf-time-to-tsc.c +1 -0
index 02776109ba46..2d1f4713b728 100644
@@ -9,6 +9,7 @@
 #include <perf/cpumap.h>
 #include <perf/evlist.h>
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/tests/code-reading.c +1 -0
index fe671b860086..c4b73bb4b113 100644
@@ -11,6 +11,7 @@
 #include <perf/cpumap.h>
 #include <perf/evlist.h>
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/tests/keep-tracking.c +1 -0
index 2af6faf1bbd6..c758798d3774 100644
@@ -5,6 +5,7 @@
 #include <perf/cpumap.h>
 #include <perf/evlist.h>
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/tests/mmap-basic.c +1 -0
index 7327694fbde0..fe91350fd5ab 100644
@@ -5,6 +5,7 @@
 #include <pthread.h>
 #include <perf/cpumap.h>
 
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
tools/perf/tests/sw-clock.c +2 -0
index c5f1a9f83380..97694a040986 100644
@@ -5,8 +5,10 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <sys/mman.h>
+#include <linux/string.h>
 
 #include "tests.h"
+#include "util/debug.h"
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/cpumap.h"
tools/perf/tests/switch-tracking.c +1 -0
index b63f02768724..4bed15aee1a8 100644
@@ -8,6 +8,7 @@
 #include <perf/cpumap.h>
 #include <perf/evlist.h>
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/tests/task-exit.c +1 -0
index d79a22e2d8be..0e0e0627184e 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "target.h"
tools/perf/ui/browsers/annotate.c +1 -0
index e633eb42550d..715601f5fce3 100644
@@ -4,6 +4,7 @@
 #include "../ui.h"
 #include "../util.h"
 #include "../../util/annotate.h"
+#include "../../util/debug.h"
 #include "../../util/hist.h"
 #include "../../util/sort.h"
 #include "../../util/map.h"
tools/perf/ui/browsers/hists.c +1 -0
index ccc37284860b..a14dda74f43a 100644
@@ -11,6 +11,7 @@
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
+#include "../../util/debug.h"
 #include "../../util/callchain.h"
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
tools/perf/ui/hist.c +1 -0
index ae29f16979ac..bf90ce5b2cdf 100644
@@ -4,6 +4,7 @@
 #include <linux/compiler.h>
 
 #include "../util/callchain.h"
+#include "../util/debug.h"
 #include "../util/hist.h"
 #include "../util/util.h"
 #include "../util/sort.h"
tools/perf/util/auxtrace.h +1 -1
index bc39cc5610a8..b5ac24c770d4 100644
@@ -19,7 +19,6 @@
 
 #include "event.h"
 #include "session.h"
-#include "debug.h"
 
 union perf_event;
 struct perf_session;
@@ -614,6 +613,7 @@ void itrace_synth_opts__clear_time_range(struct itrace_synth_opts *opts)
 }
 
 #else
+#include "debug.h"
 
 static inline struct auxtrace_record *
 auxtrace_record__init(struct evlist *evlist __maybe_unused,
tools/perf/util/config.c +1 -0
index 042ffbc8c53f..eb5308c41ed1 100644
@@ -18,6 +18,7 @@
 #include "util/hist.h"  /* perf_hist_config */
 #include "util/llvm-utils.h"   /* perf_llvm_config */
 #include "config.h"
+#include "debug.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
tools/perf/util/hist.c +1 -0
index e0b149673a88..adae4134e972 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "callchain.h"
+#include "debug.h"
 #include "build-id.h"
 #include "hist.h"
 #include "map.h"
tools/perf/util/llvm-utils.h +1 -1
index bf3f3f4c4fe2..7878a0e3fa98 100644
@@ -6,7 +6,7 @@
 #ifndef __LLVM_UTILS_H
 #define __LLVM_UTILS_H
 
-#include "debug.h"
+#include <stdbool.h>
 
 struct llvm_param {
 	/* Path of clang executable */
tools/perf/util/metricgroup.c +2 -0
index aaf55444f81b..33f5e2101874 100644
@@ -6,6 +6,7 @@
 /* Manage metrics and groups of metrics from JSON files */
 
 #include "metricgroup.h"
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "strbuf.h"
@@ -18,6 +19,7 @@
 #include "strlist.h"
 #include <assert.h>
 #include <linux/ctype.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include <subcmd/parse-options.h>
 
tools/perf/util/python.c +1 -0
index 9dd83871aafe..9b350482c403 100644
@@ -5,6 +5,7 @@
 #include <poll.h>
 #include <linux/err.h>
 #include <perf/cpumap.h>
+#include "debug.h"
 #include "evlist.h"
 #include "callchain.h"
 #include "evsel.h"
tools/perf/util/record.c +1 -0
index c67a51397bc7..ccad796bce5f 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "cpumap.h"
tools/perf/util/session.c +1 -0
index 82bd5d4361f0..a72774e4463f 100644
@@ -12,6 +12,7 @@
 #include <sys/mman.h>
 #include <perf/cpumap.h>
 
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "memswap.h"
tools/perf/util/sort.c +1 -0
index 83eb3fa6f941..23d0ab7c801c 100644
@@ -4,6 +4,7 @@
 #include <regex.h>
 #include <linux/mman.h>
 #include <linux/time64.h>
+#include "debug.h"
 #include "sort.h"
 #include "hist.h"
 #include "cacheline.h"
tools/perf/util/stat.c +1 -0
index f6eb6af5f151..f4a1edcec7b2 100644
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 #include <math.h>
 #include "counts.h"
+#include "debug.h"
 #include "stat.h"
 #include "target.h"
 #include "evlist.h"
tools/perf/util/trigger.h +0 -1
index 88223bc7c82b..33e997f9ccc8 100644
@@ -2,7 +2,6 @@
 #ifndef __TRIGGER_H_
 #define __TRIGGER_H_ 1
 
-#include "util/debug.h"
 #include "asm/bug.h"
 
 /*
Signature · 1 line
2.21.0
author maintainer
#16 lore raw

PATCH 16/47 perf debug: Remove needless include directives from debug.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

All we need there is a forward declaration for 'union perf_event', so remove it from there and add missing header directives in places using things from this indirect include.

---
 tools/perf/arch/arm/util/cs-etm.c           | 1 +
 tools/perf/arch/common.c                    | 2 ++
 tools/perf/arch/x86/tests/bp-modify.c       | 1 +
 tools/perf/arch/x86/tests/insn-x86.c        | 1 +
 tools/perf/arch/x86/tests/rdpmc.c           | 2 ++
 tools/perf/arch/x86/util/perf_regs.c        | 1 +
 tools/perf/builtin-c2c.c                    | 2 ++
 tools/perf/builtin-config.c                 | 1 +
 tools/perf/builtin-data.c                   | 2 ++
 tools/perf/builtin-diff.c                   | 1 +
 tools/perf/builtin-ftrace.c                 | 3 ++-
 tools/perf/builtin-help.c                   | 4 ++++
 tools/perf/builtin-kmem.c                   | 1 +
 tools/perf/builtin-list.c                   | 1 +
 tools/perf/builtin-probe.c                  | 1 +
 tools/perf/builtin-record.c                 | 1 +
 tools/perf/builtin-report.c                 | 2 ++
 tools/perf/builtin-top.c                    | 1 +
 tools/perf/builtin-trace.c                  | 1 +
 tools/perf/perf.c                           | 2 ++
 tools/perf/tests/attr.c                     | 1 +
 tools/perf/tests/backward-ring-buffer.c     | 1 +
 tools/perf/tests/bp_account.c               | 1 +
 tools/perf/tests/bp_signal.c                | 1 +
 tools/perf/tests/bp_signal_overflow.c       | 1 +
 tools/perf/tests/bpf.c                      | 1 +
 tools/perf/tests/event-times.c              | 1 +
 tools/perf/tests/expr.c                     | 1 +
 tools/perf/tests/kmod-path.c                | 2 ++
 tools/perf/tests/mmap-basic.c               | 1 +
 tools/perf/tests/openat-syscall-all-cpus.c  | 1 +
 tools/perf/tests/openat-syscall-tp-fields.c | 1 +
 tools/perf/tests/openat-syscall.c           | 1 +
 tools/perf/tests/perf-record.c              | 1 +
 tools/perf/tests/sample-parsing.c           | 1 +
 tools/perf/tests/task-exit.c                | 1 +
 tools/perf/tests/thread-map.c               | 7 +++++++
 tools/perf/tests/unit_number__scnprintf.c   | 1 +
 tools/perf/tests/wp.c                       | 3 +++
 tools/perf/ui/browsers/scripts.c            | 1 +
 tools/perf/ui/gtk/helpline.c                | 1 +
 tools/perf/ui/gtk/util.c                    | 1 +
 tools/perf/ui/tui/helpline.c                | 1 +
 tools/perf/ui/util.c                        | 2 +-
 tools/perf/util/bpf-prologue.c              | 1 +
 tools/perf/util/branch.c                    | 1 +
 tools/perf/util/callchain.c                 | 1 +
 tools/perf/util/cloexec.c                   | 2 ++
 tools/perf/util/data.c                      | 1 +
 tools/perf/util/debug.c                     | 1 +
 tools/perf/util/debug.h                     | 6 ++----
 tools/perf/util/dwarf-aux.c                 | 1 +
 tools/perf/util/dwarf-aux.h                 | 2 ++
 tools/perf/util/env.c                       | 1 +
 tools/perf/util/evlist.c                    | 1 +
 tools/perf/util/expr.y                      | 2 ++
 tools/perf/util/hist.c                      | 1 +
 tools/perf/util/intel-pt.c                  | 1 +
 tools/perf/util/llvm-utils.c                | 1 +
 tools/perf/util/lzma.c                      | 1 +
 tools/perf/util/machine.c                   | 1 +
 tools/perf/util/map.c                       | 1 +
 tools/perf/util/ordered-events.c            | 1 +
 tools/perf/util/parse-branch-options.c      | 2 ++
 tools/perf/util/perf-hooks.c                | 1 +
 tools/perf/util/probe-finder.c              | 1 +
 tools/perf/util/pstack.c                    | 1 +
 tools/perf/util/sort.c                      | 1 +
 tools/perf/util/strbuf.c                    | 4 ++++
 tools/perf/util/symbol.c                    | 1 +
 tools/perf/util/target.c                    | 3 +++
 tools/perf/util/thread-stack.c              | 1 +
 tools/perf/util/util.c                      | 1 +
 tools/perf/util/values.c                    | 1 +
 tools/perf/util/zlib.c                      | 1 +
 75 files changed, 104 insertions(+), 6 deletions(-)
tools/perf/arch/arm/util/cs-etm.c +1 -0
index b74fd408d496..197041fcba25 100644
@@ -11,6 +11,7 @@
 #include <linux/coresight-pmu.h>
 #include <linux/kernel.h>
 #include <linux/log2.h>
+#include <linux/string.h>
 #include <linux/types.h>
 #include <linux/zalloc.h>
 
tools/perf/arch/common.c +2 -0
index a769382fb644..59dd875fd5e4 100644
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include "common.h"
 #include "../util/env.h"
tools/perf/arch/x86/tests/bp-modify.c +1 -0
index f53e4406709f..adcacf1b6609 100644
@@ -7,6 +7,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
 #include <errno.h>
tools/perf/arch/x86/tests/insn-x86.c +1 -0
index c3e5f4ab0d3e..d67bc0ffb70a 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
+#include <string.h>
 
 #include "debug.h"
 #include "tests/tests.h"
tools/perf/arch/x86/tests/rdpmc.c +2 -0
index 345a6a0a328b..6e67cee792b1 100644
@@ -6,11 +6,13 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <linux/string.h>
 #include <linux/types.h>
 #include "perf-sys.h"
 #include "debug.h"
 #include "tests/tests.h"
 #include "cloexec.h"
+#include "event.h"
 #include "util.h"
 #include "arch-tests.h"
 
tools/perf/arch/x86/util/perf_regs.c +1 -0
index 74a606ea42d3..99ea60211e16 100644
@@ -7,6 +7,7 @@
 #include "../../perf-sys.h"
 #include "../../util/perf_regs.h"
 #include "../../util/debug.h"
+#include "../../util/event.h"
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(AX, PERF_REG_X86_AX),
tools/perf/builtin-c2c.c +2 -0
index 25a5f186dfde..d1ad694c67a2 100644
@@ -20,6 +20,7 @@
 #include <sys/param.h>
 #include "debug.h"
 #include "builtin.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "mem-events.h"
 #include "session.h"
@@ -35,6 +36,7 @@
 #include "thread.h"
 #include "mem2node.h"
 #include "symbol.h"
+#include "ui/ui.h"
 #include "../perf.h"
 
 struct c2c_hists {
tools/perf/builtin-config.c +1 -0
index edfc8f76f1bd..42d8157e047a 100644
@@ -13,6 +13,7 @@
 #include "util/debug.h"
 #include "util/config.h"
 #include <linux/string.h>
+#include <stdio.h>
 #include <stdlib.h>
 
 static bool use_system_config, use_user_config;
tools/perf/builtin-data.c +2 -0
index dde25d4ca56d..ca2fb44874e4 100644
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
+#include <stdio.h>
+#include <string.h>
 #include "builtin.h"
 #include "perf.h"
 #include "debug.h"
tools/perf/builtin-diff.c +1 -0
index ae4a8ebf90d2..827e4800d862 100644
@@ -24,6 +24,7 @@
 #include "util/annotate.h"
 #include "util/map.h"
 #include <linux/zalloc.h>
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 
 #include <errno.h>
tools/perf/builtin-ftrace.c +2 -1
index 7374f86833fd..2f8ea44c00c4 100644
@@ -13,8 +13,10 @@
 #include <fcntl.h>
 #include <poll.h>
 #include <linux/capability.h>
+#include <linux/string.h>
 
 #include "debug.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include <api/fs/tracing_path.h>
 #include "evlist.h"
@@ -24,7 +26,6 @@
 #include "util/cap.h"
 #include "util/config.h"
 
-
 #define DEFAULT_TRACER  "function_graph"
 
 struct perf_ftrace {
tools/perf/builtin-help.c +4 -0
index 641d4a3f93c3..3976aebe3677 100644
@@ -4,7 +4,9 @@
  *
  * Builtin help command
  */
+#include "util/cache.h"
 #include "util/config.h"
+#include "util/strbuf.h"
 #include "builtin.h"
 #include <subcmd/exec-cmd.h>
 #include "common-cmds.h"
@@ -13,10 +15,12 @@
 #include <subcmd/help.h>
 #include "util/debug.h"
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
tools/perf/builtin-kmem.c +1 -0
index 46f828936120..7eec0da64c46 100644
@@ -14,6 +14,7 @@
 #include "util/callchain.h"
 #include "util/time-utils.h"
 
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
 #include "util/data.h"
tools/perf/builtin-list.c +1 -0
index dca0d33c1343..11afb760616b 100644
@@ -16,6 +16,7 @@
 #include "util/debug.h"
 #include "util/metricgroup.h"
 #include <subcmd/parse-options.h>
+#include <stdio.h>
 
 static bool desc_flag = true;
 static bool details_flag;
tools/perf/builtin-probe.c +1 -0
index f45fd7e9723e..8950c05ef8fd 100644
@@ -26,6 +26,7 @@
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
 #include "util/probe-file.h"
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
tools/perf/builtin-record.c +1 -0
index 56705d2a6bec..1447004eee8a 100644
@@ -53,6 +53,7 @@
 #include <signal.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
+#include <linux/string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
tools/perf/builtin-report.c +2 -0
index 33c20e26b290..94e7e354cb16 100644
@@ -45,6 +45,7 @@
 #include "util/units.h"
 #include "util/branch.h"
 #include "util/util.h"
+#include "ui/ui.h"
 
 #include <dlfcn.h>
 #include <errno.h>
@@ -53,6 +54,7 @@
 #include <linux/ctype.h>
 #include <signal.h>
 #include <linux/bitmap.h>
+#include <linux/string.h>
 #include <linux/stringify.h>
 #include <linux/time64.h>
 #include <sys/types.h>
tools/perf/builtin-top.c +1 -0
index c3f95440e99c..5538b5886e35 100644
@@ -45,6 +45,7 @@
 #include "util/intlist.h"
 #include "util/parse-branch-options.h"
 #include "arch/common.h"
+#include "ui/ui.h"
 
 #include "util/debug.h"
 #include "util/ordered-events.h"
tools/perf/builtin-trace.c +1 -0
index 105695033ebc..b1ec8ff52740 100644
@@ -29,6 +29,7 @@
 #include "util/event.h"
 #include "util/evlist.h"
 #include "util/evswitch.h"
+#include <subcmd/pager.h>
 #include <subcmd/exec-cmd.h>
 #include "util/machine.h"
 #include "util/map.h"
tools/perf/perf.c +2 -0
index 237b9b3a1bf1..e0910637a82d 100644
@@ -10,6 +10,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "util/cache.h"
 #include "util/env.h"
 #include <subcmd/exec-cmd.h>
 #include "util/config.h"
@@ -32,6 +33,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 const char perf_usage_string[] =
tools/perf/tests/attr.c +1 -0
index 87dc3e1174af..a9599ab8c471 100644
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include "../perf-sys.h"
 #include <subcmd/exec-cmd.h>
+#include "event.h"
 #include "tests.h"
 
 #define ENV "PERF_TEST_ATTR"
tools/perf/tests/backward-ring-buffer.c +1 -0
index b6f27ef9fb02..512288e9f547 100644
@@ -10,6 +10,7 @@
 #include "tests.h"
 #include "debug.h"
 #include <errno.h>
+#include <linux/string.h>
 
 #define NR_ITERS 111
 
tools/perf/tests/bp_account.c +1 -0
index c4a30318d7e0..016bba2c142d 100644
@@ -19,6 +19,7 @@
 
 #include "tests.h"
 #include "debug.h"
+#include "event.h"
 #include "../perf-sys.h"
 #include "cloexec.h"
 
tools/perf/tests/bp_signal.c +1 -0
index 2d292f8fb3dd..c1c2c13de254 100644
@@ -25,6 +25,7 @@
 
 #include "tests.h"
 #include "debug.h"
+#include "event.h"
 #include "perf-sys.h"
 #include "cloexec.h"
 
tools/perf/tests/bp_signal_overflow.c +1 -0
index 101315a3b34f..eb4dbbddf4ff 100644
@@ -24,6 +24,7 @@
 
 #include "tests.h"
 #include "debug.h"
+#include "event.h"
 #include "../perf-sys.h"
 #include "cloexec.h"
 
tools/perf/tests/bpf.c +1 -0
index 98642961fc63..9fc163b2acbb 100644
@@ -12,6 +12,7 @@
 #include <linux/bpf.h>
 #include <linux/filter.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <api/fs/fs.h>
 #include <bpf/bpf.h>
 #include "tests.h"
tools/perf/tests/event-times.c +1 -0
index 714e3611352c..228d1618cf7d 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
+#include <linux/string.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <string.h>
tools/perf/tests/expr.c +1 -0
index ee1d88650e69..87843af4c118 100644
@@ -3,6 +3,7 @@
 #include "util/expr.h"
 #include "tests.h"
 #include <stdlib.h>
+#include <string.h>
 #include <linux/zalloc.h>
 
 static int test(struct parse_ctx *ctx, const char *e, double val2)
tools/perf/tests/kmod-path.c +2 -0
index 0579a70bbbff..e483210b176b 100644
@@ -1,9 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdbool.h>
 #include <stdlib.h>
+#include <string.h>
 #include "tests.h"
 #include "dso.h"
 #include "debug.h"
+#include "event.h"
 
 static int test(const char *path, bool alloc_name, bool kmod,
 		int comp, const char *name)
tools/perf/tests/mmap-basic.c +1 -0
index fe91350fd5ab..bdf77bfe1b80 100644
@@ -13,6 +13,7 @@
 #include "tests.h"
 #include <linux/err.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <perf/evlist.h>
 
 /*
tools/perf/tests/openat-syscall-all-cpus.c +1 -0
index 4ae4dea07466..9171f77cd9cd 100644
@@ -9,6 +9,7 @@
 #include <fcntl.h>
 #include <api/fs/fs.h>
 #include <linux/err.h>
+#include <linux/string.h>
 #include <api/fs/tracing_path.h>
 #include "evsel.h"
 #include "tests.h"
tools/perf/tests/openat-syscall-tp-fields.c +1 -0
index 62492106fb5e..b71167b43dda 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdbool.h>
 #include <linux/err.h>
+#include <linux/string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
tools/perf/tests/openat-syscall.c +1 -0
index 58df4bda5e12..5ebffae18605 100644
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 #include <api/fs/tracing_path.h>
 #include <linux/err.h>
+#include <linux/string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
tools/perf/tests/perf-record.c +1 -0
index 3a205f6f9363..e1b42292cf7f 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
 #include <inttypes.h>
+#include <linux/string.h>
 /* For the CLR_() macros */
 #include <pthread.h>
 
tools/perf/tests/sample-parsing.c +1 -0
index a8ca29fe172b..0c09dc15a059 100644
@@ -2,6 +2,7 @@
 #include <stdbool.h>
 #include <inttypes.h>
 #include <stdlib.h>
+#include <string.h>
 #include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
tools/perf/tests/task-exit.c +1 -0
index 0e0e0627184e..f610e8c0a083 100644
@@ -9,6 +9,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <linux/string.h>
 #include <perf/evlist.h>
 
 static int exited;
tools/perf/tests/thread-map.c +7 -0
index c19ec8849e77..39168c57943b 100644
@@ -1,12 +1,19 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/prctl.h>
 #include "tests.h"
 #include "thread_map.h"
 #include "debug.h"
+#include "event.h"
 #include <linux/zalloc.h>
+#include <perf/event.h>
+
+struct perf_sample;
+struct perf_tool;
+struct machine;
 
 #define NAME	(const char *) "perf"
 #define NAMEUL	(unsigned long) NAME
tools/perf/tests/unit_number__scnprintf.c +1 -0
index 2bb8cb0039c1..3721757435da 100644
@@ -2,6 +2,7 @@
 #include <inttypes.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
+#include <string.h>
 #include "tests.h"
 #include "units.h"
 #include "debug.h"
tools/perf/tests/wp.c +3 -0
index 982ac55d69ea..d262d6639829 100644
@@ -1,10 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/hw_breakpoint.h>
+#include <linux/kernel.h>
 #include "tests.h"
 #include "debug.h"
+#include "event.h"
 #include "cloexec.h"
 #include "../perf-sys.h"
 
tools/perf/ui/browsers/scripts.c +1 -0
index e63f3778d75c..77809c0fad02 100644
@@ -9,6 +9,7 @@
 #include "../browser.h"
 #include "../libslang.h"
 #include "config.h"
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 #define SCRIPT_NAMELEN	128
tools/perf/ui/gtk/helpline.c +1 -0
index fbf1ea9ce9a2..e166da9ec767 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <string.h>
+#include <linux/kernel.h>
 
 #include "gtk.h"
 #include "../ui.h"
tools/perf/ui/gtk/util.c +1 -0
index c28bdb7517ac..c2c558958b9c 100644
@@ -3,6 +3,7 @@
 #include "../../util/debug.h"
 #include "gtk.h"
 
+#include <stdlib.h>
 #include <string.h>
 #include <linux/zalloc.h>
 
tools/perf/ui/tui/helpline.c +1 -0
index 93d6b7240285..1793c98653a5 100644
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
+#include <linux/kernel.h>
 
 #include "../../util/debug.h"
 #include "../helpline.h"
tools/perf/ui/util.c +1 -1
index 9ed76e88a3e4..689b27c34246 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "util.h"
 #include "../util/debug.h"
-
+#include <stdio.h>
 
 /*
  * Default error logging functions
tools/perf/util/bpf-prologue.c +1 -0
index 09e6c76e1c3b..b020a8678eb9 100644
@@ -13,6 +13,7 @@
 #include "bpf-prologue.h"
 #include "probe-finder.h"
 #include <errno.h>
+#include <stdlib.h>
 #include <dwarf-regs.h>
 #include <linux/filter.h>
 
tools/perf/util/branch.c +1 -0
index 02d6d839ff24..30642e1f2b1b 100644
@@ -1,6 +1,7 @@
 #include "util/util.h"
 #include "util/debug.h"
 #include "util/branch.h"
+#include <linux/kernel.h>
 
 static bool cross_area(u64 addr1, u64 addr2, int size)
 {
tools/perf/util/callchain.c +1 -0
index a47d0e8c2434..76bf05b26d3b 100644
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 #include <errno.h>
 #include <math.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 #include "asm/bug.h"
tools/perf/util/cloexec.c +2 -0
index 92d08198e64a..4e904fcb2783 100644
@@ -4,10 +4,12 @@
 #include "util.h"
 #include "../perf-sys.h"
 #include "cloexec.h"
+#include "event.h"
 #include "asm/bug.h"
 #include "debug.h"
 #include <unistd.h>
 #include <sys/syscall.h>
+#include <linux/string.h>
 
 static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
 
tools/perf/util/data.c +1 -0
index 74aafe0df506..e75c3a279fe8 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include <sys/types.h>
 #include <sys/stat.h>
tools/perf/util/debug.c +1 -0
index c822c5943340..522887ee4c02 100644
@@ -19,6 +19,7 @@
 #include "print_binary.h"
 #include "util.h"
 #include "target.h"
+#include "ui/helpline.h"
 
 #include <linux/ctype.h>
 
tools/perf/util/debug.h +2 -4
index 77445dfc5c7d..b2deee987ffa 100644
@@ -4,11 +4,7 @@
 #define __PERF_DEBUG_H
 
 #include <stdbool.h>
-#include <string.h>
 #include <linux/compiler.h>
-#include "event.h"
-#include "../ui/helpline.h"
-#include "../ui/progress.h"
 #include "../ui/util.h"
 
 extern int verbose;
@@ -42,6 +38,8 @@ extern int debug_data_convert;
 
 #define STRERR_BUFSIZE	128	/* For the buffer size of str_error_r */
 
+union perf_event;
+
 int dump_printf(const char *fmt, ...) __printf(1, 2);
 void trace_event(union perf_event *event);
 
tools/perf/util/dwarf-aux.c +1 -0
index 03b2de1f5a35..df6cee5c071f 100644
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include "debug.h"
 #include "dwarf-aux.h"
+#include "strbuf.h"
 #include "string2.h"
 
 /**
tools/perf/util/dwarf-aux.h +2 -0
index 0489b0cf8e2c..f204e5892403 100644
@@ -10,6 +10,8 @@
 #include <elfutils/libdwfl.h>
 #include <elfutils/version.h>
 
+struct strbuf;
+
 /* Find the realpath of the target file */
 const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname);
 
tools/perf/util/env.c +1 -0
index 571efb4f0351..3baca06786fb 100644
@@ -9,6 +9,7 @@
 #include <sys/utsname.h>
 #include <bpf/libbpf.h>
 #include <stdlib.h>
+#include <string.h>
 
 struct perf_env perf_env;
 
tools/perf/util/evlist.c +1 -0
index 71b231c7097f..b5d6d6ec9a9b 100644
@@ -35,6 +35,7 @@
 #include <linux/hash.h>
 #include <linux/log2.h>
 #include <linux/err.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include <perf/evlist.h>
 #include <perf/evsel.h>
tools/perf/util/expr.y +2 -0
index 432b8560cf51..f9a20a39b64a 100644
@@ -2,9 +2,11 @@
 %{
 #include "util.h"
 #include "util/debug.h"
+#include <stdlib.h> // strtod()
 #define IN_EXPR_Y 1
 #include "expr.h"
 #include "smt.h"
+#include <assert.h>
 #include <string.h>
 
 #define MAXIDLEN 256
tools/perf/util/hist.c +1 -0
index adae4134e972..02ea2ee62814 100644
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <inttypes.h>
 #include <sys/param.h>
+#include <linux/string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
tools/perf/util/intel-pt.c +1 -0
index 825e3690940d..9b56fb74bedf 100644
@@ -9,6 +9,7 @@
 #include <stdbool.h>
 #include <errno.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/types.h>
 #include <linux/zalloc.h>
 
tools/perf/util/llvm-utils.c +1 -0
index 9f0470ecbca9..55fb4b3b1157 100644
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <linux/err.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include "debug.h"
 #include "llvm-utils.h"
tools/perf/util/lzma.c +1 -0
index b1dd29a9d915..397447066033 100644
@@ -9,6 +9,7 @@
 #include "compress.h"
 #include "util.h"
 #include "debug.h"
+#include <string.h>
 #include <unistd.h>
 
 #define BUFSIZE 8192
tools/perf/util/machine.c +1 -0
index a1542b4c047b..6e9afe4e55dd 100644
@@ -30,6 +30,7 @@
 #include <linux/ctype.h>
 #include <symbol/kallsyms.h>
 #include <linux/mman.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 static void __machine__remove_thread(struct machine *machine, struct thread *th, bool lock);
tools/perf/util/map.c +1 -0
index 27b7b102e4a2..c75b20b93820 100644
@@ -20,6 +20,7 @@
 #include "namespaces.h"
 #include "unwind.h"
 #include "srccode.h"
+#include "ui/ui.h"
 
 static void __maps__insert(struct maps *maps, struct map *map);
 static void __maps__insert_name(struct maps *maps, struct map *map);
tools/perf/util/ordered-events.c +1 -0
index bb5f34b7ab44..359db2b1fcef 100644
@@ -8,6 +8,7 @@
 #include "session.h"
 #include "asm/bug.h"
 #include "debug.h"
+#include "ui/progress.h"
 
 #define pr_N(n, fmt, ...) \
 	eprintf(n, debug_ordered_events, fmt, ##__VA_ARGS__)
tools/perf/util/parse-branch-options.c +2 -0
index 1430437b9d51..bb4aa88c50a8 100644
@@ -1,8 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "util/debug.h"
+#include "util/event.h"
 #include <subcmd/parse-options.h>
 #include "util/parse-branch-options.h"
 #include <stdlib.h>
+#include <string.h>
 
 #define BRANCH_OPT(n, m) \
 	{ .name = n, .mode = (m) }
tools/perf/util/perf-hooks.c +1 -0
index 4f3aa8d99ef4..e635c594f773 100644
@@ -8,6 +8,7 @@
 
 #include <errno.h>
 #include <stdlib.h>
+#include <string.h>
 #include <setjmp.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
tools/perf/util/probe-finder.c +1 -0
index 025fc4491993..505905fc21c5 100644
@@ -24,6 +24,7 @@
 #include "dso.h"
 #include "debug.h"
 #include "intlist.h"
+#include "strbuf.h"
 #include "strlist.h"
 #include "symbol.h"
 #include "probe-finder.h"
tools/perf/util/pstack.c +1 -0
index 28de8a4c2ce8..80ff41fc45be 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
 #include <stdlib.h>
+#include <string.h>
 
 struct pstack {
 	unsigned short	top;
tools/perf/util/sort.c +1 -0
index 23d0ab7c801c..035355a9945e 100644
@@ -22,6 +22,7 @@
 #include "annotate.h"
 #include "time-utils.h"
 #include <linux/kernel.h>
+#include <linux/string.h>
 
 regex_t		parent_regex;
 const char	default_parent_pattern[] = "^sys_|^do_page_fault";
tools/perf/util/strbuf.c +4 -0
index 0afdbf38a2b2..a64a37628f12 100644
@@ -1,8 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "cache.h"
 #include "debug.h"
+#include "strbuf.h"
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 
tools/perf/util/symbol.c +1 -0
index 035f2e75728c..c37cca690864 100644
@@ -7,6 +7,7 @@
 #include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/mman.h>
+#include <linux/string.h>
 #include <linux/time64.h>
 #include <sys/types.h>
 #include <sys/stat.h>
tools/perf/util/target.c +3 -0
index 3adc65480349..565f7aef7e6c 100644
@@ -10,8 +10,11 @@
 #include "debug.h"
 
 #include <pwd.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
 
 enum target_errno target__validate(struct target *target)
 {
tools/perf/util/thread-stack.c +1 -0
index 15134ac9b8f1..cd8a948d03ec 100644
@@ -10,6 +10,7 @@
 #include <linux/zalloc.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <string.h>
 #include "thread.h"
 #include "event.h"
 #include "machine.h"
tools/perf/util/util.c +1 -0
index 607daec22943..32322a20a68b 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "util.h"
 #include "debug.h"
+#include "event.h"
 #include "namespaces.h"
 #include <api/fs/fs.h>
 #include <sys/mman.h>
tools/perf/util/values.c +1 -0
index c59154e2d124..b9823f414f10 100644
@@ -2,6 +2,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <errno.h>
 #include <linux/zalloc.h>
 
tools/perf/util/zlib.c +1 -0
index 512ad7c09b13..59d456f716e9 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <fcntl.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
Signature · 1 line
2.21.0
author maintainer
#17 lore raw

PATCH 17/47 perf env: Remove env.h from other headers where just a fwd decl is needed

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

And fixup the fallout of c files not building due to now missing headers.

---
 tools/perf/arch/common.h    | 4 +++-
 tools/perf/tests/mem2node.c | 2 ++
 tools/perf/util/cputopo.h   | 1 -
 tools/perf/util/mem2node.c  | 2 ++
 tools/perf/util/mem2node.h  | 3 ++-
 5 files changed, 9 insertions(+), 3 deletions(-)
tools/perf/arch/common.h +3 -1
index c298a446d1f6..e965ed8bb328 100644
@@ -2,7 +2,9 @@
 #ifndef ARCH_PERF_COMMON_H
 #define ARCH_PERF_COMMON_H
 
-#include "../util/env.h"
+#include <stdbool.h>
+
+struct perf_env;
 
 int perf_env__lookup_objdump(struct perf_env *env, const char **path);
 bool perf_env__single_address_space(struct perf_env *env);
tools/perf/tests/mem2node.c +2 -0
index 73b2855acaf4..7672ade70f20 100644
@@ -1,10 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <linux/bitmap.h>
+#include <linux/kernel.h>
 #include <linux/zalloc.h>
 #include <perf/cpumap.h>
 #include "cpumap.h"
 #include "debug.h"
+#include "env.h"
 #include "mem2node.h"
 #include "tests.h"
 
tools/perf/util/cputopo.h +0 -1
index bae2f1d41856..7bf6b811f715 100644
@@ -3,7 +3,6 @@
 #define __PERF_CPUTOPO_H
 
 #include <linux/types.h>
-#include "env.h"
 
 struct cpu_topology {
 	u32	  core_sib;
tools/perf/util/mem2node.c +2 -0
index 14fb9e72aeeb..797d86a1ab09 100644
@@ -1,8 +1,10 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <linux/bitmap.h>
+#include <linux/kernel.h>
 #include <linux/zalloc.h>
 #include "debug.h"
+#include "env.h"
 #include "mem2node.h"
 
 struct phys_entry {
tools/perf/util/mem2node.h +2 -1
index 59c4752a2181..8dfa2b58d0cd 100644
@@ -2,8 +2,9 @@
 #define __MEM2NODE_H
 
 #include <linux/rbtree.h>
-#include "env.h"
+#include <linux/types.h>
 
+struct perf_env;
 struct phys_entry;
 
 struct mem2node {
Signature · 1 line
2.21.0
author maintainer
#18 lore raw

PATCH 18/47 perf event: Remove needless include directives from event.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

bpf.h and build-id.h are not needed at all in event.h, remove them.

And fixup the fallout of files that were getting needed stuff from this now pruned include.

---
 tools/perf/arch/powerpc/util/unwind-libdw.c |  1 +
 tools/perf/arch/x86/util/perf_regs.c        |  1 +
 tools/perf/perf.c                           |  1 +
 tools/perf/util/bpf-event.h                 |  1 +
 tools/perf/util/callchain.h                 |  1 +
 tools/perf/util/config.c                    |  2 ++
 tools/perf/util/debug.c                     |  1 +
 tools/perf/util/event.h                     | 18 ++++++++++++------
 8 files changed, 20 insertions(+), 6 deletions(-)
tools/perf/arch/powerpc/util/unwind-libdw.c +1 -0
index 7a1f05ef2fc0..abf2dbc7f829 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <elfutils/libdwfl.h>
+#include <linux/kernel.h>
 #include "../../util/unwind-libdw.h"
 #include "../../util/perf_regs.h"
 #include "../../util/event.h"
tools/perf/arch/x86/util/perf_regs.c +1 -0
index 99ea60211e16..c218b83e063b 100644
@@ -2,6 +2,7 @@
 #include <errno.h>
 #include <string.h>
 #include <regex.h>
+#include <linux/kernel.h>
 #include <linux/zalloc.h>
 
 #include "../../perf-sys.h"
tools/perf/perf.c +1 -0
index e0910637a82d..8763b2c0fbfd 100644
@@ -10,6 +10,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "util/build-id.h"
 #include "util/cache.h"
 #include "util/env.h"
 #include <subcmd/exec-cmd.h>
tools/perf/util/bpf-event.h +1 -0
index 417b78835ea0..a01c2fd68c03 100644
@@ -13,6 +13,7 @@ struct machine;
 union perf_event;
 struct perf_env;
 struct perf_sample;
+struct perf_session;
 struct record_opts;
 struct evlist;
 struct target;
tools/perf/util/callchain.h +1 -0
index 45b9ed49e2b1..b042ceef4114 100644
@@ -8,6 +8,7 @@
 #include "map_symbol.h"
 #include "branch.h"
 
+struct evsel;
 struct map;
 
 #define HELP_PAD "\t\t\t\t"
tools/perf/util/config.c +2 -0
index eb5308c41ed1..7ebf9e31ae22 100644
@@ -17,6 +17,8 @@
 #include "util/event.h"  /* proc_map_timeout */
 #include "util/hist.h"  /* perf_hist_config */
 #include "util/llvm-utils.h"   /* perf_llvm_config */
+#include "build-id.h"
+#include "debug.h"
 #include "config.h"
 #include "debug.h"
 #include <sys/types.h>
tools/perf/util/debug.c +1 -0
index 522887ee4c02..143d379d4608 100644
@@ -8,6 +8,7 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 #include <api/debug.h>
+#include <linux/kernel.h>
 #include <linux/time64.h>
 #ifdef HAVE_BACKTRACE_SUPPORT
 #include <execinfo.h>
tools/perf/util/event.h +12 -6
index f56d268f06e3..006aa432be19 100644
@@ -1,17 +1,23 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __PERF_RECORD_H
 #define __PERF_RECORD_H
-
-#include <limits.h>
+/*
+ * The linux/stddef.h isn't need here, but is needed for __always_inline used
+ * in files included from uapi/linux/perf_event.h such as
+ * /usr/include/linux/swab.h and /usr/include/linux/byteorder/little_endian.h,
+ * detected in at least musl libc, used in Alpine Linux. -acme
+ */
 #include <stdio.h>
-#include <linux/kernel.h>
-#include <linux/bpf.h>
-#include <linux/perf_event.h>
+#include <linux/stddef.h>
 #include <perf/event.h>
+#include <linux/types.h>
 
-#include "build-id.h"
 #include "perf_regs.h"
 
+struct dso;
+struct machine;
+struct perf_event_attr;
+
 #ifdef __LP64__
 /*
  * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
Signature · 1 line
2.21.0
author maintainer
#19 lore raw

PATCH 19/47 libtraceevent, perf tools: Changes in tep_print_event_* APIs

In reply to Arnaldo Carvalho de Melo

From: Tzvetomir Stoyanov <[email protected]>

Libtraceevent APIs for printing various trace events information are complicated, there are complex extra parameters. To control the way event information is printed, the user should call a set of functions in a specific sequence.

These APIs are reimplemented to provide a more simple interface for printing event information.

Removed APIs:

tep_print_event_task()

	tep_print_event_time()
	tep_print_event_data()
	tep_event_info()
	tep_is_latency_format()
	tep_set_latency_format()
	tep_data_latency_format()
	tep_set_print_raw()

A new API for printing event information is introduced:
void tep_print_event(struct tep_handle *tep, struct trace_seq *s,

		        struct tep_record *record, const char *fmt, ...);

where "fmt" is a printf-like format string, followed by the event fields to be printed. Supported fields:
TEP_PRINT_PID, "%d" - event PID
TEP_PRINT_CPU, "%d" - event CPU
TEP_PRINT_COMM, "%s" - event command string TEP_PRINT_NAME, "%s" - event name
TEP_PRINT_LATENCY, "%s" - event latency
TEP_PRINT_TIME, %d - event time stamp. A divisor and precision
can be specified as part of this format string:
"%precision.divisord". Example:
"%3.1000d" - divide the time by 1000 and print the first 3 digits before the dot. Thus, the time stamp "123456000" will be printed as "123.456"
TEP_PRINT_INFO, "%s" - event information. TEP_PRINT_INFO_RAW, "%s" - event information, in raw format.

Example:
tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s",

		  TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU,
		  TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME, TEP_PRINT_INFO);
Output:
	ls-11314 [005] d.h. 185207.366383 function __wake_up
---
 tools/lib/traceevent/event-parse-api.c   |  40 ---
 tools/lib/traceevent/event-parse-local.h |   4 -
 tools/lib/traceevent/event-parse.c       | 322 +++++++++++++----------
 tools/lib/traceevent/event-parse.h       |  29 +-
 tools/perf/builtin-kmem.c                |   3 +-
 tools/perf/util/sort.c                   |   3 +-
 tools/perf/util/trace-event-parse.c      |   2 +-
 7 files changed, 203 insertions(+), 200 deletions(-)
tools/lib/traceevent/event-parse-api.c +0 -40
index 988587840c80..4faf52a65791 100644
@@ -302,33 +302,6 @@ void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian)
 		tep->host_bigendian = endian;
 }
 
-/**
- * tep_is_latency_format - get if the latency output format is configured
- * @tep: a handle to the tep_handle
- *
- * This returns true if the latency output format is configured
- * If @tep is NULL, false is returned.
- */
-bool tep_is_latency_format(struct tep_handle *tep)
-{
-	if (tep)
-		return (tep->latency_format);
-	return false;
-}
-
-/**
- * tep_set_latency_format - set the latency output format
- * @tep: a handle to the tep_handle
- * @lat: non zero for latency output format
- *
- * This sets the latency output format
-  */
-void tep_set_latency_format(struct tep_handle *tep, int lat)
-{
-	if (tep)
-		tep->latency_format = lat;
-}
-
 /**
  * tep_is_old_format - get if an old kernel is used
  * @tep: a handle to the tep_handle
@@ -344,19 +317,6 @@ bool tep_is_old_format(struct tep_handle *tep)
 	return false;
 }
 
-/**
- * tep_set_print_raw - set a flag to force print in raw format
- * @tep: a handle to the tep_handle
- * @print_raw: the new value of the print_raw flag
- *
- * This sets a flag to force print in raw format
- */
-void tep_set_print_raw(struct tep_handle *tep, int print_raw)
-{
-	if (tep)
-		tep->print_raw = print_raw;
-}
-
 /**
  * tep_set_test_filters - set a flag to test a filter string
  * @tep: a handle to the tep_handle
tools/lib/traceevent/event-parse-local.h +0 -4
index 09aa142f7fdd..6e58ee1fe7c8 100644
@@ -28,8 +28,6 @@ struct tep_handle {
 	enum tep_endian file_bigendian;
 	enum tep_endian host_bigendian;
 
-	int latency_format;
-
 	int old_format;
 
 	int cpus;
@@ -70,8 +68,6 @@ struct tep_handle {
 	int ld_offset;
 	int ld_size;
 
-	int print_raw;
-
 	int test_filters;
 
 	int flags;
tools/lib/traceevent/event-parse.c +187 -135

418 lines not on this page · raw message

tools/lib/traceevent/event-parse.h +11 -18
index 642f68ab5fb2..cf7f302eb44a 100644
@@ -442,18 +442,18 @@ int tep_register_print_string(struct tep_handle *tep, const char *fmt,
 			      unsigned long long addr);
 bool tep_is_pid_registered(struct tep_handle *tep, int pid);
 
-void tep_print_event_task(struct tep_handle *tep, struct trace_seq *s,
-			  struct tep_event *event,
-			  struct tep_record *record);
-void tep_print_event_time(struct tep_handle *tep, struct trace_seq *s,
-			  struct tep_event *event,
-			  struct tep_record *record,
-			  bool use_trace_clock);
-void tep_print_event_data(struct tep_handle *tep, struct trace_seq *s,
-			  struct tep_event *event,
-			  struct tep_record *record);
+#define TEP_PRINT_INFO		"INFO"
+#define TEP_PRINT_INFO_RAW	"INFO_RAW"
+#define TEP_PRINT_COMM		"COMM"
+#define TEP_PRINT_LATENCY	"LATENCY"
+#define TEP_PRINT_NAME		"NAME"
+#define TEP_PRINT_PID		1U
+#define TEP_PRINT_TIME		2U
+#define TEP_PRINT_CPU		3U
+
 void tep_print_event(struct tep_handle *tep, struct trace_seq *s,
-		     struct tep_record *record, bool use_trace_clock);
+		     struct tep_record *record, const char *fmt, ...)
+	__attribute__ ((format (printf, 4, 5)));
 
 int tep_parse_header_page(struct tep_handle *tep, char *buf, unsigned long size,
 			  int long_size);
@@ -525,8 +525,6 @@ tep_find_event_by_name(struct tep_handle *tep, const char *sys, const char *name
 struct tep_event *
 tep_find_event_by_record(struct tep_handle *tep, struct tep_record *record);
 
-void tep_data_latency_format(struct tep_handle *tep,
-			     struct trace_seq *s, struct tep_record *record);
 int tep_data_type(struct tep_handle *tep, struct tep_record *rec);
 int tep_data_pid(struct tep_handle *tep, struct tep_record *rec);
 int tep_data_preempt_count(struct tep_handle *tep, struct tep_record *rec);
@@ -541,8 +539,6 @@ void tep_print_field(struct trace_seq *s, void *data,
 		     struct tep_format_field *field);
 void tep_print_fields(struct trace_seq *s, void *data,
 		      int size __maybe_unused, struct tep_event *event);
-void tep_event_info(struct trace_seq *s, struct tep_event *event,
-		    struct tep_record *record);
 int tep_strerror(struct tep_handle *tep, enum tep_errno errnum,
 		 char *buf, size_t buflen);
 
@@ -566,12 +562,9 @@ bool tep_is_file_bigendian(struct tep_handle *tep);
 void tep_set_file_bigendian(struct tep_handle *tep, enum tep_endian endian);
 bool tep_is_local_bigendian(struct tep_handle *tep);
 void tep_set_local_bigendian(struct tep_handle *tep, enum tep_endian endian);
-bool tep_is_latency_format(struct tep_handle *tep);
-void tep_set_latency_format(struct tep_handle *tep, int lat);
 int tep_get_header_page_size(struct tep_handle *tep);
 int tep_get_header_timestamp_size(struct tep_handle *tep);
 bool tep_is_old_format(struct tep_handle *tep);
-void tep_set_print_raw(struct tep_handle *tep, int print_raw);
 void tep_set_test_filters(struct tep_handle *tep, int test_filters);
 
 struct tep_handle *tep_alloc(void);
tools/perf/builtin-kmem.c +2 -1
index 7eec0da64c46..378b09c910a8 100644
@@ -750,7 +750,8 @@ static int parse_gfp_flags(struct evsel *evsel, struct perf_sample *sample,
 	}
 
 	trace_seq_init(&seq);
-	tep_event_info(&seq, evsel->tp_format, &record);
+	tep_print_event(evsel->tp_format->tep,
+			&seq, &record, "%s", TEP_PRINT_INFO);
 
 	str = strtok_r(seq.buffer, " ", &pos);
 	while (str) {
tools/perf/util/sort.c +2 -1
index 035355a9945e..4650704540c9 100644
@@ -709,7 +709,8 @@ static char *get_trace_output(struct hist_entry *he)
 		tep_print_fields(&seq, he->raw_data, he->raw_size,
 				 evsel->tp_format);
 	} else {
-		tep_event_info(&seq, evsel->tp_format, &rec);
+		tep_print_event(evsel->tp_format->tep,
+				&seq, &rec, "%s", TEP_PRINT_INFO);
 	}
 	/*
 	 * Trim the buffer, it starts at 4KB and we're not going to
tools/perf/util/trace-event-parse.c +1 -1
index 8e31a63045c3..5d6bfc70b210 100644
@@ -109,7 +109,7 @@ void event_format__fprintf(struct tep_event *event,
 	record.data = data;
 
 	trace_seq_init(&s);
-	tep_event_info(&s, event, &record);
+	tep_print_event(event->tep, &s, &record, "%s", TEP_PRINT_INFO);
 	trace_seq_do_fprintf(&s, fp);
 	trace_seq_destroy(&s);
 }
Signature · 1 line
2.21.0
author maintainer
#20 lore raw

PATCH 20/47 libtraceevent: Remove tep_register_trace_clock()

In reply to Arnaldo Carvalho de Melo

From: Tzvetomir Stoyanov <[email protected]>

The tep_register_trace_clock() API is used to instruct the traceevent library how to print the event time stamps. As event print interface if redesigned, this API is not needed any more. The new event print API is flexible and the user can specify how the time stamps are printed.

---
 tools/lib/traceevent/event-parse-local.h |  2 --
 tools/lib/traceevent/event-parse.c       | 11 -----------
 tools/lib/traceevent/event-parse.h       |  1 -
 3 files changed, 14 deletions(-)
tools/lib/traceevent/event-parse-local.h +0 -2
index 6e58ee1fe7c8..cee469803a34 100644
@@ -81,8 +81,6 @@ struct tep_handle {
 
 	/* cache */
 	struct tep_event *last_event;
-
-	char *trace_clock;
 };
 
 void tep_free_event(struct tep_event *event);
tools/lib/traceevent/event-parse.c +0 -11
index d1085aab9c43..bb22238debfe 100644
@@ -393,16 +393,6 @@ int tep_override_comm(struct tep_handle *tep, const char *comm, int pid)
 	return _tep_register_comm(tep, comm, pid, true);
 }
 
-int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock)
-{
-	tep->trace_clock = strdup(trace_clock);
-	if (!tep->trace_clock) {
-		errno = ENOMEM;
-		return -1;
-	}
-	return 0;
-}
-
 struct func_map {
 	unsigned long long		addr;
 	char				*func;
@@ -7057,7 +7047,6 @@ void tep_free(struct tep_handle *tep)
 		free_handler(handle);
 	}
 
-	free(tep->trace_clock);
 	free(tep->events);
 	free(tep->sort_events);
 	free(tep->func_resolver);
tools/lib/traceevent/event-parse.h +0 -1
index cf7f302eb44a..d438ee44289f 100644
@@ -435,7 +435,6 @@ int tep_set_function_resolver(struct tep_handle *tep,
 void tep_reset_function_resolver(struct tep_handle *tep);
 int tep_register_comm(struct tep_handle *tep, const char *comm, int pid);
 int tep_override_comm(struct tep_handle *tep, const char *comm, int pid);
-int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock);
 int tep_register_function(struct tep_handle *tep, char *name,
 			  unsigned long long addr, char *mod);
 int tep_register_print_string(struct tep_handle *tep, const char *fmt,
Signature · 1 line
2.21.0
author maintainer
#21 lore raw

PATCH 21/47 libtraceevent: Change users plugin directory

In reply to Arnaldo Carvalho de Melo

From: Tzvetomir Stoyanov <[email protected]>

To be compliant with XDG user directory layout, the user's plugin directory is changed from ~/.traceevent/plugins to ~/.local/lib/traceevent/plugins/

---
 tools/lib/traceevent/Makefile       | 6 +++---
 tools/lib/traceevent/event-plugin.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/lib/traceevent/Makefile +3 -3
index 8352d53dcb5a..a39cdd0d890d 100644
@@ -62,15 +62,15 @@ set_plugin_dir := 1
 
 # Set plugin_dir to preffered global plugin location
 # If we install under $HOME directory we go under
-# $(HOME)/.traceevent/plugins
+# $(HOME)/.local/lib/traceevent/plugins
 #
 # We dont set PLUGIN_DIR in case we install under $HOME
 # directory, because by default the code looks under:
-# $(HOME)/.traceevent/plugins by default.
+# $(HOME)/.local/lib/traceevent/plugins by default.
 #
 ifeq ($(plugin_dir),)
 ifeq ($(prefix),$(HOME))
-override plugin_dir = $(HOME)/.traceevent/plugins
+override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
 set_plugin_dir := 0
 else
 override plugin_dir = $(libdir)/traceevent/plugins
tools/lib/traceevent/event-plugin.c +1 -1
index 8ca28de9337a..e1f7ddd5a6cf 100644
@@ -18,7 +18,7 @@
 #include "event-utils.h"
 #include "trace-seq.h"
 
-#define LOCAL_PLUGIN_DIR ".traceevent/plugins"
+#define LOCAL_PLUGIN_DIR ".local/lib/traceevent/plugins/"
 
 static struct registered_plugin_options {
 	struct registered_plugin_options	*next;
Signature · 1 line
2.21.0
author maintainer
#22 lore raw

PATCH 22/47 perf dso: Adopt DSO related macros from symbol.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Reducing the size of symbol.h by removing things that are better placed somewhere else.

---
 tools/perf/util/annotate.c   | 1 +
 tools/perf/util/build-id.c   | 1 +
 tools/perf/util/dso.h        | 3 +++
 tools/perf/util/probe-file.c | 1 +
 tools/perf/util/symbol.c     | 1 +
 tools/perf/util/symbol.h     | 3 ---
 6 files changed, 7 insertions(+), 3 deletions(-)
tools/perf/util/annotate.c +1 -0
index 3bd1691f0be7..67a7513077d0 100644
@@ -20,6 +20,7 @@
 #include "color.h"
 #include "config.h"
 #include "cache.h"
+#include "dso.h"
 #include "map.h"
 #include "symbol.h"
 #include "srcline.h"
tools/perf/util/build-id.c +1 -0
index 4c96a33b09ff..e5fb77755d9e 100644
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include "dso.h"
 #include "build-id.h"
 #include "event.h"
 #include "namespaces.h"
tools/perf/util/dso.h +3 -0
index 6e3f63781e51..ff0b81854628 100644
@@ -16,6 +16,9 @@ struct machine;
 struct map;
 struct perf_env;
 
+#define DSO__NAME_KALLSYMS	"[kernel.kallsyms]"
+#define DSO__NAME_KCORE		"[kernel.kcore]"
+
 enum dso_binary_type {
 	DSO_BINARY_TYPE__KALLSYMS = 0,
 	DSO_BINARY_TYPE__GUEST_KALLSYMS,
tools/perf/util/probe-file.c +1 -0
index 5b4d49382932..10d2ab179c71 100644
@@ -16,6 +16,7 @@
 #include "strlist.h"
 #include "strfilter.h"
 #include "debug.h"
+#include "dso.h"
 #include "cache.h"
 #include "color.h"
 #include "symbol.h"
tools/perf/util/symbol.c +1 -0
index c37cca690864..b11a69681662 100644
@@ -18,6 +18,7 @@
 #include "annotate.h"
 #include "build-id.h"
 #include "cap.h"
+#include "dso.h"
 #include "util.h"
 #include "debug.h"
 #include "event.h"
tools/perf/util/symbol.h +0 -3
index 183f630cb5f1..159c59652a5c 100644
@@ -46,9 +46,6 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 #define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
 #endif
 
-#define DSO__NAME_KALLSYMS	"[kernel.kallsyms]"
-#define DSO__NAME_KCORE		"[kernel.kcore]"
-
 /** struct symbol - symtab entry
  *
  * @ignore - resolvable but tools ignore it (e.g. idle routines)
Signature · 1 line
2.21.0
author maintainer
#23 lore raw

PATCH 23/47 perf symbol: Move C++ demangle defines to the only file using it

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

No need to have it generally available in such a critical header as symbol.h.

---
 tools/perf/util/symbol-elf.c | 6 ++++++
 tools/perf/util/symbol.h     | 6 ------
 2 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/util/symbol-elf.c +6 -0
index 7d504dc22108..6d22437e88ae 100644
@@ -40,6 +40,12 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
+#ifndef DMGL_PARAMS
+#define DMGL_NO_OPTS     0              /* For readability... */
+#define DMGL_PARAMS      (1 << 0)       /* Include function args */
+#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
+#endif
+
 #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
 extern char *cplus_demangle(const char *, int);
 
tools/perf/util/symbol.h +0 -6
index 159c59652a5c..bcc0d84a42b8 100644
@@ -40,12 +40,6 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 			     GElf_Shdr *shp, const char *name, size_t *idx);
 #endif
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS     0              /* For readability... */
-#define DMGL_PARAMS      (1 << 0)       /* Include function args */
-#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
-#endif
-
 /** struct symbol - symtab entry
  *
  * @ignore - resolvable but tools ignore it (e.g. idle routines)
Signature · 1 line
2.21.0
author maintainer
#24 lore raw

PATCH 24/47 perf symbols: Add missing linux/refcount.h to symbol.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

We use refcount_t there, so we need that header or else it'll break when we remove dso.h, that is from where it is getting that definition now...

---
 tools/perf/util/symbol.h | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/symbol.h +1 -0
index bcc0d84a42b8..22660c7614a5 100644
@@ -3,6 +3,7 @@
 #define __PERF_SYMBOL 1
 
 #include <linux/types.h>
+#include <linux/refcount.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <linux/list.h>
Signature · 1 line
2.21.0
author maintainer
#25 lore raw

PATCH 25/47 perf symbols: Move symsrc prototypes to a separate header

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

So that we can remove dso.h from symbol.h and reduce the header dependency tree.

Fixup cases where struct dso guts are needed but were obtained via symbol.h, indirectly.

---
 tools/perf/arch/powerpc/util/sym-handling.c |  1 +
 tools/perf/builtin-probe.c                  |  1 +
 tools/perf/ui/browsers/map.c                |  1 +
 tools/perf/ui/gtk/annotate.c                |  1 +
 tools/perf/util/symbol-elf.c                |  1 +
 tools/perf/util/symbol-minimal.c            |  2 +
 tools/perf/util/symbol.c                    |  1 +
 tools/perf/util/symbol.h                    | 36 ++--------------
 tools/perf/util/symbol_fprintf.c            |  1 +
 tools/perf/util/symsrc.h                    | 46 +++++++++++++++++++++
 10 files changed, 58 insertions(+), 33 deletions(-)
 create mode 100644 tools/perf/util/symsrc.h
tools/perf/arch/powerpc/util/sym-handling.c +1 -0
index b0a67eaf2ce8..8a4b717e0a53 100644
@@ -5,6 +5,7 @@
  */
 
 #include "debug.h"
+#include "dso.h"
 #include "symbol.h"
 #include "map.h"
 #include "probe-event.h"
tools/perf/builtin-probe.c +1 -0
index 8950c05ef8fd..6dce1724a378 100644
@@ -18,6 +18,7 @@
 
 #include "builtin.h"
 #include "namespaces.h"
+#include "util/build-id.h"
 #include "util/strlist.h"
 #include "util/strfilter.h"
 #include "util/symbol.h"
tools/perf/ui/browsers/map.c +1 -0
index 4c545b92e20d..893b065971f6 100644
@@ -8,6 +8,7 @@
 #include "../../util/util.h"
 #include "../../util/debug.h"
 #include "../../util/map.h"
+#include "../../util/dso.h"
 #include "../../util/symbol.h"
 #include "../browser.h"
 #include "../helpline.h"
tools/perf/ui/gtk/annotate.c +1 -0
index d7f984436dec..8e744af24f7c 100644
@@ -5,6 +5,7 @@
 #include "util/annotate.h"
 #include "util/evsel.h"
 #include "util/map.h"
+#include "util/dso.h"
 #include "util/symbol.h"
 #include "ui/helpline.h"
 #include <inttypes.h>
tools/perf/util/symbol-elf.c +1 -0
index 6d22437e88ae..9428639872a6 100644
@@ -10,6 +10,7 @@
 #include "map.h"
 #include "map_groups.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
 #include "machine.h"
tools/perf/util/symbol-minimal.c +2 -0
index 3bc8b7e3300e..7e2813ec9498 100644
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "dso.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "util.h"
 
 #include <errno.h>
tools/perf/util/symbol.c +1 -0
index b11a69681662..e5ffe61ad66b 100644
@@ -25,6 +25,7 @@
 #include "machine.h"
 #include "map.h"
 #include "symbol.h"
+#include "symsrc.h"
 #include "strlist.h"
 #include "intlist.h"
 #include "namespaces.h"
tools/perf/util/symbol.h +3 -33
index 22660c7614a5..5a58407c2945 100644
@@ -20,8 +20,7 @@
 #endif
 #include <elf.h>
 
-#include "dso.h"
-
+struct dso;
 struct map;
 struct map_groups;
 struct option;
@@ -148,37 +147,6 @@ struct addr_location {
 	s32	      socket;
 };
 
-struct symsrc {
-	char *name;
-	int fd;
-	enum dso_binary_type type;
-
-#ifdef HAVE_LIBELF_SUPPORT
-	Elf *elf;
-	GElf_Ehdr ehdr;
-
-	Elf_Scn *opdsec;
-	size_t opdidx;
-	GElf_Shdr opdshdr;
-
-	Elf_Scn *symtab;
-	GElf_Shdr symshdr;
-
-	Elf_Scn *dynsym;
-	size_t dynsym_idx;
-	GElf_Shdr dynshdr;
-
-	bool adjust_symbols;
-	bool is_64_bit;
-#endif
-};
-
-void symsrc__destroy(struct symsrc *ss);
-int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
-		 enum dso_binary_type type);
-bool symsrc__has_symtab(struct symsrc *ss);
-bool symsrc__possibly_runtime(struct symsrc *ss);
-
 int dso__load(struct dso *dso, struct map *map);
 int dso__load_vmlinux(struct dso *dso, struct map *map,
 		      const char *vmlinux, bool vmlinux_allocated);
@@ -232,6 +200,8 @@ bool symbol__restricted_filename(const char *filename,
 int symbol__config_symfs(const struct option *opt __maybe_unused,
 			 const char *dir, int unset __maybe_unused);
 
+struct symsrc;
+
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, int kmodule);
 int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss);
tools/perf/util/symbol_fprintf.c +1 -0
index 02e89b02c2ce..35c936ce33ef 100644
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
+#include "dso.h"
 #include "map.h"
 #include "symbol.h"
 
tools/perf/util/symsrc.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.21.0
author maintainer
#26 lore raw

PATCH 26/47 perf dsos: Move the dsos struct and its methods to separate source files

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

So that we can reduce the header dependency tree further, in the process noticed that lots of places were getting even things like build-id routines and 'struct perf_tool' definition indirectly, so fix all those too.

---
 tools/perf/builtin-annotate.c                 |   1 +
 tools/perf/builtin-buildid-cache.c            |   1 +
 tools/perf/builtin-buildid-list.c             |   1 +
 tools/perf/builtin-inject.c                   |   1 +
 tools/perf/builtin-kallsyms.c                 |   1 +
 tools/perf/builtin-kmem.c                     |   1 +
 tools/perf/builtin-kvm.c                      |   1 +
 tools/perf/builtin-mem.c                      |   1 +
 tools/perf/builtin-report.c                   |   1 +
 tools/perf/builtin-script.c                   |   1 +
 tools/perf/builtin-top.c                      |   1 +
 tools/perf/builtin-trace.c                    |   2 +
 tools/perf/tests/code-reading.c               |   1 +
 tools/perf/tests/dso-data.c                   |   1 +
 tools/perf/tests/dwarf-unwind.c               |   1 +
 tools/perf/tests/event_update.c               |   1 +
 tools/perf/tests/hists_common.c               |   1 +
 tools/perf/tests/hists_cumulate.c             |   1 +
 tools/perf/tests/hists_output.c               |   1 +
 tools/perf/tests/vmlinux-kallsyms.c           |   1 +
 tools/perf/ui/browsers/annotate.c             |   1 +
 tools/perf/ui/browsers/hists.c                |   1 +
 tools/perf/util/Build                         |   1 +
 tools/perf/util/bpf-event.c                   |   1 +
 tools/perf/util/callchain.c                   |   1 +
 tools/perf/util/cs-etm.c                      |   2 +
 tools/perf/util/db-export.c                   |   1 +
 tools/perf/util/dso.c                         | 235 +-----------------
 tools/perf/util/dso.h                         |  25 +-
 tools/perf/util/dsos.c                        | 232 +++++++++++++++++
 tools/perf/util/dsos.h                        |  44 ++++
 tools/perf/util/event.c                       |   2 +
 tools/perf/util/header.c                      |   1 +
 tools/perf/util/hist.c                        |   1 +
 tools/perf/util/intel-bts.c                   |   1 +
 tools/perf/util/jitdump.c                     |   1 +
 tools/perf/util/machine.c                     |   1 +
 tools/perf/util/machine.h                     |   3 +-
 tools/perf/util/map.c                         |   1 +
 tools/perf/util/parse-events.c                |   1 +
 tools/perf/util/probe-event.c                 |   2 +
 tools/perf/util/s390-cpumsf.c                 |   1 +
 .../util/scripting-engines/trace-event-perl.c |   1 +
 .../scripting-engines/trace-event-python.c    |   2 +
 tools/perf/util/sort.c                        |   1 +
 tools/perf/util/thread.c                      |   1 +
 tools/perf/util/unwind-libdw.c                |   1 +
 tools/perf/util/unwind-libunwind.c            |   1 +
 tools/perf/util/vdso.c                        |   1 +
 49 files changed, 331 insertions(+), 257 deletions(-)
 create mode 100644 tools/perf/util/dsos.c
 create mode 100644 tools/perf/util/dsos.h
tools/perf/builtin-annotate.c +1 -0
index 9bb637165bf9..738471a0a549 100644
@@ -27,6 +27,7 @@
 #include "util/thread.h"
 #include "util/sort.h"
 #include "util/hist.h"
+#include "util/dso.h"
 #include "util/map.h"
 #include "util/session.h"
 #include "util/tool.h"
tools/perf/builtin-buildid-cache.c +1 -0
index 9e756004ef28..b035911969b8 100644
@@ -22,6 +22,7 @@
 #include "util/strlist.h"
 #include "util/build-id.h"
 #include "util/session.h"
+#include "util/dso.h"
 #include "util/symbol.h"
 #include "util/time-utils.h"
 #include "util/util.h"
tools/perf/builtin-buildid-list.c +1 -0
index 72bdc0eba990..38b2ec61c021 100644
@@ -12,6 +12,7 @@
 #include "util/build-id.h"
 #include "util/cache.h"
 #include "util/debug.h"
+#include "util/dso.h"
 #include <subcmd/parse-options.h>
 #include "util/session.h"
 #include "util/symbol.h"
tools/perf/builtin-inject.c +1 -0
index ae46de46e826..c14f40b858bc 100644
@@ -9,6 +9,7 @@
 #include "builtin.h"
 
 #include "util/color.h"
+#include "util/dso.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/map.h"
tools/perf/builtin-kallsyms.c +1 -0
index c1a44671b0b5..c08ee81529e8 100644
@@ -11,6 +11,7 @@
 #include <linux/compiler.h>
 #include <subcmd/parse-options.h>
 #include "debug.h"
+#include "dso.h"
 #include "machine.h"
 #include "map.h"
 #include "symbol.h"
tools/perf/builtin-kmem.c +1 -0
index 378b09c910a8..b5682beaad72 100644
@@ -2,6 +2,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "util/dso.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/config.h"
tools/perf/builtin-kvm.c +1 -0
index 69d16ac852c3..474c4799d29d 100644
@@ -2,6 +2,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "util/build-id.h"
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/term.h"
tools/perf/builtin-mem.c +1 -0
index 9e60eda9297d..c5f3b9e9509d 100644
@@ -13,6 +13,7 @@
 #include "util/data.h"
 #include "util/mem-events.h"
 #include "util/debug.h"
+#include "util/dso.h"
 #include "util/map.h"
 #include "util/symbol.h"
 
tools/perf/builtin-report.c +1 -0
index 94e7e354cb16..ba419ee40283 100644
@@ -12,6 +12,7 @@
 
 #include "util/annotate.h"
 #include "util/color.h"
+#include "util/dso.h"
 #include <linux/list.h>
 #include <linux/rbtree.h>
 #include <linux/err.h>
tools/perf/builtin-script.c +1 -0
index f3b31c6ed15f..1ff04b00a561 100644
@@ -4,6 +4,7 @@
 #include "util/cache.h"
 #include "util/counts.h"
 #include "util/debug.h"
+#include "util/dso.h"
 #include <subcmd/exec-cmd.h>
 #include "util/header.h"
 #include <subcmd/parse-options.h>
tools/perf/builtin-top.c +1 -0
index 5538b5886e35..0b7b12cfdd63 100644
@@ -24,6 +24,7 @@
 #include "util/bpf-event.h"
 #include "util/config.h"
 #include "util/color.h"
+#include "util/dso.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/event.h"
tools/perf/builtin-trace.c +2 -0
index b1ec8ff52740..0f633f0d6be8 100644
@@ -25,6 +25,7 @@
 #include "util/color.h"
 #include "util/config.h"
 #include "util/debug.h"
+#include "util/dso.h"
 #include "util/env.h"
 #include "util/event.h"
 #include "util/evlist.h"
@@ -42,6 +43,7 @@
 #include "util/intlist.h"
 #include "util/thread_map.h"
 #include "util/stat.h"
+#include "util/tool.h"
 #include "util/util.h"
 #include "trace/beauty/beauty.h"
 #include "trace-event.h"
tools/perf/tests/code-reading.c +1 -0
index c4b73bb4b113..7b2b89f4b716 100644
@@ -12,6 +12,7 @@
 #include <perf/evlist.h>
 
 #include "debug.h"
+#include "dso.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/tests/dso-data.c +1 -0
index 946ab4b63acd..a4874d4ce7ef 100644
@@ -9,6 +9,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <api/fs/fs.h>
+#include "dso.h"
 #include "util.h"
 #include "machine.h"
 #include "symbol.h"
tools/perf/tests/dwarf-unwind.c +1 -0
index f33709a79335..4125255ff637 100644
@@ -3,6 +3,7 @@
 #include <linux/types.h>
 #include <linux/zalloc.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <unistd.h>
 #include "tests.h"
 #include "debug.h"
tools/perf/tests/event_update.c +1 -0
index 1411155597b8..4b68ec3a13fc 100644
@@ -4,6 +4,7 @@
 #include "evlist.h"
 #include "evsel.h"
 #include "machine.h"
+#include "tool.h"
 #include "tests.h"
 #include "debug.h"
 
tools/perf/tests/hists_common.c +1 -0
index 96ad95d3f338..cdde41c03056 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <inttypes.h>
 #include "util/debug.h"
+#include "util/dso.h"
 #include "util/map.h"
 #include "util/symbol.h"
 #include "util/sort.h"
tools/perf/tests/hists_cumulate.c +1 -0
index 93af420ad2e4..fa55b7bad3af 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "util/debug.h"
+#include "util/dso.h"
 #include "util/event.h"
 #include "util/map.h"
 #include "util/symbol.h"
tools/perf/tests/hists_output.c +1 -0
index 07f4ca0704fb..3f6dfa212260 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "util/debug.h"
+#include "util/dso.h"
 #include "util/event.h"
 #include "util/map.h"
 #include "util/symbol.h"
tools/perf/tests/vmlinux-kallsyms.c +1 -0
index 5e8834fc7dec..01f434c067c6 100644
@@ -4,6 +4,7 @@
 #include <inttypes.h>
 #include <string.h>
 #include <stdlib.h>
+#include "dso.h"
 #include "map.h"
 #include "symbol.h"
 #include "util.h"
tools/perf/ui/browsers/annotate.c +1 -0
index 715601f5fce3..ac74ed2c23a0 100644
@@ -5,6 +5,7 @@
 #include "../util.h"
 #include "../../util/annotate.h"
 #include "../../util/debug.h"
+#include "../../util/dso.h"
 #include "../../util/hist.h"
 #include "../../util/sort.h"
 #include "../../util/map.h"
tools/perf/ui/browsers/hists.c +1 -0
index a14dda74f43a..cf8857456056 100644
@@ -12,6 +12,7 @@
 #include <linux/zalloc.h>
 
 #include "../../util/debug.h"
+#include "../../util/dso.h"
 #include "../../util/callchain.h"
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
tools/perf/util/Build +1 -0
index 2e3856471e61..0b4d8e0d474c 100644
@@ -36,6 +36,7 @@ perf-y += strfilter.o
 perf-y += top.o
 perf-y += usage.o
 perf-y += dso.o
+perf-y += dsos.o
 perf-y += symbol.o
 perf-y += symbol_fprintf.o
 perf-y += color.o
tools/perf/util/bpf-event.c +1 -0
index 2d6d500c9af7..7a3d4b125323 100644
@@ -8,6 +8,7 @@
 #include <linux/err.h>
 #include "bpf-event.h"
 #include "debug.h"
+#include "dso.h"
 #include "symbol.h"
 #include "machine.h"
 #include "env.h"
tools/perf/util/callchain.c +1 -0
index 76bf05b26d3b..c14646c1f2eb 100644
@@ -22,6 +22,7 @@
 #include "asm/bug.h"
 
 #include "debug.h"
+#include "dso.h"
 #include "hist.h"
 #include "sort.h"
 #include "machine.h"
tools/perf/util/cs-etm.c +2 -0
index d6de3834865e..3ed1d3bb7089 100644
@@ -21,12 +21,14 @@
 #include "cs-etm.h"
 #include "cs-etm-decoder/cs-etm-decoder.h"
 #include "debug.h"
+#include "dso.h"
 #include "evlist.h"
 #include "intlist.h"
 #include "machine.h"
 #include "map.h"
 #include "perf.h"
 #include "symbol.h"
+#include "tool.h"
 #include "thread.h"
 #include "thread_map.h"
 #include "thread-stack.h"
tools/perf/util/db-export.c +1 -0
index 701e9f814313..752227b265e7 100644
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <stdlib.h>
 
+#include "dso.h"
 #include "evsel.h"
 #include "machine.h"
 #include "thread.h"
tools/perf/util/dso.c +3 -232

277 lines not on this page · raw message

tools/perf/util/dso.h +1 -24
index ff0b81854628..e4dddb76770d 100644
@@ -2,13 +2,13 @@
 #ifndef __PERF_DSO
 #define __PERF_DSO
 
+#include <pthread.h>
 #include <linux/refcount.h>
 #include <linux/types.h>
 #include <linux/rbtree.h>
 #include <sys/types.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include "rwsem.h"
 #include <linux/bitops.h>
 #include "build-id.h"
 
@@ -129,16 +129,6 @@ struct dso_cache {
 	char data[0];
 };
 
-/*
- * DSOs are put into both a list for fast iteration and rbtree for fast
- * long name lookup.
- */
-struct dsos {
-	struct list_head head;
-	struct rb_root	 root;	/* rbtree root sorted by long name */
-	struct rw_semaphore lock;
-};
-
 struct auxtrace_cache;
 
 struct dso {
@@ -347,21 +337,8 @@ struct map *dso__new_map(const char *name);
 struct dso *machine__findnew_kernel(struct machine *machine, const char *name,
 				    const char *short_name, int dso_type);
 
-void __dsos__add(struct dsos *dsos, struct dso *dso);
-void dsos__add(struct dsos *dsos, struct dso *dso);
-struct dso *__dsos__addnew(struct dsos *dsos, const char *name);
-struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
-struct dso *dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
-struct dso *__dsos__findnew(struct dsos *dsos, const char *name);
-struct dso *dsos__findnew(struct dsos *dsos, const char *name);
-bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
-
 void dso__reset_find_symbol_cache(struct dso *dso);
 
-size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
-			       bool (skip)(struct dso *dso, int parm), int parm);
-size_t __dsos__fprintf(struct list_head *head, FILE *fp);
-
 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp);
 size_t dso__fprintf_symbols_by_name(struct dso *dso, FILE *fp);
 size_t dso__fprintf(struct dso *dso, FILE *fp);
tools/perf/util/dsos.c new file +232 -0

232 lines not on this page · raw message

tools/perf/util/dsos.h new file +44 -0

44 lines not on this page · raw message

tools/perf/util/event.c +2 -0
index 54169ad335c7..f4afbb858ebb 100644
@@ -11,6 +11,7 @@
 #include <api/fs/fs.h>
 #include <linux/perf_event.h>
 #include <linux/zalloc.h>
+#include "dso.h"
 #include "event.h"
 #include "debug.h"
 #include "hist.h"
@@ -29,6 +30,7 @@
 #include "stat.h"
 #include "session.h"
 #include "bpf-event.h"
+#include "tool.h"
 #include "../perf.h"
 
 #define DEFAULT_PROC_MAP_PARSE_TIMEOUT 500
tools/perf/util/header.c +1 -0
index 20fb06162fd4..b0c34dda30a0 100644
@@ -22,6 +22,7 @@
 #include <bpf/libbpf.h>
 #include <perf/cpumap.h>
 
+#include "dso.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "header.h"
tools/perf/util/hist.c +1 -0
index 02ea2ee62814..b526ef3ede98 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "callchain.h"
 #include "debug.h"
+#include "dso.h"
 #include "build-id.h"
 #include "hist.h"
 #include "map.h"
tools/perf/util/intel-bts.c +1 -0
index 99dddb63dac1..a30427aa1de0 100644
@@ -22,6 +22,7 @@
 #include "map.h"
 #include "symbol.h"
 #include "session.h"
+#include "tool.h"
 #include "thread.h"
 #include "thread-stack.h"
 #include "debug.h"
tools/perf/util/jitdump.c +1 -0
index bbeac4f66402..b80f29bfc7bb 100644
@@ -14,6 +14,7 @@
 #include <sys/mman.h>
 #include <linux/stringify.h>
 
+#include "build-id.h"
 #include "util.h"
 #include "event.h"
 #include "debug.h"
tools/perf/util/machine.c +1 -0
index 6e9afe4e55dd..003025465198 100644
@@ -5,6 +5,7 @@
 #include <regex.h>
 #include "callchain.h"
 #include "debug.h"
+#include "dso.h"
 #include "event.h"
 #include "evsel.h"
 #include "hist.h"
tools/perf/util/machine.h +2 -1
index 7d69119d0b5d..ffd391a925a6 100644
@@ -5,12 +5,13 @@
 #include <sys/types.h>
 #include <linux/rbtree.h>
 #include "map_groups.h"
-#include "dso.h"
+#include "dsos.h"
 #include "event.h"
 #include "rwsem.h"
 
 struct addr_location;
 struct branch_stack;
+struct dso;
 struct evsel;
 struct perf_sample;
 struct symbol;
tools/perf/util/map.c +1 -0
index c75b20b93820..623a63cd1eec 100644
@@ -8,6 +8,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
+#include "dso.h"
 #include "map.h"
 #include "thread.h"
 #include "vdso.h"
tools/perf/util/parse-events.c +1 -0
index 5f1ba6820cdd..523af1bd82e6 100644
@@ -10,6 +10,7 @@
 #include <fcntl.h>
 #include <sys/param.h>
 #include "term.h"
+#include "build-id.h"
 #include "evlist.h"
 #include "evsel.h"
 #include <subcmd/parse-options.h>
tools/perf/util/probe-event.c +2 -0
index 8394d48f8b32..5d12a78c8ac8 100644
@@ -19,11 +19,13 @@
 #include <limits.h>
 #include <elf.h>
 
+#include "build-id.h"
 #include "event.h"
 #include "namespaces.h"
 #include "strlist.h"
 #include "strfilter.h"
 #include "debug.h"
+#include "dso.h"
 #include "cache.h"
 #include "color.h"
 #include "map.h"
tools/perf/util/s390-cpumsf.c +1 -0
index 4f6c1465998f..2ba4baa2c52f 100644
@@ -157,6 +157,7 @@
 #include "evlist.h"
 #include "machine.h"
 #include "session.h"
+#include "tool.h"
 #include "thread.h"
 #include "debug.h"
 #include "auxtrace.h"
tools/perf/util/scripting-engines/trace-event-perl.c +1 -0
index 800e82d35230..15961854ba67 100644
@@ -35,6 +35,7 @@
 #include <perl.h>
 
 #include "../callchain.h"
+#include "../dso.h"
 #include "../machine.h"
 #include "../map.h"
 #include "../symbol.h"
tools/perf/util/scripting-engines/trace-event-python.c +2 -0
index abfde356be18..666a56e88d8e 100644
@@ -31,8 +31,10 @@
 #include <linux/compiler.h>
 #include <linux/time64.h>
 
+#include "../build-id.h"
 #include "../counts.h"
 #include "../debug.h"
+#include "../dso.h"
 #include "../callchain.h"
 #include "../evsel.h"
 #include "../util.h"
tools/perf/util/sort.c +1 -0
index 4650704540c9..32ade5a1b553 100644
@@ -5,6 +5,7 @@
 #include <linux/mman.h>
 #include <linux/time64.h>
 #include "debug.h"
+#include "dso.h"
 #include "sort.h"
 #include "hist.h"
 #include "cacheline.h"
tools/perf/util/thread.c +1 -0
index 5ba1601e8860..b64e9e049636 100644
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
+#include "dso.h"
 #include "session.h"
 #include "thread.h"
 #include "thread-stack.h"
tools/perf/util/unwind-libdw.c +1 -0
index 28f71ca6ce1c..9ece188ae48a 100644
@@ -5,6 +5,7 @@
 #include <inttypes.h>
 #include <errno.h>
 #include "debug.h"
+#include "dso.h"
 #include "unwind.h"
 #include "unwind-libdw.h"
 #include "machine.h"
tools/perf/util/unwind-libunwind.c +1 -0
index 6499b22b158b..a24fb57c9b2c 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "unwind.h"
+#include "dso.h"
 #include "map.h"
 #include "thread.h"
 #include "session.h"
tools/perf/util/vdso.c +1 -0
index 7f427bab6c12..e5e6599603f4 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 
 #include "vdso.h"
+#include "dso.h"
 #include "util.h"
 #include "map.h"
 #include "symbol.h"
Signature · 1 line
2.21.0
author maintainer
#27 lore raw

PATCH 27/47 perf hist: Remove needless ui/progress.h from hist.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

We only need a forward declaration, add it and fixup all the files that need ui_progress definitions but were wrongly getting it from hist.h.

---
 tools/perf/builtin-c2c.c    | 1 +
 tools/perf/builtin-report.c | 1 +
 tools/perf/util/hist.h      | 2 +-
 tools/perf/util/session.c   | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)
tools/perf/builtin-c2c.c +1 -0
index d1ad694c67a2..0d76b2cb8c0a 100644
@@ -37,6 +37,7 @@
 #include "mem2node.h"
 #include "symbol.h"
 #include "ui/ui.h"
+#include "ui/progress.h"
 #include "../perf.h"
 
 struct c2c_hists {
tools/perf/builtin-report.c +1 -0
index ba419ee40283..d7a345667945 100644
@@ -47,6 +47,7 @@
 #include "util/branch.h"
 #include "util/util.h"
 #include "ui/ui.h"
+#include "ui/progress.h"
 
 #include <dlfcn.h>
 #include <errno.h>
tools/perf/util/hist.h +1 -1
index 7b9267ebebeb..1c0a635e5e32 100644
@@ -8,7 +8,6 @@
 #include "evsel.h"
 #include "header.h"
 #include "color.h"
-#include "ui/progress.h"
 
 struct hist_entry;
 struct hist_entry_ops;
@@ -18,6 +17,7 @@ struct mem_info;
 struct branch_info;
 struct block_info;
 struct symbol;
+struct ui_progress;
 
 enum hist_filter {
 	HIST_FILTER__DSO,
tools/perf/util/session.c +1 -0
index a72774e4463f..f166da76acf1 100644
@@ -30,6 +30,7 @@
 #include "sample-raw.h"
 #include "stat.h"
 #include "util.h"
+#include "ui/progress.h"
 #include "../perf.h"
 #include "arch/common.h"
 
Signature · 1 line
2.21.0
author maintainer
#28 lore raw

PATCH 28/47 perf tools: Move 'struct events_stats' and prototypes to separate header

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

This will allow us to untangle the header dependency a bit more, as some places will not need event.h anymore.

---
 tools/perf/util/auxtrace.h     |  5 ++++
 tools/perf/util/event.h        | 42 ----------------------------
 tools/perf/util/events_stats.h | 51 ++++++++++++++++++++++++++++++++++
 tools/perf/util/evlist.h       |  2 +-
 tools/perf/util/hist.h         |  4 +--
 tools/perf/util/sort.h         |  1 -
 6 files changed, 58 insertions(+), 47 deletions(-)
 create mode 100644 tools/perf/util/events_stats.h
tools/perf/util/auxtrace.h +5 -0
index b5ac24c770d4..c539e7b6ed56 100644
@@ -30,6 +30,11 @@ struct record_opts;
 struct perf_record_auxtrace_info;
 struct events_stats;
 
+enum auxtrace_error_type {
+       PERF_AUXTRACE_ERROR_ITRACE  = 1,
+       PERF_AUXTRACE_ERROR_MAX
+};
+
 /* Auxtrace records must have the same alignment as perf event records */
 #define PERF_AUXTRACE_RECORD_ALIGNMENT 8
 
tools/perf/util/event.h +0 -42

54 lines not on this page · raw message

tools/perf/util/events_stats.h new file +51 -0

51 lines not on this page · raw message

tools/perf/util/evlist.h +1 -1
index ee288644e9e4..a55f0f2546e5 100644
@@ -9,7 +9,7 @@
 #include <api/fd/array.h>
 #include <stdio.h>
 #include <internal/evlist.h>
-#include "event.h"
+#include "events_stats.h"
 #include "evsel.h"
 #include "mmap.h"
 #include <signal.h>
tools/perf/util/hist.h +1 -3
index 1c0a635e5e32..34803e33dc80 100644
@@ -6,8 +6,8 @@
 #include <linux/types.h>
 #include <pthread.h>
 #include "evsel.h"
-#include "header.h"
 #include "color.h"
+#include "events_stats.h"
 
 struct hist_entry;
 struct hist_entry_ops;
@@ -190,8 +190,6 @@ void hists__reset_stats(struct hists *hists);
 void hists__inc_stats(struct hists *hists, struct hist_entry *h);
 void hists__inc_nr_events(struct hists *hists, u32 type);
 void hists__inc_nr_samples(struct hists *hists, bool filtered);
-void events_stats__inc(struct events_stats *stats, u32 type);
-size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
 
 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 		      int max_cols, float min_pcnt, FILE *fp,
tools/perf/util/sort.h +0 -1
index 3d7cef73924c..7b93f34ac1f4 100644
@@ -9,7 +9,6 @@
 #include "symbol_conf.h"
 #include "callchain.h"
 #include "values.h"
-
 #include "hist.h"
 
 struct option;
Signature · 1 line
2.21.0
author maintainer
#29 lore raw

PATCH 29/47 perf tools: Remove needless sort.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that sort.h isn't included by any other header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

---
 tools/perf/builtin-top.c         | 1 +
 tools/perf/ui/browsers/scripts.c | 1 -
 tools/perf/util/hist.c           | 1 +
 tools/perf/util/mem-events.c     | 1 -
 tools/perf/util/session.c        | 1 -
 5 files changed, 2 insertions(+), 3 deletions(-)
tools/perf/builtin-top.c +1 -0
index 0b7b12cfdd63..0f0d96262d14 100644
@@ -39,6 +39,7 @@
 #include <linux/rbtree.h>
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
+#include "util/callchain.h"
 #include "util/cpumap.h"
 #include "util/sort.h"
 #include "util/string2.h"
tools/perf/ui/browsers/scripts.c +0 -1
index 77809c0fad02..bf1d9f9ec035 100644
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "../../builtin.h"
 #include "../../perf.h"
-#include "../../util/sort.h"
 #include "../../util/util.h"
 #include "../../util/hist.h"
 #include "../../util/debug.h"
tools/perf/util/hist.c +1 -0
index b526ef3ede98..0978dc4a33db 100644
@@ -20,6 +20,7 @@
 #include <math.h>
 #include <inttypes.h>
 #include <sys/param.h>
+#include <linux/rbtree.h>
 #include <linux/string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
tools/perf/util/mem-events.c +0 -1
index 42c3e5a229d2..3a8d38ce3b54 100644
@@ -11,7 +11,6 @@
 #include "mem-events.h"
 #include "debug.h"
 #include "symbol.h"
-#include "sort.h"
 
 unsigned int perf_mem_events__loads_ldlat = 30;
 
tools/perf/util/session.c +0 -1
index f166da76acf1..e5ac5f3c94d4 100644
@@ -20,7 +20,6 @@
 #include "symbol.h"
 #include "session.h"
 #include "tool.h"
-#include "sort.h"
 #include "cpumap.h"
 #include "perf_regs.h"
 #include "asm/bug.h"
Signature · 1 line
2.21.0
author maintainer
#30 lore raw

PATCH 30/47 perf probe: No need for symbol.h, symbol_conf is enough

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Remove one more unneeded use of symbol.h

---
 tools/perf/builtin-probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-probe.c +1 -1
index 6dce1724a378..26bc5923e6b5 100644
@@ -21,7 +21,7 @@
 #include "util/build-id.h"
 #include "util/strlist.h"
 #include "util/strfilter.h"
-#include "util/symbol.h"
+#include "util/symbol_conf.h"
 #include "util/debug.h"
 #include <subcmd/parse-options.h>
 #include "util/probe-finder.h"
Signature · 1 line
2.21.0
author maintainer
#31 lore raw

PATCH 31/47 perf tools: Remove needless map.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that map.h isn't included by any other header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

---
 tools/perf/arch/arm64/util/sym-handling.c | 8 +++-----
 tools/perf/tests/thread-mg-share.c        | 1 -
 tools/perf/util/intel-bts.c               | 1 -
 3 files changed, 3 insertions(+), 7 deletions(-)
tools/perf/arch/arm64/util/sym-handling.c +3 -5
index 27fcf24d6850..5df788985130 100644
@@ -4,11 +4,9 @@
  * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
  */
 
-#include "debug.h"
-#include "symbol.h"
-#include "map.h"
-#include "probe-event.h"
-#include "probe-file.h"
+#include "symbol.h" // for the elf__needs_adjust_symbols() prototype
+#include <stdbool.h>
+#include <gelf.h>
 
 #ifdef HAVE_LIBELF_SUPPORT
 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
tools/perf/tests/thread-mg-share.c +0 -1
index b1d1bbafe7ae..cbac71716dec 100644
@@ -2,7 +2,6 @@
 #include "tests.h"
 #include "machine.h"
 #include "thread.h"
-#include "map.h"
 #include "debug.h"
 
 int test__thread_mg_share(struct test *test __maybe_unused, int subtest __maybe_unused)
tools/perf/util/intel-bts.c +0 -1
index a30427aa1de0..aacffa2b0362 100644
@@ -19,7 +19,6 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "machine.h"
-#include "map.h"
 #include "symbol.h"
 #include "session.h"
 #include "tool.h"
Signature · 1 line
2.21.0
author maintainer
#32 lore raw

PATCH 32/47 perf tools: Remove needless thread.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that thread.h isn't included by any other header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

---
 tools/perf/builtin-annotate.c   | 1 -
 tools/perf/builtin-stat.c       | 1 -
 tools/perf/builtin-top.c        | 1 -
 tools/perf/tests/hists_filter.c | 1 -
 tools/perf/tests/hists_link.c   | 1 -
 tools/perf/util/arm-spe.c       | 1 -
 tools/perf/util/probe-event.c   | 1 -
 tools/perf/util/probe-file.c    | 1 -
 tools/perf/util/s390-cpumsf.c   | 1 -
 9 files changed, 9 deletions(-)
tools/perf/builtin-annotate.c +0 -1
index 738471a0a549..7135b77a18e7 100644
@@ -24,7 +24,6 @@
 #include "util/event.h"
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
-#include "util/thread.h"
 #include "util/sort.h"
 #include "util/hist.h"
 #include "util/dso.h"
tools/perf/builtin-stat.c +0 -1
index fa4212dac9bb..7e17bf9f700a 100644
@@ -54,7 +54,6 @@
 #include "util/stat.h"
 #include "util/header.h"
 #include "util/cpumap.h"
-#include "util/thread.h"
 #include "util/thread_map.h"
 #include "util/counts.h"
 #include "util/group.h"
tools/perf/builtin-top.c +0 -1
index 0f0d96262d14..eb941213fa0c 100644
@@ -32,7 +32,6 @@
 #include "util/map.h"
 #include "util/session.h"
 #include "util/symbol.h"
-#include "util/thread.h"
 #include "util/thread_map.h"
 #include "util/top.h"
 #include "util/util.h"
tools/perf/tests/hists_filter.c +0 -1
index 41dede2f40d8..618b51ffcc01 100644
@@ -7,7 +7,6 @@
 #include "util/event.h"
 #include "util/evlist.h"
 #include "util/machine.h"
-#include "util/thread.h"
 #include "util/parse-events.h"
 #include "tests/tests.h"
 #include "tests/hists_common.h"
tools/perf/tests/hists_link.c +0 -1
index 012fe8ac0b24..8be4d0b61e3a 100644
@@ -6,7 +6,6 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "machine.h"
-#include "thread.h"
 #include "parse-events.h"
 #include "hists_common.h"
 #include <errno.h>
tools/perf/util/arm-spe.c +0 -1
index d7c3fbb3694f..6bee59946c4f 100644
@@ -20,7 +20,6 @@
 #include "evlist.h"
 #include "machine.h"
 #include "session.h"
-#include "thread.h"
 #include "debug.h"
 #include "auxtrace.h"
 #include "arm-spe.h"
tools/perf/util/probe-event.c +0 -1
index 5d12a78c8ac8..e90faa6bb5aa 100644
@@ -31,7 +31,6 @@
 #include "map.h"
 #include "map_groups.h"
 #include "symbol.h"
-#include "thread.h"
 #include <api/fs/fs.h>
 #include "trace-event.h"	/* For __maybe_unused */
 #include "probe-event.h"
tools/perf/util/probe-file.c +0 -1
index 10d2ab179c71..adc949e8314f 100644
@@ -20,7 +20,6 @@
 #include "cache.h"
 #include "color.h"
 #include "symbol.h"
-#include "thread.h"
 #include <api/fs/tracing_path.h>
 #include "probe-event.h"
 #include "probe-file.h"
tools/perf/util/s390-cpumsf.c +0 -1
index 2ba4baa2c52f..24a99909d8b3 100644
@@ -158,7 +158,6 @@
 #include "machine.h"
 #include "session.h"
 #include "tool.h"
-#include "thread.h"
 #include "debug.h"
 #include "auxtrace.h"
 #include "s390-cpumsf.h"
Signature · 1 line
2.21.0
author maintainer
#33 lore raw

PATCH 33/47 perf tools: Remove needless thread_map.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that thread_map.h isn't included by any other header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

---
 tools/perf/arch/arm/util/cs-etm.c | 1 -
 tools/perf/builtin-top.c          | 1 -
 tools/perf/util/cs-etm.c          | 1 -
 3 files changed, 3 deletions(-)
tools/perf/arch/arm/util/cs-etm.c +0 -1
index 197041fcba25..59e44f90dc46 100644
@@ -24,7 +24,6 @@
 #include "../../util/evlist.h"
 #include "../../util/evsel.h"
 #include "../../util/pmu.h"
-#include "../../util/thread_map.h"
 #include "../../util/cs-etm.h"
 #include "../../util/util.h"
 
tools/perf/builtin-top.c +0 -1
index eb941213fa0c..726e3f2dd8c7 100644
@@ -32,7 +32,6 @@
 #include "util/map.h"
 #include "util/session.h"
 #include "util/symbol.h"
-#include "util/thread_map.h"
 #include "util/top.h"
 #include "util/util.h"
 #include <linux/rbtree.h>
tools/perf/util/cs-etm.c +0 -1
index 3ed1d3bb7089..30c2048ce67d 100644
@@ -30,7 +30,6 @@
 #include "symbol.h"
 #include "tool.h"
 #include "thread.h"
-#include "thread_map.h"
 #include "thread-stack.h"
 #include <tools/libc_compat.h>
 #include "util.h"
Signature · 1 line
2.21.0
author maintainer
#34 lore raw

PATCH 34/47 perf tools: Remove needless evlist.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that evlist.h isn't included by any other header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

---
 tools/perf/builtin-lock.c       | 2 +-
 tools/perf/builtin-timechart.c  | 2 +-
 tools/perf/tests/hists_common.c | 1 -
 tools/perf/tests/sdt.c          | 3 ++-
 tools/perf/ui/gtk/browser.c     | 1 -
 tools/perf/util/arm-spe.c       | 3 ++-
 6 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/builtin-lock.c +1 -1
index 38500bff4423..b0ff952be9db 100644
@@ -4,7 +4,7 @@
 #include "builtin.h"
 #include "perf.h"
 
-#include "util/evlist.h"
+#include "util/evlist.h" // for struct evsel_str_handler
 #include "util/evsel.h"
 #include "util/cache.h"
 #include "util/symbol.h"
tools/perf/builtin-timechart.c +1 -1
index 1a74499f3311..65560a86f643 100644
@@ -15,7 +15,7 @@
 #include "util/color.h"
 #include <linux/list.h>
 #include "util/cache.h"
-#include "util/evlist.h"
+#include "util/evlist.h" // for struct evsel_str_handler
 #include "util/evsel.h"
 #include <linux/kernel.h>
 #include <linux/rbtree.h>
tools/perf/tests/hists_common.c +0 -1
index cdde41c03056..de110d8f169b 100644
@@ -6,7 +6,6 @@
 #include "util/symbol.h"
 #include "util/sort.h"
 #include "util/evsel.h"
-#include "util/evlist.h"
 #include "util/machine.h"
 #include "util/thread.h"
 #include "tests/hists_common.h"
tools/perf/tests/sdt.c +2 -1
index dbc35a8912ed..cf1bd57d3023 100644
@@ -1,8 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/epoll.h>
-#include <util/evlist.h>
 #include <util/symbol.h>
 #include <linux/filter.h>
 #include "tests.h"
tools/perf/ui/gtk/browser.c +0 -1
index 4820e25ac68d..06a6a1ebaef0 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../evlist.h"
 #include "../cache.h"
 #include "../evsel.h"
 #include "../sort.h"
tools/perf/util/arm-spe.c +2 -1
index 6bee59946c4f..8a7340f6a2a2 100644
@@ -8,6 +8,8 @@
 #include <errno.h>
 #include <byteswap.h>
 #include <inttypes.h>
+#include <unistd.h>
+#include <stdlib.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
@@ -17,7 +19,6 @@
 #include "cpumap.h"
 #include "color.h"
 #include "evsel.h"
-#include "evlist.h"
 #include "machine.h"
 #include "session.h"
 #include "debug.h"
Signature · 1 line
2.21.0
author maintainer
#35 lore raw

PATCH 35/47 perf tools: Remove needless evlist.h include directives

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Remove the last unneeded use of cache.h in a header, we can check where it is really needed, i.e. we can remove it and be sure that it isn't being obtained indirectly.

This is an old file, used by now incorrectly in many places, so it was providing includes needed indirectly, fixup this fallout.

---
 tools/perf/builtin-buildid-cache.c                  | 3 ++-
 tools/perf/builtin-buildid-list.c                   | 2 +-
 tools/perf/builtin-kvm.c                            | 4 +++-
 tools/perf/builtin-list.c                           | 2 +-
 tools/perf/builtin-lock.c                           | 2 +-
 tools/perf/builtin-sched.c                          | 2 +-
 tools/perf/builtin-script.c                         | 2 +-
 tools/perf/builtin-timechart.c                      | 2 +-
 tools/perf/perf.c                                   | 2 +-
 tools/perf/tests/llvm.c                             | 2 +-
 tools/perf/ui/browsers/header.c                     | 1 -
 tools/perf/ui/gtk/browser.c                         | 1 -
 tools/perf/ui/gtk/hists.c                           | 1 -
 tools/perf/ui/gtk/setup.c                           | 1 -
 tools/perf/ui/helpline.h                            | 2 --
 tools/perf/ui/progress.c                            | 1 -
 tools/perf/ui/setup.c                               | 3 ++-
 tools/perf/ui/tui/helpline.c                        | 1 +
 tools/perf/ui/tui/progress.c                        | 1 -
 tools/perf/ui/tui/setup.c                           | 2 --
 tools/perf/ui/tui/util.c                            | 1 -
 tools/perf/util/annotate.c                          | 1 -
 tools/perf/util/color.c                             | 3 ++-
 tools/perf/util/color_config.c                      | 3 ++-
 tools/perf/util/debug.c                             | 2 +-
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
 tools/perf/util/parse-events.c                      | 2 +-
 tools/perf/util/path.c                              | 3 ++-
 tools/perf/util/path.h                              | 3 +++
 tools/perf/util/pmu.c                               | 3 ++-
 tools/perf/util/probe-event.c                       | 3 ++-
 tools/perf/util/probe-file.c                        | 2 +-
 32 files changed, 33 insertions(+), 32 deletions(-)
tools/perf/builtin-buildid-cache.c +2 -1
index b035911969b8..1a69eb565dc0 100644
@@ -15,9 +15,9 @@
 #include <unistd.h>
 #include "builtin.h"
 #include "namespaces.h"
-#include "util/cache.h"
 #include "util/debug.h"
 #include "util/header.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/strlist.h"
 #include "util/build-id.h"
@@ -27,6 +27,7 @@
 #include "util/time-utils.h"
 #include "util/util.h"
 #include "util/probe-file.h"
+#include <linux/string.h>
 
 static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
 {
tools/perf/builtin-buildid-list.c +1 -1
index 38b2ec61c021..5a0d8b378cb5 100644
@@ -10,9 +10,9 @@
 #include "builtin.h"
 #include "perf.h"
 #include "util/build-id.h"
-#include "util/cache.h"
 #include "util/debug.h"
 #include "util/dso.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/session.h"
 #include "util/symbol.h"
tools/perf/builtin-kvm.c +3 -1
index 474c4799d29d..0a4fcbe32bf6 100644
@@ -6,12 +6,12 @@
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/term.h"
-#include "util/cache.h"
 #include "util/symbol.h"
 #include "util/thread.h"
 #include "util/header.h"
 #include "util/session.h"
 #include "util/intlist.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
 #include "util/debug.h"
@@ -20,6 +20,7 @@
 #include "util/top.h"
 #include "util/data.h"
 #include "util/ordered-events.h"
+#include "ui/ui.h"
 
 #include <sys/prctl.h>
 #ifdef HAVE_TIMERFD_SUPPORT
@@ -31,6 +32,7 @@
 #include <fcntl.h>
 
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 #include <errno.h>
tools/perf/builtin-list.c +1 -1
index 11afb760616b..e290f6b348d8 100644
@@ -11,10 +11,10 @@
 #include "builtin.h"
 
 #include "util/parse-events.h"
-#include "util/cache.h"
 #include "util/pmu.h"
 #include "util/debug.h"
 #include "util/metricgroup.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include <stdio.h>
 
tools/perf/builtin-lock.c +1 -1
index b0ff952be9db..4c2b7f437cdf 100644
@@ -6,11 +6,11 @@
 
 #include "util/evlist.h" // for struct evsel_str_handler
 #include "util/evsel.h"
-#include "util/cache.h"
 #include "util/symbol.h"
 #include "util/thread.h"
 #include "util/header.h"
 
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
 
tools/perf/builtin-sched.c +1 -1
index 91d0a9b10581..ec96d64aec69 100644
@@ -4,7 +4,6 @@
 #include "perf-sys.h"
 
 #include "util/evlist.h"
-#include "util/cache.h"
 #include "util/evsel.h"
 #include "util/symbol.h"
 #include "util/thread.h"
@@ -19,6 +18,7 @@
 #include "util/callchain.h"
 #include "util/time-utils.h"
 
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
 
tools/perf/builtin-script.c +1 -1
index 1ff04b00a561..e079b34201f2 100644
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "builtin.h"
 
-#include "util/cache.h"
 #include "util/counts.h"
 #include "util/debug.h"
 #include "util/dso.h"
@@ -30,6 +29,7 @@
 #include "util/thread-stack.h"
 #include "util/time-utils.h"
 #include "util/path.h"
+#include "ui/ui.h"
 #include "print_binary.h"
 #include "archinsn.h"
 #include <linux/bitmap.h>
tools/perf/builtin-timechart.c +1 -1
index 65560a86f643..e0e822695a29 100644
@@ -14,7 +14,6 @@
 #include "builtin.h"
 #include "util/color.h"
 #include <linux/list.h>
-#include "util/cache.h"
 #include "util/evlist.h" // for struct evsel_str_handler
 #include "util/evsel.h"
 #include <linux/kernel.h>
@@ -27,6 +26,7 @@
 
 #include "perf.h"
 #include "util/header.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
 #include "util/event.h"
tools/perf/perf.c +1 -1
index 8763b2c0fbfd..1193b923e801 100644
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0
 /*
  * perf.c
  *
@@ -22,6 +21,7 @@
 #include "util/debug.h"
 #include "util/event.h"
 #include "util/util.h"
+#include "ui/ui.h"
 #include "perf-sys.h"
 #include <api/fs/fs.h>
 #include <api/fs/tracing_path.h>
tools/perf/tests/llvm.c +1 -1
index ca5a5f94ce79..022e4c9cf092 100644
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <bpf/libbpf.h>
 #include <util/llvm-utils.h>
-#include <util/cache.h>
 #include "llvm.h"
 #include "tests.h"
 #include "debug.h"
tools/perf/ui/browsers/header.c +0 -1
index 5aeb663dd184..0f59a7001479 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "util/cache.h"
 #include "util/debug.h"
 #include "ui/browser.h"
 #include "ui/keysyms.h"
tools/perf/ui/gtk/browser.c +0 -1
index 06a6a1ebaef0..8f3e43d148a8 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../cache.h"
 #include "../evsel.h"
 #include "../sort.h"
 #include "../hist.h"
tools/perf/ui/gtk/hists.c +0 -1
index 0efdb226d1a7..6c2efc10bf5c 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "../evlist.h"
-#include "../cache.h"
 #include "../callchain.h"
 #include "../evsel.h"
 #include "../sort.h"
tools/perf/ui/gtk/setup.c +0 -1
index 506e73b3834c..1a2616b97b5c 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "gtk.h"
-#include "../../util/cache.h"
 #include "../../util/debug.h"
 
 extern struct perf_error_ops perf_gtk_eops;
tools/perf/ui/helpline.h +0 -2
index 8f775a053ca3..2165a098dee8 100644
@@ -5,8 +5,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#include "../util/cache.h"
-
 struct ui_helpline {
 	void (*pop)(void);
 	void (*push)(const char *msg);
tools/perf/ui/progress.c +0 -1
index 8cd3b64c6893..99d60223c74b 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
-#include "../util/cache.h"
 #include "progress.h"
 
 static void null_progress__update(struct ui_progress *p __maybe_unused)
tools/perf/ui/setup.c +2 -1
index 3bc7c9a6fae9..c7a86b4be9f5 100644
@@ -2,10 +2,11 @@
 #include <pthread.h>
 #include <dlfcn.h>
 
-#include "../util/cache.h"
+#include <subcmd/pager.h>
 #include "../util/debug.h"
 #include "../util/hist.h"
 #include "../util/util.h"
+#include "ui.h"
 
 pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
 void *perf_gtk_handle;
tools/perf/ui/tui/helpline.c +1 -0
index 1793c98653a5..5f188f678c55 100644
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <pthread.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 
 #include "../../util/debug.h"
 #include "../helpline.h"
tools/perf/ui/tui/progress.c +0 -1
index 5a24dd3ce4db..3d74af5a7ece 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
-#include "../../util/cache.h"
 #include "../progress.h"
 #include "../libslang.h"
 #include "../ui.h"
tools/perf/ui/tui/setup.c +0 -2
index 2881982b483c..56651a4f5aa0 100644
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
 #include <signal.h>
 #include <stdbool.h>
@@ -8,7 +7,6 @@
 #include <execinfo.h>
 #endif
 
-#include "../../util/cache.h"
 #include "../../util/debug.h"
 #include "../../util/util.h"
 #include "../../perf.h"
tools/perf/ui/tui/util.c +0 -1
index 1163df8b6f06..087d9ab054c8 100644
@@ -5,7 +5,6 @@
 #include <stdlib.h>
 #include <sys/ttydefaults.h>
 
-#include "../../util/cache.h"
 #include "../../util/debug.h"
 #include "../browser.h"
 #include "../keysyms.h"
tools/perf/util/annotate.c +0 -1
index 67a7513077d0..eb3c50de831d 100644
@@ -19,7 +19,6 @@
 #include "build-id.h"
 #include "color.h"
 #include "config.h"
-#include "cache.h"
 #include "dso.h"
 #include "map.h"
 #include "symbol.h"
tools/perf/util/color.c +2 -1
index 39b8c4ec4e2e..bffbdd216a6a 100644
@@ -1,8 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
-#include "cache.h"
+#include <subcmd/pager.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include "color.h"
 #include <math.h>
 #include <unistd.h>
tools/perf/util/color_config.c +2 -1
index 817dc56e7e95..dc09ba7cb31e 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/kernel.h>
-#include "cache.h"
+#include <subcmd/pager.h>
+#include <string.h>
 #include "config.h"
 #include <stdlib.h>
 #include <stdio.h>
tools/perf/util/debug.c +1 -1
index 143d379d4608..a1b59bd35519 100644
@@ -13,7 +13,6 @@
 #ifdef HAVE_BACKTRACE_SUPPORT
 #include <execinfo.h>
 #endif
-#include "cache.h"
 #include "color.h"
 #include "event.h"
 #include "debug.h"
@@ -21,6 +20,7 @@
 #include "util.h"
 #include "target.h"
 #include "ui/helpline.h"
+#include "ui/ui.h"
 
 #include <linux/ctype.h>
 
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +1 -1
index 3bfdf2b7a96a..f8ccfd6be0ee 100644
@@ -14,9 +14,9 @@
 #include <stdint.h>
 #include <inttypes.h>
 #include <linux/compiler.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
-#include "../cache.h"
 #include "../auxtrace.h"
 
 #include "intel-pt-insn-decoder.h"
tools/perf/util/parse-events.c +1 -1
index 523af1bd82e6..5ec21d21113c 100644
@@ -13,13 +13,13 @@
 #include "build-id.h"
 #include "evlist.h"
 #include "evsel.h"
+#include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
 #include "parse-events.h"
 #include <subcmd/exec-cmd.h>
 #include "string2.h"
 #include "strlist.h"
 #include "symbol.h"
-#include "cache.h"
 #include "header.h"
 #include "bpf-loader.h"
 #include "debug.h"
tools/perf/util/path.c +2 -1
index ca56ba2dd3da..caed0336429f 100644
@@ -11,11 +11,12 @@
  *
  * which is what it's designed for.
  */
-#include "cache.h"
 #include "path.h"
+#include "cache.h"
 #include <linux/kernel.h>
 #include <limits.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
tools/perf/util/path.h +3 -0
index f014f905df50..083429b7efa3 100644
@@ -2,6 +2,9 @@
 #ifndef _PERF_PATH_H
 #define _PERF_PATH_H
 
+#include <stddef.h>
+#include <stdbool.h>
+
 struct dirent;
 
 int path__join(char *bf, size_t size, const char *path1, const char *path2);
tools/perf/util/pmu.c +2 -1
index 9807be6f09bb..6b3448f6eb94 100644
@@ -3,6 +3,7 @@
 #include <linux/compiler.h>
 #include <linux/string.h>
 #include <linux/zalloc.h>
+#include <subcmd/pager.h>
 #include <sys/types.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -22,8 +23,8 @@
 #include "cpumap.h"
 #include "header.h"
 #include "pmu-events/pmu-events.h"
-#include "cache.h"
 #include "string2.h"
+#include "strbuf.h"
 
 struct perf_pmu_format {
 	char *name;
tools/perf/util/probe-event.c +2 -1
index e90faa6bb5aa..b8e0967c5c21 100644
@@ -26,7 +26,6 @@
 #include "strfilter.h"
 #include "debug.h"
 #include "dso.h"
-#include "cache.h"
 #include "color.h"
 #include "map.h"
 #include "map_groups.h"
@@ -38,7 +37,9 @@
 #include "probe-file.h"
 #include "session.h"
 #include "string2.h"
+#include "strbuf.h"
 
+#include <subcmd/pager.h>
 #include <linux/ctype.h>
 #include <linux/zalloc.h>
 
tools/perf/util/probe-file.c +1 -1
index adc949e8314f..d13db55a2feb 100644
@@ -17,9 +17,9 @@
 #include "strfilter.h"
 #include "debug.h"
 #include "dso.h"
-#include "cache.h"
 #include "color.h"
 #include "symbol.h"
+#include "strbuf.h"
 #include <api/fs/tracing_path.h>
 #include "probe-event.h"
 #include "probe-file.h"
Signature · 1 line
2.21.0
author maintainer
#36 lore raw

PATCH 36/47 perf auxtrace: Uninline functions that touch perf_session

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

So that we don't carry the session.h include directive in auxtrace.h, which in turn opens a can of worms of files that were getting all sorts of things via that include, fix them all.

---
 tools/perf/arch/arm/annotate/instructions.c   |  1 +
 tools/perf/arch/arm/util/cs-etm.c             |  1 +
 tools/perf/arch/arm64/annotate/instructions.c |  1 +
 tools/perf/arch/x86/tests/perf-time-to-tsc.c  |  1 +
 tools/perf/builtin-ftrace.c                   |  1 +
 tools/perf/tests/backward-ring-buffer.c       |  1 +
 tools/perf/tests/bpf.c                        |  1 +
 tools/perf/tests/builtin-test.c               |  1 +
 tools/perf/tests/code-reading.c               |  6 +++
 tools/perf/tests/event-times.c                |  1 +
 tools/perf/tests/event_update.c               |  2 +
 tools/perf/tests/keep-tracking.c              |  1 +
 tools/perf/tests/mmap-basic.c                 |  1 +
 tools/perf/tests/parse-events.c               |  1 +
 tools/perf/tests/switch-tracking.c            |  1 +
 tools/perf/ui/browsers/hists.c                |  1 +
 tools/perf/ui/browsers/res_sample.c           |  2 +
 tools/perf/ui/browsers/scripts.c              |  1 +
 tools/perf/ui/hist.c                          |  2 +
 tools/perf/ui/stdio/hist.c                    |  1 +
 tools/perf/util/annotate.c                    |  3 ++
 tools/perf/util/auxtrace.c                    | 33 ++++++++++++++
 tools/perf/util/auxtrace.h                    | 43 +++----------------
 tools/perf/util/bpf-loader.c                  |  1 +
 tools/perf/util/cgroup.c                      |  2 +
 tools/perf/util/config.c                      |  1 +
 tools/perf/util/cs-etm.c                      |  1 +
 tools/perf/util/cs-etm.h                      |  3 +-
 tools/perf/util/dso.c                         |  2 +
 tools/perf/util/evlist.c                      |  1 +
 tools/perf/util/evsel.c                       |  1 +
 tools/perf/util/machine.c                     |  2 +
 tools/perf/util/mmap.c                        |  3 ++
 tools/perf/util/mmap.h                        |  1 +
 tools/perf/util/python.c                      |  2 +
 tools/perf/util/record.c                      |  2 +
 tools/perf/util/s390-sample-raw.c             |  1 -
 tools/perf/util/sort.c                        |  1 +
 tools/perf/util/stat-display.c                |  1 +
 tools/perf/util/stat.c                        |  3 ++
 tools/perf/util/top.h                         |  1 +
 41 files changed, 98 insertions(+), 38 deletions(-)
tools/perf/arch/arm/annotate/instructions.c +1 -0
index c7d1a69b894f..e1d4b484cc4b 100644
@@ -3,6 +3,7 @@
 #include <linux/zalloc.h>
 #include <sys/types.h>
 #include <regex.h>
+#include <stdlib.h>
 
 struct arm_annotate {
 	regex_t call_insn,
tools/perf/arch/arm/util/cs-etm.c +1 -0
index 59e44f90dc46..c32db09baf0d 100644
@@ -26,6 +26,7 @@
 #include "../../util/pmu.h"
 #include "../../util/cs-etm.h"
 #include "../../util/util.h"
+#include "../../util/session.h"
 
 #include <errno.h>
 #include <stdlib.h>
tools/perf/arch/arm64/annotate/instructions.c +1 -0
index 8f70a1b282df..43aa93ed8414 100644
@@ -2,6 +2,7 @@
 #include <linux/compiler.h>
 #include <sys/types.h>
 #include <regex.h>
+#include <stdlib.h>
 
 struct arm64_annotate {
 	regex_t call_insn,
tools/perf/arch/x86/tests/perf-time-to-tsc.c +1 -0
index 2d1f4713b728..eb3635941c2b 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
 #include <inttypes.h>
+#include <limits.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <unistd.h>
tools/perf/builtin-ftrace.c +1 -0
index 2f8ea44c00c4..d5adc417a4ca 100644
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <poll.h>
 #include <linux/capability.h>
tools/perf/tests/backward-ring-buffer.c +1 -0
index 512288e9f547..a637a4a90760 100644
@@ -9,6 +9,7 @@
 #include "record.h"
 #include "tests.h"
 #include "debug.h"
+#include "parse-events.h"
 #include <errno.h>
 #include <linux/string.h>
 
tools/perf/tests/bpf.c +1 -0
index 9fc163b2acbb..fc102e4f403e 100644
@@ -18,6 +18,7 @@
 #include "tests.h"
 #include "llvm.h"
 #include "debug.h"
+#include "parse-events.h"
 #define NR_ITERS       111
 #define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
 
tools/perf/tests/builtin-test.c +1 -0
index c3bec9d2c201..55774baffc2a 100644
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/wait.h>
tools/perf/tests/code-reading.c +6 -0
index 7b2b89f4b716..c1c29e08e7fb 100644
@@ -13,7 +13,9 @@
 
 #include "debug.h"
 #include "dso.h"
+#include "env.h"
 #include "parse-events.h"
+#include "trace-event.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
@@ -496,6 +498,10 @@ static void fs_something(void)
 	}
 }
 
+#ifdef __s390x__
+#include "header.h" // for get_cpuid()
+#endif
+
 static const char *do_determine_event(bool excl_kernel)
 {
 	const char *event = excl_kernel ? "cycles:u" : "cycles";
tools/perf/tests/event-times.c +1 -0
index 228d1618cf7d..d824a726906c 100644
@@ -11,6 +11,7 @@
 #include "evsel.h"
 #include "util.h"
 #include "debug.h"
+#include "parse-events.h"
 #include "thread_map.h"
 #include "target.h"
 
tools/perf/tests/event_update.c +2 -0
index 4b68ec3a13fc..cac4290e233a 100644
@@ -1,8 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/compiler.h>
 #include <perf/cpumap.h>
+#include <string.h>
 #include "evlist.h"
 #include "evsel.h"
+#include "header.h"
 #include "machine.h"
 #include "tool.h"
 #include "tests.h"
tools/perf/tests/keep-tracking.c +1 -0
index c758798d3774..9f0762d987fa 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
+#include <limits.h>
 #include <unistd.h>
 #include <sys/prctl.h>
 #include <perf/cpumap.h>
tools/perf/tests/mmap-basic.c +1 -0
index bdf77bfe1b80..85e1d7337dc0 100644
@@ -3,6 +3,7 @@
 #include <inttypes.h>
 /* For the CLR_() macros */
 #include <pthread.h>
+#include <stdlib.h>
 #include <perf/cpumap.h>
 
 #include "debug.h"
tools/perf/tests/parse-events.c +1 -0
index 49f52e4de41b..02ba696fb87f 100644
@@ -5,6 +5,7 @@
 #include <api/fs/fs.h>
 #include "tests.h"
 #include "debug.h"
+#include "pmu.h"
 #include "util.h"
 #include <dirent.h>
 #include <errno.h>
tools/perf/tests/switch-tracking.c +1 -0
index 4bed15aee1a8..1a60fa1219f5 100644
@@ -2,6 +2,7 @@
 #include <sys/time.h>
 #include <sys/prctl.h>
 #include <errno.h>
+#include <limits.h>
 #include <time.h>
 #include <stdlib.h>
 #include <linux/zalloc.h>
tools/perf/ui/browsers/hists.c +1 -0
index cf8857456056..f7e54c16e594 100644
@@ -16,6 +16,7 @@
 #include "../../util/callchain.h"
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
+#include "../../util/header.h"
 #include "../../util/hist.h"
 #include "../../util/map.h"
 #include "../../util/symbol.h"
tools/perf/ui/browsers/res_sample.c +2 -0
index db3954fea74c..f16a38fea45e 100644
@@ -9,6 +9,8 @@
 #include "../util.h"
 #include "../../util/util.h"
 #include "../../perf.h"
+#include <stdlib.h>
+#include <string.h>
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
tools/perf/ui/browsers/scripts.c +1 -0
index bf1d9f9ec035..586a21acc13d 100644
@@ -10,6 +10,7 @@
 #include "config.h"
 #include <linux/string.h>
 #include <linux/zalloc.h>
+#include <stdlib.h>
 
 #define SCRIPT_NAMELEN	128
 #define SCRIPT_MAX_NO	64
tools/perf/ui/hist.c +2 -0
index bf90ce5b2cdf..3e533de7d852 100644
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <inttypes.h>
 #include <math.h>
+#include <stdlib.h>
+#include <string.h>
 #include <linux/compiler.h>
 
 #include "../util/callchain.h"
tools/perf/ui/stdio/hist.c +1 -0
index 51ed67548b83..832ca6cfbe30 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
+#include <stdlib.h>
 #include <linux/string.h>
 
 #include "../../util/callchain.h"
tools/perf/util/annotate.c +3 -0
index eb3c50de831d..1748f528b6e9 100644
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <libgen.h>
+#include <stdlib.h>
 #include <bpf/bpf.h>
 #include <bpf/btf.h>
 #include <bpf/libbpf.h>
@@ -20,7 +21,9 @@
 #include "color.h"
 #include "config.h"
 #include "dso.h"
+#include "env.h"
 #include "map.h"
+#include "map_groups.h"
 #include "symbol.h"
 #include "srcline.h"
 #include "units.h"
tools/perf/util/auxtrace.c +33 -0
index 10c707724035..6f25224a3def 100644
@@ -2196,3 +2196,36 @@ int auxtrace_parse_filters(struct evlist *evlist)
 
 	return 0;
 }
+
+int auxtrace__process_event(struct perf_session *session, union perf_event *event,
+			    struct perf_sample *sample, struct perf_tool *tool)
+{
+	if (!session->auxtrace)
+		return 0;
+
+	return session->auxtrace->process_event(session, event, sample, tool);
+}
+
+int auxtrace__flush_events(struct perf_session *session, struct perf_tool *tool)
+{
+	if (!session->auxtrace)
+		return 0;
+
+	return session->auxtrace->flush_events(session, tool);
+}
+
+void auxtrace__free_events(struct perf_session *session)
+{
+	if (!session->auxtrace)
+		return;
+
+	return session->auxtrace->free_events(session);
+}
+
+void auxtrace__free(struct perf_session *session)
+{
+	if (!session->auxtrace)
+		return;
+
+	return session->auxtrace->free(session);
+}
tools/perf/util/auxtrace.h +7 -36

61 lines not on this page · raw message

tools/perf/util/bpf-loader.c +1 -0
index c1a57323e25d..37283e865352 100644
@@ -14,6 +14,7 @@
 #include <linux/string.h>
 #include <linux/zalloc.h>
 #include <errno.h>
+#include <stdlib.h>
 #include "debug.h"
 #include "evlist.h"
 #include "bpf-loader.h"
tools/perf/util/cgroup.c +2 -0
index 96a931c6f728..4881d4af3381 100644
@@ -8,6 +8,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
 
 int nr_cgroups;
 
tools/perf/util/config.c +1 -0
index 7ebf9e31ae22..0bc9c4d7fdc5 100644
@@ -23,6 +23,7 @@
 #include "debug.h"
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <linux/string.h>
 #include <linux/zalloc.h>
tools/perf/util/cs-etm.c +1 -0
index 30c2048ce67d..0174ecf757d7 100644
@@ -27,6 +27,7 @@
 #include "machine.h"
 #include "map.h"
 #include "perf.h"
+#include "session.h"
 #include "symbol.h"
 #include "tool.h"
 #include "thread.h"
tools/perf/util/cs-etm.h +2 -1
index bc848fd095f4..650ecc2a6349 100644
@@ -8,9 +8,10 @@
 #define INCLUDE__UTIL_PERF_CS_ETM_H__
 
 #include "util/event.h"
-#include "util/session.h"
 #include <linux/bits.h>
 
+struct perf_session;
+
 /* Versionning header in case things need tro change in the future.  That way
  * decoding of old snapshot is still possible.
  */
tools/perf/util/dso.c +2 -0
index ece97209792d..e11ddf86f2b3 100644
@@ -10,9 +10,11 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <bpf/libbpf.h>
 #include "bpf-event.h"
 #include "compress.h"
+#include "env.h"
 #include "namespaces.h"
 #include "path.h"
 #include "map.h"
tools/perf/util/evlist.c +1 -0
index b5d6d6ec9a9b..095924aa186b 100644
@@ -23,6 +23,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <sched.h>
+#include <stdlib.h>
 
 #include "parse-events.h"
 #include <subcmd/parse-options.h>
tools/perf/util/evsel.c +1 -0
index b6b406a1678f..85825384f9e8 100644
@@ -22,6 +22,7 @@
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <stdlib.h>
 #include <perf/evsel.h>
 #include "asm/bug.h"
 #include "callchain.h"
tools/perf/util/machine.c +2 -0
index 003025465198..6a77aefbe319 100644
@@ -3,9 +3,11 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <regex.h>
+#include <stdlib.h>
 #include "callchain.h"
 #include "debug.h"
 #include "dso.h"
+#include "env.h"
 #include "event.h"
 #include "evsel.h"
 #include "hist.h"
tools/perf/util/mmap.c +3 -0
index 28477ff5114e..33c5b5495482 100644
@@ -10,9 +10,12 @@
 #include <inttypes.h>
 #include <asm/bug.h>
 #include <linux/zalloc.h>
+#include <stdlib.h>
+#include <string.h>
 #ifdef HAVE_LIBNUMA_SUPPORT
 #include <numaif.h>
 #endif
+#include "cpumap.h"
 #include "debug.h"
 #include "event.h"
 #include "mmap.h"
tools/perf/util/mmap.h +1 -0
index 274ce389cd84..3857a49e8f96 100644
@@ -6,6 +6,7 @@
 #include <linux/types.h>
 #include <linux/ring_buffer.h>
 #include <stdbool.h>
+#include <pthread.h> // for cpu_set_t
 #ifdef HAVE_AIO_SUPPORT
 #include <aio.h>
 #endif
tools/perf/util/python.c +2 -0
index 9b350482c403..07ca4535e6f7 100644
@@ -5,6 +5,7 @@
 #include <poll.h>
 #include <linux/err.h>
 #include <perf/cpumap.h>
+#include <traceevent/event-parse.h>
 #include "debug.h"
 #include "evlist.h"
 #include "callchain.h"
@@ -13,6 +14,7 @@
 #include "cpumap.h"
 #include "print_binary.h"
 #include "thread_map.h"
+#include "trace-event.h"
 #include "mmap.h"
 #include "util.h"
 #include "../perf-sys.h"
tools/perf/util/record.c +2 -0
index ccad796bce5f..286fe816c0f3 100644
@@ -5,6 +5,8 @@
 #include "cpumap.h"
 #include "parse-events.h"
 #include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
 #include <api/fs/fs.h>
 #include <subcmd/parse-options.h>
 #include <perf/cpumap.h>
tools/perf/util/s390-sample-raw.c +0 -1
index d311c81464e5..0ddfa7b3e4f2 100644
@@ -23,7 +23,6 @@
 
 #include "debug.h"
 #include "util.h"
-#include "auxtrace.h"
 #include "session.h"
 #include "evlist.h"
 #include "config.h"
tools/perf/util/sort.c +1 -0
index 32ade5a1b553..b974a2c3a3c5 100644
@@ -2,6 +2,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <regex.h>
+#include <stdlib.h>
 #include <linux/mman.h>
 #include <linux/time64.h>
 #include "debug.h"
tools/perf/util/stat-display.c +1 -0
index 1461dac2322d..ed3b0ac2f785 100644
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
 #include <linux/string.h>
tools/perf/util/stat.c +3 -0
index f4a1edcec7b2..8f1ea27f976f 100644
@@ -2,9 +2,12 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <math.h>
+#include <string.h>
 #include "counts.h"
 #include "debug.h"
+#include "header.h"
 #include "stat.h"
+#include "session.h"
 #include "target.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/util/top.h +1 -0
index 7367433e767a..f117d4f4821e 100644
@@ -5,6 +5,7 @@
 #include "tool.h"
 #include "evswitch.h"
 #include "annotate.h"
+#include "ordered-events.h"
 #include "record.h"
 #include <linux/types.h>
 #include <stddef.h>
Signature · 1 line
2.21.0
author maintainer
#37 lore raw

PATCH 37/47 perf symbols: Move mem_info and branch_info out of symbol.h

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

The mem_info struct goes to mem-events.h and branch_info goes to branch.h, where they belong, this way we can remove several headers from symbols.h and trim the include dependency tree more.

---
 tools/perf/arch/powerpc/util/mem-events.c |  1 +
 tools/perf/builtin-annotate.c             |  2 ++
 tools/perf/builtin-c2c.c                  |  1 +
 tools/perf/builtin-mem.c                  |  1 +
 tools/perf/builtin-report.c               |  3 +++
 tools/perf/builtin-version.c              |  2 +-
 tools/perf/tests/mem.c                    |  1 +
 tools/perf/tests/sample-parsing.c         |  1 +
 tools/perf/ui/browsers/hists.c            |  2 ++
 tools/perf/util/branch.c                  |  1 +
 tools/perf/util/branch.h                  |  8 ++++++++
 tools/perf/util/cs-etm.c                  |  2 ++
 tools/perf/util/hist.c                    |  3 +++
 tools/perf/util/machine.c                 |  3 +++
 tools/perf/util/map.c                     |  1 +
 tools/perf/util/mem-events.c              |  1 +
 tools/perf/util/mem-events.h              |  9 +++++++++
 tools/perf/util/s390-sample-raw.c         |  1 -
 tools/perf/util/session.c                 |  2 ++
 tools/perf/util/sort.c                    |  2 ++
 tools/perf/util/symbol.c                  |  2 ++
 tools/perf/util/symbol.h                  | 17 -----------------
 22 files changed, 47 insertions(+), 19 deletions(-)
tools/perf/arch/powerpc/util/mem-events.c +1 -0
index d08311f04e95..07fb5e049488 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "map_symbol.h"
 #include "mem-events.h"
 
 /* PowerPC does not support 'ldlat' parameter. */
tools/perf/builtin-annotate.c +2 -0
index 7135b77a18e7..4e4d2e76232e 100644
@@ -33,6 +33,8 @@
 #include "util/data.h"
 #include "arch/common.h"
 #include "util/block-range.h"
+#include "util/map_symbol.h"
+#include "util/branch.h"
 
 #include <dlfcn.h>
 #include <errno.h>
tools/perf/builtin-c2c.c +1 -0
index 0d76b2cb8c0a..b09b12e0976b 100644
@@ -22,6 +22,7 @@
 #include "builtin.h"
 #include <subcmd/pager.h>
 #include <subcmd/parse-options.h>
+#include "map_symbol.h"
 #include "mem-events.h"
 #include "session.h"
 #include "hist.h"
tools/perf/builtin-mem.c +1 -0
index c5f3b9e9509d..27d2bde943a8 100644
@@ -11,6 +11,7 @@
 #include "util/tool.h"
 #include "util/session.h"
 #include "util/data.h"
+#include "util/map_symbol.h"
 #include "util/mem-events.h"
 #include "util/debug.h"
 #include "util/dso.h"
tools/perf/builtin-report.c +3 -0
index d7a345667945..b18fab94d38d 100644
@@ -19,6 +19,9 @@
 #include <linux/zalloc.h>
 #include "util/map.h"
 #include "util/symbol.h"
+#include "util/map_symbol.h"
+#include "util/mem-events.h"
+#include "util/branch.h"
 #include "util/callchain.h"
 #include "util/values.h"
 
tools/perf/builtin-version.c +1 -1
index bf114ca9ca87..05cf2af9e2c2 100644
@@ -2,8 +2,8 @@
 #include "builtin.h"
 #include "perf.h"
 #include "color.h"
-#include <linux/compiler.h>
 #include <tools/config.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <subcmd/parse-options.h>
tools/perf/tests/mem.c +1 -0
index efe3397824d2..673a11a6cd1b 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "util/map_symbol.h"
 #include "util/mem-events.h"
 #include "util/symbol.h"
 #include "linux/perf_event.h"
tools/perf/tests/sample-parsing.c +1 -0
index 0c09dc15a059..5fcc06817076 100644
@@ -7,6 +7,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 
+#include "map_symbol.h"
 #include "branch.h"
 #include "util.h"
 #include "event.h"
tools/perf/ui/browsers/hists.c +2 -0
index f7e54c16e594..589168ca9f62 100644
@@ -20,6 +20,8 @@
 #include "../../util/hist.h"
 #include "../../util/map.h"
 #include "../../util/symbol.h"
+#include "../../util/map_symbol.h"
+#include "../../util/branch.h"
 #include "../../util/pstack.h"
 #include "../../util/sort.h"
 #include "../../util/top.h"
tools/perf/util/branch.c +1 -0
index 30642e1f2b1b..9d1e090084a2 100644
@@ -1,5 +1,6 @@
 #include "util/util.h"
 #include "util/debug.h"
+#include "util/map_symbol.h"
 #include "util/branch.h"
 #include <linux/kernel.h>
 
tools/perf/util/branch.h +8 -0
index 64f96b79f1d7..06f66dad0b79 100644
@@ -16,6 +16,14 @@ struct branch_flags {
 	u64 reserved:40;
 };
 
+struct branch_info {
+	struct addr_map_symbol from;
+	struct addr_map_symbol to;
+	struct branch_flags    flags;
+	char		       *srcline_from;
+	char		       *srcline_to;
+};
+
 struct branch_entry {
 	u64			from;
 	u64			to;
tools/perf/util/cs-etm.c +2 -0
index 0174ecf757d7..707afdbd9529 100644
@@ -28,6 +28,8 @@
 #include "map.h"
 #include "perf.h"
 #include "session.h"
+#include "map_symbol.h"
+#include "branch.h"
 #include "symbol.h"
 #include "tool.h"
 #include "thread.h"
tools/perf/util/hist.c +3 -0
index 0978dc4a33db..679a1d75090c 100644
@@ -5,6 +5,9 @@
 #include "build-id.h"
 #include "hist.h"
 #include "map.h"
+#include "map_symbol.h"
+#include "branch.h"
+#include "mem-events.h"
 #include "session.h"
 #include "namespaces.h"
 #include "sort.h"
tools/perf/util/machine.c +3 -0
index 6a77aefbe319..b4749d3eed08 100644
@@ -13,6 +13,9 @@
 #include "hist.h"
 #include "machine.h"
 #include "map.h"
+#include "map_symbol.h"
+#include "branch.h"
+#include "mem-events.h"
 #include "srcline.h"
 #include "symbol.h"
 #include "sort.h"
tools/perf/util/map.c +1 -0
index 623a63cd1eec..5b83ed1ebbd6 100644
@@ -10,6 +10,7 @@
 #include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
 #include "dso.h"
 #include "map.h"
+#include "map_symbol.h"
 #include "thread.h"
 #include "vdso.h"
 #include "build-id.h"
tools/perf/util/mem-events.c +1 -0
index 3a8d38ce3b54..3d391583f2ae 100644
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include <api/fs/fs.h>
 #include <linux/kernel.h>
+#include "map_symbol.h"
 #include "mem-events.h"
 #include "debug.h"
 #include "symbol.h"
tools/perf/util/mem-events.h +9 -0
index a889ec2fa9f5..f1389bdae7bf 100644
@@ -6,6 +6,8 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <linux/types.h>
+#include <linux/refcount.h>
+#include <linux/perf_event.h>
 #include "stat.h"
 
 struct perf_mem_event {
@@ -16,6 +18,13 @@ struct perf_mem_event {
 	const char	*sysfs_name;
 };
 
+struct mem_info {
+	struct addr_map_symbol	iaddr;
+	struct addr_map_symbol	daddr;
+	union perf_mem_data_src	data_src;
+	refcount_t		refcnt;
+};
+
 enum {
 	PERF_MEM_EVENTS__LOAD,
 	PERF_MEM_EVENTS__STORE,
tools/perf/util/s390-sample-raw.c +0 -1
index 0ddfa7b3e4f2..4d9593e331ea 100644
@@ -25,7 +25,6 @@
 #include "util.h"
 #include "session.h"
 #include "evlist.h"
-#include "config.h"
 #include "color.h"
 #include "sample-raw.h"
 #include "s390-cpumcf-kernel.h"
tools/perf/util/session.c +2 -0
index e5ac5f3c94d4..e9e4a04f15db 100644
@@ -12,6 +12,8 @@
 #include <sys/mman.h>
 #include <perf/cpumap.h>
 
+#include "map_symbol.h"
+#include "branch.h"
 #include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
tools/perf/util/sort.c +2 -0
index b974a2c3a3c5..a2308eb77681 100644
@@ -13,6 +13,8 @@
 #include "comm.h"
 #include "map.h"
 #include "symbol.h"
+#include "map_symbol.h"
+#include "branch.h"
 #include "thread.h"
 #include "evsel.h"
 #include "evlist.h"
tools/perf/util/symbol.c +2 -0
index e5ffe61ad66b..765c75df2904 100644
@@ -25,6 +25,8 @@
 #include "machine.h"
 #include "map.h"
 #include "symbol.h"
+#include "map_symbol.h"
+#include "mem-events.h"
 #include "symsrc.h"
 #include "strlist.h"
 #include "intlist.h"
tools/perf/util/symbol.h +0 -17
index 5a58407c2945..0b0c6b5b1899 100644
@@ -9,8 +9,6 @@
 #include <linux/list.h>
 #include <linux/rbtree.h>
 #include <stdio.h>
-#include "map_symbol.h"
-#include "branch.h"
 #include "path.h"
 #include "symbol_conf.h"
 
@@ -107,21 +105,6 @@ struct ref_reloc_sym {
 	u64		unrelocated_addr;
 };
 
-struct branch_info {
-	struct addr_map_symbol from;
-	struct addr_map_symbol to;
-	struct branch_flags flags;
-	char			*srcline_from;
-	char			*srcline_to;
-};
-
-struct mem_info {
-	struct addr_map_symbol	iaddr;
-	struct addr_map_symbol	daddr;
-	union perf_mem_data_src	data_src;
-	refcount_t		refcnt;
-};
-
 struct block_info {
 	struct symbol		*sym;
 	u64			start;
Signature · 1 line
2.21.0
author maintainer
#38 lore raw

PATCH 38/47 perf pmu: Change convert_scale from static to global

In reply to Arnaldo Carvalho de Melo

From: Jin Yao <[email protected]>

The function convert_scale() can be used to convert string to unit and scale. For example,

  s = "6000000000ns";
  convert_scale(s, &unit, &scale);

unit = "ns", scale = 6000000000.

Currently this function is static. This patch renames the function to perf_pmu__convert_scale and changes the function to global. No functional change.

---
 tools/perf/util/pmu.c | 6 +++---
 tools/perf/util/pmu.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)
tools/perf/util/pmu.c +3 -3
index 6b3448f6eb94..fb597fa94234 100644
@@ -102,7 +102,7 @@ static int pmu_format(const char *name, struct list_head *format)
 	return 0;
 }
 
-static int convert_scale(const char *scale, char **end, double *sval)
+int perf_pmu__convert_scale(const char *scale, char **end, double *sval)
 {
 	char *lc;
 	int ret = 0;
@@ -165,7 +165,7 @@ static int perf_pmu__parse_scale(struct perf_pmu_alias *alias, char *dir, char *
 	else
 		scale[sret] = '\0';
 
-	ret = convert_scale(scale, NULL, &alias->scale);
+	ret = perf_pmu__convert_scale(scale, NULL, &alias->scale);
 error:
 	close(fd);
 	return ret;
@@ -373,7 +373,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,
 				desc ? strdup(desc) : NULL;
 	alias->topic = topic ? strdup(topic) : NULL;
 	if (unit) {
-		if (convert_scale(unit, &unit, &alias->scale) < 0)
+		if (perf_pmu__convert_scale(unit, &unit, &alias->scale) < 0)
 			return -1;
 		snprintf(alias->unit, sizeof(alias->unit), "%s", unit);
 	}
tools/perf/util/pmu.h +2 -0
index 3f8b79b1dd85..f36ade6df76d 100644
@@ -96,4 +96,6 @@ struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu);
 
 struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);
 
+int perf_pmu__convert_scale(const char *scale, char **end, double *sval);
+
 #endif /* __PMU_H */
Signature · 1 line
2.21.0
author maintainer
#39 lore raw

PATCH 39/47 perf metricgroup: Scale the metric result

In reply to Arnaldo Carvalho de Melo

From: Jin Yao <[email protected]>

Some metrics define the scale unit, such as

    {
        "BriefDescription": "Intel Optane DC persistent memory read latency (ns). Derived from unc_m_pmm_rpq_occupancy.all",
        "Counter": "0,1,2,3",
        "EventCode": "0xE0",
        "EventName": "UNC_M_PMM_READ_LATENCY",
        "MetricExpr": "UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / UNC_M_CLOCKTICKS",
        "MetricName": "UNC_M_PMM_READ_LATENCY",
        "PerPkg": "1",
        "ScaleUnit": "6000000000ns",
        "UMask": "0x1",
        "Unit": "iMC"
    },

For above example, the ratio should be,

ratio = (UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / UNC_M_CLOCKTICKS) * 6000000000

But in current code, the ratio is not scaled ( * 6000000000)

With this patch, the ratio is scaled and the unit (ns) is printed.

For example,
# 219.4 ns UNC_M_PMM_READ_LATENCY

---
 tools/perf/util/metricgroup.c |  3 +++
 tools/perf/util/metricgroup.h |  1 +
 tools/perf/util/stat-shadow.c | 38 +++++++++++++++++++++++++----------
 3 files changed, 31 insertions(+), 11 deletions(-)
tools/perf/util/metricgroup.c +3 -0
index 33f5e2101874..f474a29f1b69 100644
@@ -87,6 +87,7 @@ struct egroup {
 	const char **ids;
 	const char *metric_name;
 	const char *metric_expr;
+	const char *metric_unit;
 };
 
 static bool record_evsel(int *ind, struct evsel **start,
@@ -182,6 +183,7 @@ static int metricgroup__setup_events(struct list_head *groups,
 		}
 		expr->metric_expr = eg->metric_expr;
 		expr->metric_name = eg->metric_name;
+		expr->metric_unit = eg->metric_unit;
 		expr->metric_events = metric_events;
 		list_add(&expr->nd, &me->head);
 	}
@@ -453,6 +455,7 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
 			eg->idnum = idnum;
 			eg->metric_name = pe->metric_name;
 			eg->metric_expr = pe->metric_expr;
+			eg->metric_unit = pe->unit;
 			list_add_tail(&eg->nd, group_list);
 			ret = 0;
 		}
tools/perf/util/metricgroup.h +1 -0
index e5092f6404ae..475c7f912864 100644
@@ -20,6 +20,7 @@ struct metric_expr {
 	struct list_head nd;
 	const char *metric_expr;
 	const char *metric_name;
+	const char *metric_unit;
 	struct evsel **metric_events;
 };
 
tools/perf/util/stat-shadow.c +27 -11
index 2ed5e0066c70..696d263f6eb6 100644
@@ -715,6 +715,7 @@ static void generic_metric(struct perf_stat_config *config,
 			   struct evsel **metric_events,
 			   char *name,
 			   const char *metric_name,
+			   const char *metric_unit,
 			   double avg,
 			   int cpu,
 			   struct perf_stat_output_ctx *out,
@@ -722,7 +723,7 @@ static void generic_metric(struct perf_stat_config *config,
 {
 	print_metric_t print_metric = out->print_metric;
 	struct parse_ctx pctx;
-	double ratio;
+	double ratio, scale;
 	int i;
 	void *ctxp = out->ctx;
 	char *n, *pn;
@@ -732,7 +733,6 @@ static void generic_metric(struct perf_stat_config *config,
 	for (i = 0; metric_events[i]; i++) {
 		struct saved_value *v;
 		struct stats *stats;
-		double scale;
 
 		if (!strcmp(metric_events[i]->name, "duration_time")) {
 			stats = &walltime_nsecs_stats;
@@ -762,16 +762,32 @@ static void generic_metric(struct perf_stat_config *config,
 	if (!metric_events[i]) {
 		const char *p = metric_expr;
 
-		if (expr__parse(&ratio, &pctx, &p) == 0)
-			print_metric(config, ctxp, NULL, "%8.1f",
-				metric_name ?
-				metric_name :
-				out->force_header ?  name : "",
-				ratio);
-		else
+		if (expr__parse(&ratio, &pctx, &p) == 0) {
+			char *unit;
+			char metric_bf[64];
+
+			if (metric_unit && metric_name) {
+				if (perf_pmu__convert_scale(metric_unit,
+					&unit, &scale) >= 0) {
+					ratio *= scale;
+				}
+
+				scnprintf(metric_bf, sizeof(metric_bf),
+					  "%s  %s", unit, metric_name);
+				print_metric(config, ctxp, NULL, "%8.1f",
+					     metric_bf, ratio);
+			} else {
+				print_metric(config, ctxp, NULL, "%8.1f",
+					metric_name ?
+					metric_name :
+					out->force_header ?  name : "",
+					ratio);
+			}
+		} else {
 			print_metric(config, ctxp, NULL, NULL,
 				     out->force_header ?
 				     (metric_name ? metric_name : name) : "", 0);
+		}
 	} else
 		print_metric(config, ctxp, NULL, NULL, "", 0);
 
@@ -992,7 +1008,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
 			print_metric(config, ctxp, NULL, NULL, name, 0);
 	} else if (evsel->metric_expr) {
 		generic_metric(config, evsel->metric_expr, evsel->metric_events, evsel->name,
-				evsel->metric_name, avg, cpu, out, st);
+				evsel->metric_name, NULL, avg, cpu, out, st);
 	} else if (runtime_stat_n(st, STAT_NSECS, 0, cpu) != 0) {
 		char unit = 'M';
 		char unit_buf[10];
@@ -1021,7 +1037,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
 				out->new_line(config, ctxp);
 			generic_metric(config, mexp->metric_expr, mexp->metric_events,
 					evsel->name, mexp->metric_name,
-					avg, cpu, out, st);
+					mexp->metric_unit, avg, cpu, out, st);
 		}
 	}
 	if (num == 0)
Signature · 1 line
2.21.0
author maintainer
#40 lore raw

PATCH 40/47 perf metricgroup: Support multiple events for metricgroup

In reply to Arnaldo Carvalho de Melo

From: Jin Yao <[email protected]>

Some uncore metrics don't work as expected. For example, on cascadelakex:

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

Performance counter stats for 'system wide':

           1841092      unc_m_pmm_rpq_inserts
           3680816      unc_m_pmm_wpq_inserts

       1.001775055 seconds time elapsed
  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

Performance counter stats for 'system wide':

         860649746      unc_m_pmm_rpq_occupancy.all
           1840557      unc_m_pmm_rpq_inserts
       12790627455      unc_m_clockticks
       1.001773348 seconds time elapsed

No metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' or 'UNC_M_PMM_READ_LATENCY' are reported.

The issue is, the case of an alias expanding to mulitple events is not supported, typically the uncore events. (see comments in find_evsel_group()).

For UNC_M_PMM_BANDWIDTH.TOTAL in above example, the expanded event group is '{unc_m_pmm_rpq_inserts,unc_m_pmm_wpq_inserts}:W', but the actual events passed to find_evsel_group are:

unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_rpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts
unc_m_pmm_wpq_inserts

For this multiple events case, it's not supported well.

This patch introduces a new field 'metric_leader' in struct evsel. The first event is considered as a metric leader. For the rest of same events, they point to the first event via it's metric_leader field in struct evsel.

This design is for adding the counting results of all same events to the first event in group (the metric_leader).

With this patch,

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

Performance counter stats for 'system wide':

           1842108      unc_m_pmm_rpq_inserts     #    337.2 MB/sec  UNC_M_PMM_BANDWIDTH.TOTAL
           3682209      unc_m_pmm_wpq_inserts

       1.001819706 seconds time elapsed
  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

Performance counter stats for 'system wide':

         861970685      unc_m_pmm_rpq_occupancy.all #    219.4 ns  UNC_M_PMM_READ_LATENCY
           1842772      unc_m_pmm_rpq_inserts
       12790196356      unc_m_clockticks
       1.001749103 seconds time elapsed

Now we can see the correct metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' and 'UNC_M_PMM_READ_LATENCY'.

---
 tools/perf/util/evsel.h       |  1 +
 tools/perf/util/metricgroup.c | 84 ++++++++++++++++++-----------------
 tools/perf/util/stat-shadow.c | 27 +++++++++--
 3 files changed, 68 insertions(+), 44 deletions(-)
tools/perf/util/evsel.h +1 -0
index fd60caced4fc..68321d10eb2d 100644
@@ -168,6 +168,7 @@ struct evsel {
 	const char *		metric_expr;
 	const char *		metric_name;
 	struct evsel		**metric_events;
+	struct evsel		*metric_leader;
 	bool			collect_stat;
 	bool			weak_group;
 	bool			percore;
tools/perf/util/metricgroup.c +44 -40

101 lines not on this page · raw message

tools/perf/util/stat-shadow.c +23 -4
index 696d263f6eb6..70c87fdb2a43 100644
@@ -31,6 +31,8 @@ struct saved_value {
 	int cpu;
 	struct runtime_stat *stat;
 	struct stats stats;
+	u64 metric_total;
+	int metric_other;
 };
 
 static int saved_value_cmp(struct rb_node *rb_node, const void *entry)
@@ -212,6 +214,7 @@ void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
 {
 	int ctx = evsel_context(counter);
 	u64 count_ns = count;
+	struct saved_value *v;
 
 	count *= counter->scale;
 
@@ -266,9 +269,15 @@ void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
 		update_runtime_stat(st, STAT_APERF, ctx, cpu, count);
 
 	if (counter->collect_stat) {
-		struct saved_value *v = saved_value_lookup(counter, cpu, true,
-							   STAT_NONE, 0, st);
+		v = saved_value_lookup(counter, cpu, true, STAT_NONE, 0, st);
 		update_stats(&v->stats, count);
+		if (counter->metric_leader)
+			v->metric_total += count;
+	} else if (counter->metric_leader) {
+		v = saved_value_lookup(counter->metric_leader,
+				       cpu, true, STAT_NONE, 0, st);
+		v->metric_total += count;
+		v->metric_other++;
 	}
 }
 
@@ -729,10 +738,10 @@ static void generic_metric(struct perf_stat_config *config,
 	char *n, *pn;
 
 	expr__ctx_init(&pctx);
-	expr__add_id(&pctx, name, avg);
 	for (i = 0; metric_events[i]; i++) {
 		struct saved_value *v;
 		struct stats *stats;
+		u64 metric_total = 0;
 
 		if (!strcmp(metric_events[i]->name, "duration_time")) {
 			stats = &walltime_nsecs_stats;
@@ -744,6 +753,9 @@ static void generic_metric(struct perf_stat_config *config,
 				break;
 			stats = &v->stats;
 			scale = 1.0;
+
+			if (v->metric_other)
+				metric_total = v->metric_total;
 		}
 
 		n = strdup(metric_events[i]->name);
@@ -757,8 +769,15 @@ static void generic_metric(struct perf_stat_config *config,
 		pn = strchr(n, ' ');
 		if (pn)
 			*pn = 0;
-		expr__add_id(&pctx, n, avg_stats(stats)*scale);
+
+		if (metric_total)
+			expr__add_id(&pctx, n, metric_total);
+		else
+			expr__add_id(&pctx, n, avg_stats(stats)*scale);
 	}
+
+	expr__add_id(&pctx, name, avg);
+
 	if (!metric_events[i]) {
 		const char *p = metric_expr;
 
Signature · 1 line
2.21.0
author maintainer
#41 lore raw

PATCH 41/47 objtool: Move x86 insn decoder to a common location

In reply to Arnaldo Carvalho de Melo

From: Josh Poimboeuf <[email protected]>

The kernel tree has three identical copies of the x86 instruction decoder. Two of them are in the tools subdir.

The tools subdir is supposed to be completely standalone and separate from the kernel. So having at least one copy of the kernel decoder in the tools subdir is unavoidable. However, we don't need *two* of them.

Move objtool's copy of the decoder to a shared location, so that perf will also be able to use it.

---
 tools/{objtool => }/arch/x86/include/asm/inat.h      |  0
 .../{objtool => }/arch/x86/include/asm/inat_types.h  |  0
 tools/{objtool => }/arch/x86/include/asm/insn.h      |  0
 tools/{objtool => }/arch/x86/include/asm/orc_types.h |  0
 tools/{objtool => }/arch/x86/lib/inat.c              |  0
 tools/{objtool => }/arch/x86/lib/insn.c              |  0
 tools/{objtool => }/arch/x86/lib/x86-opcode-map.txt  |  0
 .../arch/x86/tools/gen-insn-attr-x86.awk             |  0
 tools/objtool/Makefile                               |  4 ++--
 tools/objtool/arch/x86/Build                         |  4 ++--
 tools/objtool/arch/x86/decode.c                      |  4 ++--
 tools/objtool/sync-check.sh                          | 12 ++++++------
 12 files changed, 12 insertions(+), 12 deletions(-)
 rename tools/{objtool => }/arch/x86/include/asm/inat.h (100%)
 rename tools/{objtool => }/arch/x86/include/asm/inat_types.h (100%)
 rename tools/{objtool => }/arch/x86/include/asm/insn.h (100%)
 rename tools/{objtool => }/arch/x86/include/asm/orc_types.h (100%)
 rename tools/{objtool => }/arch/x86/lib/inat.c (100%)
 rename tools/{objtool => }/arch/x86/lib/insn.c (100%)
 rename tools/{objtool => }/arch/x86/lib/x86-opcode-map.txt (100%)
 rename tools/{objtool => }/arch/x86/tools/gen-insn-attr-x86.awk (100%)
tools/arch/x86/include/asm/inat.h renamed from tools/objtool/arch/x86/include/asm/inat.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/include/asm/inat.h
rename to tools/arch/x86/include/asm/inat.h
tools/arch/x86/include/asm/inat_types.h renamed from tools/objtool/arch/x86/include/asm/inat_types.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/include/asm/inat_types.h
rename to tools/arch/x86/include/asm/inat_types.h
tools/arch/x86/include/asm/insn.h renamed from tools/objtool/arch/x86/include/asm/insn.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/include/asm/insn.h
rename to tools/arch/x86/include/asm/insn.h
tools/arch/x86/include/asm/orc_types.h renamed from tools/objtool/arch/x86/include/asm/orc_types.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/include/asm/orc_types.h
rename to tools/arch/x86/include/asm/orc_types.h
tools/arch/x86/lib/inat.c renamed from tools/objtool/arch/x86/lib/inat.c +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/lib/inat.c
rename to tools/arch/x86/lib/inat.c
tools/arch/x86/lib/insn.c renamed from tools/objtool/arch/x86/lib/insn.c +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/lib/insn.c
rename to tools/arch/x86/lib/insn.c
tools/arch/x86/lib/x86-opcode-map.txt renamed from tools/objtool/arch/x86/lib/x86-opcode-map.txt +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/lib/x86-opcode-map.txt
rename to tools/arch/x86/lib/x86-opcode-map.txt
tools/arch/x86/tools/gen-insn-attr-x86.awk renamed from tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
rename to tools/arch/x86/tools/gen-insn-attr-x86.awk
tools/objtool/Makefile +2 -2
index 88158239622b..8c9b9adc67ef 100644
@@ -33,7 +33,7 @@ all: $(OBJTOOL)
 
 INCLUDES := -I$(srctree)/tools/include \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
-	    -I$(srctree)/tools/objtool/arch/$(ARCH)/include
+	    -I$(srctree)/tools/arch/$(ARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
 CFLAGS   += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
 LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
@@ -60,7 +60,7 @@ $(LIBSUBCMD): fixdep FORCE
 clean:
 	$(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
 	$(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
-	$(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
+	$(Q)$(RM) $(OUTPUT)arch/x86/inat-tables.c $(OUTPUT)fixdep
 
 FORCE:
 
tools/objtool/arch/x86/Build +2 -2
index b998412c017d..7c5004008e97 100644
@@ -1,7 +1,7 @@
 objtool-y += decode.o
 
-inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk
-inat_tables_maps = arch/x86/lib/x86-opcode-map.txt
+inat_tables_script = ../arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = ../arch/x86/lib/x86-opcode-map.txt
 
 $(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call rule_mkdir)
tools/objtool/arch/x86/decode.c +2 -2
index 0567c47a91b1..a62e032863a8 100644
@@ -8,8 +8,8 @@
 
 #define unlikely(cond) (cond)
 #include <asm/insn.h>
-#include "lib/inat.c"
-#include "lib/insn.c"
+#include "../../../arch/x86/lib/inat.c"
+#include "../../../arch/x86/lib/insn.c"
 
 #include "../../elf.h"
 #include "../../arch.h"
tools/objtool/sync-check.sh +6 -6
index 1470e74e9d66..66f1575b80f3 100755
@@ -2,21 +2,21 @@
 # SPDX-License-Identifier: GPL-2.0
 
 FILES='
-arch/x86/lib/insn.c
-arch/x86/lib/inat.c
-arch/x86/lib/x86-opcode-map.txt
-arch/x86/tools/gen-insn-attr-x86.awk
-arch/x86/include/asm/insn.h
 arch/x86/include/asm/inat.h
 arch/x86/include/asm/inat_types.h
+arch/x86/include/asm/insn.h
 arch/x86/include/asm/orc_types.h
+arch/x86/lib/inat.c
+arch/x86/lib/insn.c
+arch/x86/lib/x86-opcode-map.txt
+arch/x86/tools/gen-insn-attr-x86.awk
 '
 
 check()
 {
 	local file=$1
 
-	diff $file ../../$file > /dev/null ||
+	diff ../$file ../../$file > /dev/null ||
 		echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
 }
 
Signature · 1 line
2.21.0
author maintainer
#42 lore raw

PATCH 42/47 perf: Update .gitignore file

In reply to Arnaldo Carvalho de Melo

From: Josh Poimboeuf <[email protected]>

After a "make tools/perf", git reports the following untracked files:

tools/perf/feature/
tools/perf/fixdep tools/perf/libtraceevent-dynamic-list

Add these generated files to perf's .gitignore file.

---
 tools/perf/.gitignore | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/.gitignore +3 -0
index 3e5135dded16..bf1252dc2cb0 100644
@@ -34,3 +34,6 @@ arch/*/include/generated/
 trace/beauty/generated/
 pmu-events/pmu-events.c
 pmu-events/jevents
+feature/
+fixdep
+libtraceevent-dynamic-list
Signature · 1 line
2.21.0
author maintainer
#43 lore raw

PATCH 43/47 perf intel-pt: Remove inat.c from build dependency list

In reply to Arnaldo Carvalho de Melo

From: Josh Poimboeuf <[email protected]>

intel-pt-insn-decoder.c includes inat.c directly, so it already has an implicit dependency on inat.c. The Build file dependency is redundant.

---
 tools/perf/util/intel-pt-decoder/Build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/Build +1 -1
index 23bf788f84b9..acb18a3463c3 100644
@@ -9,7 +9,7 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table
 
 # Busybox's diff doesn't have -I, avoid warning in the case
 
-$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
+$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
 	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
 	test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \
 	((diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null) || \
Signature · 1 line
2.21.0
author maintainer
#44 lore raw

PATCH 44/47 perf intel-pt: Use shared x86 insn decoder

In reply to Arnaldo Carvalho de Melo

From: Josh Poimboeuf <[email protected]>

Now that there's a common version of the decoder for all tools, use it instead of the local copy.

Also use perf's check-headers.sh script to diff the decoder files to make sure they remain in sync with the kernel version. Objtool has a similar check.

Committer notes:

Had to keep this all pointing explicitely to x86 headers/files, i.e. instead of asm/isnn.h we had to use ../include/asm/insn.h when the files were in differemt dirs, or just replace "<asm/foo.h>" with "foo.h".

This way we continue to be able to process perf.data files with Intel PT traces in distros other than x86.

Also fixed up the awk script paths to use $(srcdir)/tools/arch instead or relative directories so that we keep detached tarballs (make help | grep perf) working.

For now the include lines in these headers are being ignored so as not to flag false reports of kernel/tools out of sync.

---
 tools/arch/x86/include/asm/inat.h             |    2 +-
 tools/arch/x86/include/asm/insn.h             |    2 +-
 tools/arch/x86/lib/inat.c                     |    2 +-
 tools/arch/x86/lib/insn.c                     |    4 +-
 tools/perf/arch/x86/tests/insn-x86.c          |    2 +-
 tools/perf/arch/x86/util/archinsn.c           |    2 +-
 tools/perf/check-headers.sh                   |   11 +-
 tools/perf/util/intel-pt-decoder/Build        |   20 +-
 .../intel-pt-decoder/gen-insn-attr-x86.awk    |  392 ------
 tools/perf/util/intel-pt-decoder/inat.c       |   82 --
 tools/perf/util/intel-pt-decoder/inat.h       |  230 ----
 tools/perf/util/intel-pt-decoder/inat_types.h |   15 -
 tools/perf/util/intel-pt-decoder/insn.c       |  593 ---------
 tools/perf/util/intel-pt-decoder/insn.h       |  216 ----
 .../intel-pt-decoder/intel-pt-insn-decoder.c  |   10 +-
 .../util/intel-pt-decoder/x86-opcode-map.txt  | 1072 -----------------
 16 files changed, 23 insertions(+), 2632 deletions(-)
 delete mode 100644 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/insn.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/insn.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt
tools/arch/x86/include/asm/inat.h +1 -1
index 4cf2ad521f65..877827b7c2c3 100644
@@ -6,7 +6,7 @@
  *
  * Written by Masami Hiramatsu <[email protected]>
  */
-#include <asm/inat_types.h>
+#include "inat_types.h"
 
 /*
  * Internal bits. Don't use bitmasks directly, because these bits are
tools/arch/x86/include/asm/insn.h +1 -1
index 154f27be8bfc..37a4c390750b 100644
@@ -8,7 +8,7 @@
  */
 
 /* insn_attr_t is defined in inat.h */
-#include <asm/inat.h>
+#include "inat.h"
 
 struct insn_field {
 	union {
tools/arch/x86/lib/inat.c +1 -1
index 12539fca75c4..4f5ed49e1b4e 100644
@@ -4,7 +4,7 @@
  *
  * Written by Masami Hiramatsu <[email protected]>
  */
-#include <asm/insn.h>
+#include "../include/asm/insn.h"
 
 /* Attribute tables are generated from opcode map */
 #include "inat-tables.c"
tools/arch/x86/lib/insn.c +2 -2
index 0b5862ba6a75..79e048f1d902 100644
@@ -10,8 +10,8 @@
 #else
 #include <string.h>
 #endif
-#include <asm/inat.h>
-#include <asm/insn.h>
+#include "../include/asm/inat.h"
+#include "../include/asm/insn.h"
 
 /* Verify next sizeof(t) bytes can be on the same instruction */
 #define validate_next(t, insn, n)	\
tools/perf/arch/x86/tests/insn-x86.c +1 -1
index d67bc0ffb70a..745f29adb14b 100644
@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/types.h>
+#include "../../../../arch/x86/include/asm/insn.h"
 #include <string.h>
 
 #include "debug.h"
 #include "tests/tests.h"
 #include "arch-tests.h"
 
-#include "intel-pt-decoder/insn.h"
 #include "intel-pt-decoder/intel-pt-insn-decoder.h"
 
 struct test_data {
tools/perf/arch/x86/util/archinsn.c +1 -1
index 62e8e1820132..9876c7a7ed7c 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "../../../../arch/x86/include/asm/insn.h"
 #include "archinsn.h"
-#include "util/intel-pt-decoder/insn.h"
 #include "machine.h"
 #include "thread.h"
 #include "symbol.h"
tools/perf/check-headers.sh +9 -2
index 5308b3836278..cbcc3590098c 100755
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-HEADERS='
+FILES='
 include/uapi/linux/const.h
 include/uapi/drm/drm.h
 include/uapi/drm/i915_drm.h
@@ -26,7 +26,14 @@ include/uapi/linux/hw_breakpoint.h
 arch/x86/include/asm/disabled-features.h
 arch/x86/include/asm/required-features.h
 arch/x86/include/asm/cpufeatures.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/include/asm/insn.h
 arch/x86/include/uapi/asm/prctl.h
+arch/x86/lib/inat.c
+arch/x86/lib/insn.c
+arch/x86/lib/x86-opcode-map.txt
+arch/x86/tools/gen-insn-attr-x86.awk
 arch/arm/include/uapi/asm/perf_regs.h
 arch/arm64/include/uapi/asm/perf_regs.h
 arch/powerpc/include/uapi/asm/perf_regs.h
@@ -98,7 +105,7 @@ test -d ../../include || exit 0
 cd ../..
 
 # simple diff check
-for i in $HEADERS; do
+for i in $FILES; do
   check $i -B
 done
 
tools/perf/util/intel-pt-decoder/Build +2 -18
index acb18a3463c3..bc629359826f 100644
@@ -1,7 +1,7 @@
 perf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o intel-pt-log.o intel-pt-decoder.o
 
-inat_tables_script = util/intel-pt-decoder/gen-insn-attr-x86.awk
-inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt
+inat_tables_script = $(srctree)/tools/arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = $(srctree)/tools/arch/x86/lib/x86-opcode-map.txt
 
 $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call rule_mkdir)
@@ -10,22 +10,6 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) $(inat_table
 # Busybox's diff doesn't have -I, avoid warning in the case
 
 $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/intel-pt-insn-decoder.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
-	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
-	test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \
-	((diff -B -I'^#include' util/intel-pt-decoder/insn.c ../../arch/x86/lib/insn.c >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder C file at 'tools/perf/util/intel-pt-decoder/insn.c' differs from latest version at 'arch/x86/lib/insn.c'" >&2)) && \
-	((diff -B -I'^#include' util/intel-pt-decoder/inat.c ../../arch/x86/lib/inat.c >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder C file at 'tools/perf/util/intel-pt-decoder/inat.c' differs from latest version at 'arch/x86/lib/inat.c'" >&2)) && \
-	((diff -B util/intel-pt-decoder/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder map file at 'tools/perf/util/intel-pt-decoder/x86-opcode-map.txt' differs from latest version at 'arch/x86/lib/x86-opcode-map.txt'" >&2)) && \
-	((diff -B util/intel-pt-decoder/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder script at 'tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk' differs from latest version at 'arch/x86/tools/gen-insn-attr-x86.awk'" >&2)) && \
-	((diff -B -I'^#include' util/intel-pt-decoder/insn.h ../../arch/x86/include/asm/insn.h >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'" >&2)) && \
-	((diff -B -I'^#include' util/intel-pt-decoder/inat.h ../../arch/x86/include/asm/inat.h >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'" >&2)) && \
-	((diff -B -I'^#include' util/intel-pt-decoder/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) || \
-	(echo "Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/inat_types.h' differs from latest version at 'arch/x86/include/asm/inat_types.h'" >&2)))) || true
 	$(call rule_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk deleted +0 -392

392 lines not on this page · raw message

tools/perf/util/intel-pt-decoder/inat.c deleted +0 -82

82 lines not on this page · raw message

tools/perf/util/intel-pt-decoder/inat.h deleted +0 -230

230 lines not on this page · raw message

tools/perf/util/intel-pt-decoder/inat_types.h deleted +0 -15
deleted file mode 100644
index b047efa9ddc2..000000000000
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef _ASM_X86_INAT_TYPES_H
-#define _ASM_X86_INAT_TYPES_H
-/*
- * x86 instruction attributes
- *
- * Written by Masami Hiramatsu <[email protected]>
- */
-
-/* Instruction attributes */
-typedef unsigned int insn_attr_t;
-typedef unsigned char insn_byte_t;
-typedef signed int insn_value_t;
-
-#endif
tools/perf/util/intel-pt-decoder/insn.c deleted +0 -593

593 lines not on this page · raw message

tools/perf/util/intel-pt-decoder/insn.h deleted +0 -216

216 lines not on this page · raw message

tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c +5 -5
index 598f56be9f17..fb8a3558d3d5 100644
@@ -4,17 +4,17 @@
  * Copyright (c) 2013-2014, Intel Corporation.
  */
 
+#include <linux/kernel.h>
 #include <stdio.h>
 #include <string.h>
 #include <endian.h>
 #include <byteswap.h>
+#include "../../../arch/x86/include/asm/insn.h"
 
-#include "event.h"
-
-#include "insn.h"
+#include "../../../arch/x86/lib/inat.c"
+#include "../../../arch/x86/lib/insn.c"
 
-#include "inat.c"
-#include "insn.c"
+#include "event.h"
 
 #include "intel-pt-insn-decoder.h"
 #include "dump-insn.h"
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt deleted +0 -1072

1,072 lines not on this page · raw message

Signature · 1 line
2.21.0
author maintainer
#45 lore raw

PATCH 45/47 perf build: Ignore intentional differences for the x86 insn decoder

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Since we need to build this in !x86, we need to explicitely use the x86 files, not things like asm/insn.h, so we intentionally differ from the master copy in the kernel sources, add -I diff directives to ignore just these differences when checking for drift.

---
 tools/perf/check-headers.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/check-headers.sh +4 -4
index cbcc3590098c..e2e0f06c97d0 100755
@@ -26,12 +26,8 @@ include/uapi/linux/hw_breakpoint.h
 arch/x86/include/asm/disabled-features.h
 arch/x86/include/asm/required-features.h
 arch/x86/include/asm/cpufeatures.h
-arch/x86/include/asm/inat.h
 arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/insn.h
 arch/x86/include/uapi/asm/prctl.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 arch/arm/include/uapi/asm/perf_regs.h
@@ -116,6 +112,10 @@ check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman
 check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'
 check include/linux/ctype.h	      '-I "isdigit("'
 check lib/ctype.c		      '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
+check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
+check arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
+check arch/x86/lib/inat.c	      '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
+check arch/x86/lib/insn.c	      '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
 
 # diff non-symmetric files
 check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
Signature · 1 line
2.21.0
author maintainer
#46 lore raw

PATCH 46/47 objtool: Update sync-check.sh from perf's check-headers.sh

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

To allow using the -I trick that will be needed for checking the x86 insn decoder files.

Without the specific -I lines we still get the same warnings as before:

  $ make -C tools/objtool/ clean ; make -C tools/objtool/
  make: Entering directory '/home/acme/git/perf/tools/objtool'
    CLEAN    objtool
  find  -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  rm -f arch/x86/inat-tables.c fixdep
  <SNIP>
    LD       objtool-in.o
  make[1]: Leaving directory '/home/acme/git/perf/tools/objtool'
  Warning: Kernel ABI header at 'tools/arch/x86/include/asm/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'
  diff -u tools/arch/x86/include/asm/inat.h arch/x86/include/asm/inat.h
  Warning: Kernel ABI header at 'tools/arch/x86/include/asm/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
  diff -u tools/arch/x86/include/asm/insn.h arch/x86/include/asm/insn.h
  Warning: Kernel ABI header at 'tools/arch/x86/lib/inat.c' differs from latest version at 'arch/x86/lib/inat.c'
  diff -u tools/arch/x86/lib/inat.c arch/x86/lib/inat.c
  Warning: Kernel ABI header at 'tools/arch/x86/lib/insn.c' differs from latest version at 'arch/x86/lib/insn.c'
  diff -u tools/arch/x86/lib/insn.c arch/x86/lib/insn.c
  /home/acme/git/perf/tools/objtool
    LINK     objtool
  make: Leaving directory '/home/acme/git/perf/tools/objtool'
  $

The next patch will add the -I lines for those files.

---
 tools/objtool/sync-check.sh | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
tools/objtool/sync-check.sh +26 -5
index 66f1575b80f3..6fa87de1c765 100755
@@ -12,18 +12,39 @@ arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 '
 
-check()
-{
-	local file=$1
+check_2 () {
+  file1=$1
+  file2=$2
 
-	diff ../$file ../../$file > /dev/null ||
-		echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
+  shift
+  shift
+
+  cmd="diff $* $file1 $file2 > /dev/null"
+
+  test -f $file2 && {
+    eval $cmd || {
+      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
+      echo diff -u $file1 $file2
+    }
+  }
+}
+
+check () {
+  file=$1
+
+  shift
+
+  check_2 tools/$file $file $*
 }
 
 if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
 	exit 0
 fi
 
+cd ../..
+
 for i in $FILES; do
   check $i
 done
+
+cd -
Signature · 1 line
2.21.0
author maintainer
#47 lore raw

PATCH 47/47 objtool: Ignore intentional differences for the x86 insn decoder

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Since we need to build this in !x86, we need to explicitely use the x86 files, not things like asm/insn.h, so we intentionally differ from the master copy in the kernel sources, add -I diff directives to ignore just these differences when checking for drift.

---
 tools/objtool/sync-check.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/objtool/sync-check.sh +5 -4
index 6fa87de1c765..0a832e265a50 100755
@@ -2,12 +2,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 FILES='
-arch/x86/include/asm/inat.h
 arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/insn.h
 arch/x86/include/asm/orc_types.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 '
@@ -47,4 +43,9 @@ for i in $FILES; do
   check $i
 done
 
+check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
+check arch/x86/include/asm/insn.h     '-I "^#include [\"<]\(asm/\)*inat.h[\">]"'
+check arch/x86/lib/inat.c             '-I "^#include [\"<]\(../include/\)*asm/insn.h[\">]"'
+check arch/x86/lib/insn.c             '-I "^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
+
 cd -
Signature · 1 line
2.21.0
#48 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 143 lines · Arnaldo Carvalho de Melo

Hi Ingo/Thomas,

Please consider pulling,

Best regards,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 39c2ca43465e0f52ebba3ee96fd03436367c1880:

Merge tag 'perf-core-for-mingo-5.4-20190829' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2019-08-29 20:56:32 +0200)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.4-20190901

for you to fetch changes up to ae31a514a134d9e4ca1d7b0f0a19b5934747d79f:

objtool: Ignore intentional differences for the x86 insn decoder (2019-08-31 22:27:52 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

objtool:

Josh Poimboeuf:

- Move x86 insn decoder to a common location.

Arnaldo Carvalho de Melo:

- Ignore intentional differences for the x86 insn decoder.

build:

Arnaldo Carvalho de Melo:

- Ignore intentional differences for the x86 insn decoder.

Intel PT:

Josh Poimboeuf:

- Use shared x86 insn decoder.

metric groups:

Jin Yao:

- Scale the metric result.

- Support multiple events.

perf c2c:

Jiri Olsa:

- Display proper cpu count in nodes column.

Miscellaneous:

Kyle Meyer:

- Replace MAX_NR_CPUS with perf_env::nr_cpus_online, i.e. with the number of online CPUs as detected at tool start and/or recorded in the perf.data file.

libtraceevent:

Tzvetomir Stoyanov:

- Simplify the tep_print_event_* APIs.

- Remove tep_register_trace_clock().

- Change users plugin directory.

Cleanups:

Arnaldo Carvalho de Melo:

- Continue taming the includes hell: remove needless include directives, fix the fallout, rinse, repeat.

----------------------------------------------------------------
Arnaldo Carvalho de Melo (29):
perf tools: Remove needless libtraceevent include directives perf header: Move CPUINFO_PROC to the only file where it is used perf tools: Move everything related to sys_perf_event_open() to perf-sys.h perf time-utils: Adopt rdclock() from perf.h
perf tools: Remove needless perf.h include directive from headers perf tools: Remove perf.h from source files not needing it perf tools: Remove debug.h from header files not needing it perf debug: Remove needless include directives from debug.h perf env: Remove env.h from other headers where just a fwd decl is needed perf event: Remove needless include directives from event.h perf dso: Adopt DSO related macros from symbol.h
perf symbol: Move C++ demangle defines to the only file using it perf symbols: Add missing linux/refcount.h to symbol.h
perf symbols: Move symsrc prototypes to a separate header perf dsos: Move the dsos struct and its methods to separate source files perf hist: Remove needless ui/progress.h from hist.h
perf tools: Move 'struct events_stats' and prototypes to separate header perf tools: Remove needless sort.h include directives
perf probe: No need for symbol.h, symbol_conf is enough
perf tools: Remove needless map.h include directives
perf tools: Remove needless thread.h include directives
perf tools: Remove needless thread_map.h include directives perf tools: Remove needless evlist.h include directives
perf tools: Remove needless evlist.h include directives
perf auxtrace: Uninline functions that touch perf_session perf symbols: Move mem_info and branch_info out of symbol.h perf build: Ignore intentional differences for the x86 insn decoder
objtool: Update sync-check.sh from perf's check-headers.sh
objtool: Ignore intentional differences for the x86 insn decoder

Jin Yao (3):
perf pmu: Change convert_scale from static to global perf metricgroup: Scale the metric result
perf metricgroup: Support multiple events for metricgroup

Jiri Olsa (1):
perf c2c: Display proper cpu count in nodes column

Josh Poimboeuf (4):
objtool: Move x86 insn decoder to a common location
perf: Update .gitignore file
perf intel-pt: Remove inat.c from build dependency list perf intel-pt: Use shared x86 insn decoder

Kyle Meyer (7):
perf timechart: Refactor svg_build_topology_map()
perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf stat: Replace MAX_NR_CPUS with cpu__max_cpu() perf session: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf machine: Replace MAX_NR_CPUS with perf_env::nr_cpus_online perf header: Replace MAX_NR_CPUS with cpu__max_cpu()
libperf: Warn when exceeding MAX_NR_CPUS in cpumap

Quoted 6 lines

Tzvetomir Stoyanov (3):
libtraceevent, perf tools: Changes in tep_print_event_* APIs
libtraceevent: Remove tep_register_trace_clock()
libtraceevent: Change users plugin directory

 267 files changed, 1319 insertions(+), 3578 deletions(-)

Pulled, thanks a lot Arnaldo!

Ingo