linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/22] perf/core improvements and fixes
@ 2016-12-13 15:09 Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 01/22] perf tools: Move headers check into bash script Arnaldo Carvalho de Melo
                   ` (21 more replies)
  0 siblings, 22 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexei Starovoitov, Alexis Berlemont,
	Andi Kleen, Daniel Borkmann, David Ahern, Hemant Kumar,
	Jiri Olsa, Joe Stringer, Masami Hiramatsu, Minchan Kim,
	Namhyung Kim, Peter Zijlstra, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Hi Ingo,

	Please consider pulling, I had most of this queued before your first
pull req to Linus for 4.10, most are fixes, with 'perf sched timehist --idle'
as a followup new feature to the 'perf sched timehist' command introduced in
this window.

Thanks,

- Arnaldo

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

The following changes since commit b0c1ef52959582144bbea9a2b37db7f4c9e399f7:

  perf/x86: Fix exclusion of BTS and LBR for Goldmont (2016-12-11 13:06:09 +0100)

are available in the git repository at:

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

for you to fetch changes up to a03f73547fb6e0f7f2942c46cce9b48df50238ba:

  samples/bpf: Drop unnecessary build targets. (2016-12-13 10:38:10 -0300)

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

New features:

- Introduce 'perf sched timehist --idle', to analyse processes
  going to/from idle state (Namhyung Kim)

- Add scanning of SDT (Software Defined Tracing) probles arguments (Alexis Berlemont)

Fixes:

- Allow 'perf record -u user' to continue when facing races with threads
  going away after having scanned them via /proc (Jiri Olsa)

- Fix 'perf mem' --all-user/--all-kernel options (Jiri Olsa)

Infrastructure:

- Switch over samples/bpf/ to tools/lib/bpf, removing libbpf duplication (Joe Stringer)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Alexis Berlemont (1):
      perf sdt: Add scanning of sdt probles arguments

Arnaldo Carvalho de Melo (1):
      perf tools: Remove some needless __maybe_unused

Jiri Olsa (6):
      perf tools: Move headers check into bash script
      perf mem: Fix --all-user/--all-kernel options
      perf evsel: Use variable instead of repeating lengthy FD macro
      perf thread_map: Add thread_map__remove function
      perf evsel: Allow to ignore missing pid
      perf record: Force ignore_missing_thread for uid option

Joe Stringer (8):
      tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h
      tools lib bpf: use __u32 from linux/types.h
      tools lib bpf: Add flags to bpf_create_map()
      samples/bpf: Make samples more libbpf-centric
      samples/bpf: Switch over to libbpf
      samples/bpf: Remove perf_event_open() declaration
      samples/bpf: Move open_raw_sock to separate header
      samples/bpf: Drop unnecessary build targets.

Namhyung Kim (6):
      perf sched timehist: Split is_idle_sample()
      perf sched timehist: Introduce struct idle_time_data
      perf sched timehist: Save callchain when entering idle
      perf sched timehist: Skip non-idle events when necessary
      perf sched timehist: Add -I/--idle-hist option
      perf sched timehist: Show callchains for idle stat

 samples/bpf/Makefile                              |  60 ++---
 samples/bpf/README.rst                            |   4 +-
 samples/bpf/bpf_load.c                            |  20 +-
 samples/bpf/fds_example.c                         |  10 +-
 samples/bpf/lathist_user.c                        |   3 +-
 samples/bpf/libbpf.c                              | 155 -------------
 samples/bpf/libbpf.h                              |  25 +--
 samples/bpf/map_perf_test_user.c                  |   1 +
 samples/bpf/offwaketime_user.c                    |  10 +-
 samples/bpf/sampleip_user.c                       |   8 +-
 samples/bpf/sock_example.c                        |  11 +-
 samples/bpf/sock_example.h                        |  35 +++
 samples/bpf/sockex1_user.c                        |   9 +-
 samples/bpf/sockex2_user.c                        |   7 +-
 samples/bpf/sockex3_user.c                        |   7 +-
 samples/bpf/spintest_user.c                       |  10 +-
 samples/bpf/tc_l2_redirect_user.c                 |   4 +-
 samples/bpf/test_cgrp2_array_pin.c                |   4 +-
 samples/bpf/test_current_task_under_cgroup_user.c |  10 +-
 samples/bpf/test_maps.c                           | 142 ++++++------
 samples/bpf/test_overhead_user.c                  |   2 +
 samples/bpf/test_probe_write_user_user.c          |   4 +-
 samples/bpf/test_verifier.c                       |   8 +-
 samples/bpf/trace_event_user.c                    |  24 +-
 samples/bpf/trace_output_user.c                   |   6 +-
 samples/bpf/tracex1_user.c                        |   2 +
 samples/bpf/tracex2_user.c                        |  12 +-
 samples/bpf/tracex3_user.c                        |   6 +-
 samples/bpf/tracex4_user.c                        |   6 +-
 samples/bpf/tracex5_user.c                        |   2 +
 samples/bpf/tracex6_user.c                        |   7 +-
 samples/bpf/xdp1_user.c                           |   4 +-
 tools/include/uapi/linux/bpf.h                    |  51 +++++
 tools/lib/bpf/bpf.c                               |   7 +-
 tools/lib/bpf/bpf.h                               |   6 +-
 tools/lib/bpf/libbpf.c                            |   3 +-
 tools/perf/Documentation/perf-sched.txt           |   4 +
 tools/perf/Makefile.perf                          |  94 +-------
 tools/perf/builtin-c2c.c                          |  13 +-
 tools/perf/builtin-mem.c                          |   4 +-
 tools/perf/builtin-record.c                       |   3 +
 tools/perf/builtin-report.c                       |   2 +-
 tools/perf/builtin-sched.c                        | 261 +++++++++++++++++++---
 tools/perf/builtin-stat.c                         |   6 +-
 tools/perf/check-headers.sh                       |  59 +++++
 tools/perf/perf.h                                 |   1 +
 tools/perf/tests/builtin-test.c                   |   4 +
 tools/perf/tests/tests.h                          |   1 +
 tools/perf/tests/thread-map.c                     |  44 ++++
 tools/perf/util/evsel.c                           |  61 ++++-
 tools/perf/util/evsel.h                           |   1 +
 tools/perf/util/symbol-elf.c                      |  25 ++-
 tools/perf/util/symbol.h                          |   1 +
 tools/perf/util/thread_map.c                      |  22 ++
 tools/perf/util/thread_map.h                      |   1 +
 55 files changed, 786 insertions(+), 506 deletions(-)
 delete mode 100644 samples/bpf/libbpf.c
 create mode 100644 samples/bpf/sock_example.h
 create mode 100755 tools/perf/check-headers.sh

  # uname -a
  Linux jouet 4.9.0-rc8+ #1 SMP Mon Dec 12 11:20:49 BRT 2016 x86_64 x86_64 x86_64 GNU/Linux
  # 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: Parse event definition strings             : Ok
   6: PERF_RECORD_* events & perf_sample fields  : Ok
   7: Parse perf pmu format                      : Ok
   8: DSO data read                              : Ok
   9: DSO data cache                             : Ok
  10: DSO data reopen                            : Ok
  11: Roundtrip evsel->name                      : Ok
  12: Parse sched tracepoints fields             : Ok
  13: syscalls:sys_enter_openat event fields     : Ok
  14: Setup struct perf_event_attr               : Ok
  15: Match and link multiple hists              : Ok
  16: 'import perf' in python                    : Ok
  17: Breakpoint overflow signal handler         : Ok
  18: Breakpoint overflow sampling               : Ok
  19: Number of exit events of a simple workload : Ok
  20: Software clock events period values        : Ok
  21: Object code reading                        : Ok
  22: Sample parsing                             : Ok
  23: Use a dummy software event to keep tracking: Ok
  24: Parse with no sample_id_all bit set        : Ok
  25: Filter hist entries                        : Ok
  26: Lookup mmap thread                         : Ok
  27: Share thread mg                            : Ok
  28: Sort output of hist entries                : Ok
  29: Cumulate child hist entries                : Ok
  30: Track with sched_switch                    : Ok
  31: Filter fds with revents mask in a fdarray  : Ok
  32: Add fd to a fdarray, making it autogrow    : Ok
  33: kmod_path__parse                           : Ok
  34: Thread map                                 : Ok
  35: LLVM search and compile                    :
  35.1: Basic BPF llvm compile                    : Ok
  35.2: kbuild searching                          : Ok
  35.3: Compile source for BPF prologue generation: Ok
  35.4: Compile source for BPF relocation         : Ok
  36: Session topology                           : Ok
  37: BPF filter                                 :
  37.1: Basic BPF filtering                      : Ok
  37.2: BPF prologue generation                  : Ok
  37.3: BPF relocation checker                   : Ok
  38: Synthesize thread map                      : Ok
  39: Remove thread map                          : Ok
  40: Synthesize cpu map                         : Ok
  41: Synthesize stat config                     : Ok
  42: Synthesize stat                            : Ok
  43: Synthesize stat round                      : Ok
  44: Synthesize attr update                     : Ok
  45: Event times                                : Ok
  46: Read backward ring buffer                  : Ok
  47: Print cpu map                              : Ok
  48: Probe SDT events                           : Ok
  49: is_printable_array                         : Ok
  50: Print bitmap                               : Ok
  51: perf hooks                                 : Ok
  52: builtin clang support                      : Skip (not compiled in)
  53: x86 rdpmc                                  : Ok
  54: Convert perf time to TSC                   : Ok
  55: DWARF unwind                               : Ok
  56: x86 instruction decoder - new instructions : Ok
  57: Intel cqm nmi context read                 : Skip
  #
  # time dm
     1 alpine:3.4: Ok
     2 android-ndk:r12b-arm: Ok
     3 archlinux:latest: Ok
     4 centos:5: Ok
     5 centos:6: Ok
     6 centos:7: Ok
     7 debian:7: Ok
     8 debian:8: Ok
     9 debian:experimental: Ok
    10 debian:experimental-x-mips64: Ok
    11 fedora:20: Ok
    12 fedora:21: Ok
    13 fedora:22: Ok
    14 fedora:23: Ok
    15 fedora:24: Ok
    16 fedora:24-x-ARC-uClibc: Ok
    17 fedora:25: Ok
    18 fedora:rawhide: Ok
    19 mageia:5: Ok
    20 opensuse:13.2: Ok
    21 opensuse:42.1: Ok
    22 opensuse:tumbleweed: Ok
    23 ubuntu:12.04.5: Ok
    24 ubuntu:14.04.4-x-linaro-arm64: Ok
    25 ubuntu:16.04: Ok
    26 ubuntu:16.04-x-arm: Ok
    27 ubuntu:16.04-x-arm64: Ok
    28 ubuntu:16.04-x-powerpc: Ok
    29 ubuntu:16.04-x-powerpc64: Ok
    30 ubuntu:16.04-x-powerpc64el: Ok
    31 ubuntu:16.04-x-s390: Ok
    32 ubuntu:16.10: Ok
  #
  [acme@felicio linux]$ make -C tools/perf build-test
  make: Entering directory `/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
        make_with_babeltrace_O: make LIBBABELTRACE=1
         make_with_clangllvm_O: make LIBCLANGLLVM=1
                    make_doc_O: make doc
                 make_cscope_O: make cscope
                  make_debug_O: make DEBUG=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                 make_perf_o_O: make perf.o
            make_install_bin_O: make install-bin
                make_no_newt_O: make NO_NEWT=1
               make_no_slang_O: make NO_SLANG=1
              make_clean_all_O: make clean all
                   make_help_O: make help
           make_no_libbionic_O: make NO_LIBBIONIC=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
            make_no_demangle_O: make NO_DEMANGLE=1
              make_no_libelf_O: make NO_LIBELF=1
                   make_pure_O: make
             make_no_libnuma_O: make NO_LIBNUMA=1
              make_no_libbpf_O: make NO_LIBBPF=1
                make_no_gtk2_O: make NO_GTK2=1
           make_no_libpython_O: make NO_LIBPYTHON=1
             make_no_libperl_O: make NO_LIBPERL=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
                 make_static_O: make LDFLAGS=-static
             make_util_map_o_O: make util/map.o
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
         make_install_prefix_O: make install prefix=/tmp/krava
       make_util_pmu_bison_o_O: make util/pmu-bison.o
                   make_tags_O: make tags
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
                make_install_O: make install
            make_no_auxtrace_O: make NO_AUXTRACE=1
           make_no_backtrace_O: make NO_BACKTRACE=1
                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
           make_no_libunwind_O: make NO_LIBUNWIND=1
  OK
  make: Leaving directory `/home/acme/git/linux/tools/perf'
  [acme@felicio linux]$

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 01/22] perf tools: Move headers check into bash script
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 02/22] perf sched timehist: Split is_idle_sample() Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

To make it nicer and easily maintainable.

Also moving the check into fixdep sub make, so its output is not
scattered around the build output.

Removing extra $$ from mman*.h checks.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481030331-31944-5-git-send-email-jolsa@kernel.org
[ Use /bin/sh, and 'function check() {' -> 'check () {' to make it work with busybox, in Alpine Linux, for instance ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf    | 94 +--------------------------------------------
 tools/perf/check-headers.sh | 59 ++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 93 deletions(-)
 create mode 100755 tools/perf/check-headers.sh

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 8f1c258b151a..e9ec531131ca 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -201,6 +201,7 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS))
 $(goals) all: sub-make
 
 sub-make: fixdep
+	@./check-headers.sh
 	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
 
 else # force_fixdep
@@ -404,99 +405,6 @@ export JEVENTS
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): prepare FORCE
-	@(test -f ../../include/uapi/linux/perf_event.h && ( \
-        (diff -B ../include/uapi/linux/perf_event.h ../../include/uapi/linux/perf_event.h >/dev/null) \
-        || echo "Warning: tools/include/uapi/linux/perf_event.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/linux/hash.h && ( \
-        (diff -B ../include/linux/hash.h ../../include/linux/hash.h >/dev/null) \
-        || echo "Warning: tools/include/linux/hash.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/uapi/linux/hw_breakpoint.h && ( \
-        (diff -B ../include/uapi/linux/hw_breakpoint.h ../../include/uapi/linux/hw_breakpoint.h >/dev/null) \
-        || echo "Warning: tools/include/uapi/linux/hw_breakpoint.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/asm/disabled-features.h && ( \
-        (diff -B ../arch/x86/include/asm/disabled-features.h ../../arch/x86/include/asm/disabled-features.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/disabled-features.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/asm/required-features.h && ( \
-        (diff -B ../arch/x86/include/asm/required-features.h ../../arch/x86/include/asm/required-features.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/required-features.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/asm/cpufeatures.h && ( \
-        (diff -B ../arch/x86/include/asm/cpufeatures.h ../../arch/x86/include/asm/cpufeatures.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/lib/memcpy_64.S && ( \
-        (diff -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" ../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memcpy_64.S >/dev/null) \
-        || echo "Warning: tools/arch/x86/lib/memcpy_64.S differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/lib/memset_64.S && ( \
-        (diff -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" ../arch/x86/lib/memset_64.S ../../arch/x86/lib/memset_64.S >/dev/null) \
-        || echo "Warning: tools/arch/x86/lib/memset_64.S differs from kernel" >&2 )) || true
-	@(test -f ../../arch/arm/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/arm/include/uapi/asm/perf_regs.h ../../arch/arm/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/arm/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/arm64/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/arm64/include/uapi/asm/perf_regs.h ../../arch/arm64/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/arm64/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/powerpc/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/powerpc/include/uapi/asm/perf_regs.h ../../arch/powerpc/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/powerpc/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/uapi/asm/perf_regs.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/perf_regs.h ../../arch/x86/include/uapi/asm/perf_regs.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/perf_regs.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/kvm.h ../../arch/x86/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/uapi/asm/kvm_perf.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/kvm_perf.h ../../arch/x86/include/uapi/asm/kvm_perf.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/kvm_perf.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/uapi/asm/svm.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/svm.h ../../arch/x86/include/uapi/asm/svm.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/svm.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/x86/include/uapi/asm/vmx.h && ( \
-        (diff -B ../arch/x86/include/uapi/asm/vmx.h ../../arch/x86/include/uapi/asm/vmx.h >/dev/null) \
-        || echo "Warning: tools/arch/x86/include/uapi/asm/vmx.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/powerpc/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/powerpc/include/uapi/asm/kvm.h ../../arch/powerpc/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/powerpc/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/s390/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/kvm.h ../../arch/s390/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/s390/include/uapi/asm/kvm_perf.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/kvm_perf.h ../../arch/s390/include/uapi/asm/kvm_perf.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/kvm_perf.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/s390/include/uapi/asm/sie.h && ( \
-        (diff -B ../arch/s390/include/uapi/asm/sie.h ../../arch/s390/include/uapi/asm/sie.h >/dev/null) \
-        || echo "Warning: tools/arch/s390/include/uapi/asm/sie.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/arm/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/arm/include/uapi/asm/kvm.h ../../arch/arm/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-	@(test -f ../../arch/arm64/include/uapi/asm/kvm.h && ( \
-        (diff -B ../arch/arm64/include/uapi/asm/kvm.h ../../arch/arm64/include/uapi/asm/kvm.h >/dev/null) \
-        || echo "Warning: tools/arch/arm64/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/asm-generic/bitops/arch_hweight.h && ( \
-        (diff -B ../include/asm-generic/bitops/arch_hweight.h ../../include/asm-generic/bitops/arch_hweight.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/arch_hweight.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/asm-generic/bitops/const_hweight.h && ( \
-        (diff -B ../include/asm-generic/bitops/const_hweight.h ../../include/asm-generic/bitops/const_hweight.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/const_hweight.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/asm-generic/bitops/__fls.h && ( \
-        (diff -B ../include/asm-generic/bitops/__fls.h ../../include/asm-generic/bitops/__fls.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/__fls.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/asm-generic/bitops/fls.h && ( \
-        (diff -B ../include/asm-generic/bitops/fls.h ../../include/asm-generic/bitops/fls.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/fls.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/asm-generic/bitops/fls64.h && ( \
-        (diff -B ../include/asm-generic/bitops/fls64.h ../../include/asm-generic/bitops/fls64.h >/dev/null) \
-        || echo "Warning: tools/include/asm-generic/bitops/fls64.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/linux/coresight-pmu.h && ( \
-	(diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \
-	|| echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/uapi/asm-generic/mman-common.h && ( \
-	(diff -B ../include/uapi/asm-generic/mman-common.h ../../include/uapi/asm-generic/mman-common.h >/dev/null) \
-	|| echo "Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/uapi/asm-generic/mman.h && ( \
-	(diff -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>$$" ../include/uapi/asm-generic/mman.h ../../include/uapi/asm-generic/mman.h >/dev/null) \
-	|| echo "Warning: tools/include/uapi/asm-generic/mman.h differs from kernel" >&2 )) || true
-	@(test -f ../../include/uapi/linux/mman.h && ( \
-	(diff -B -I "^#include <\(uapi/\)*asm/mman.h>$$" ../include/uapi/linux/mman.h ../../include/uapi/linux/mman.h >/dev/null) \
-	|| echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true
 	$(Q)$(MAKE) $(build)=perf
 
 $(JEVENTS_IN): FORCE
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
new file mode 100755
index 000000000000..c747bfd7f14d
--- /dev/null
+++ b/tools/perf/check-headers.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+HEADERS='
+include/uapi/linux/perf_event.h
+include/linux/hash.h
+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/arm/include/uapi/asm/perf_regs.h
+arch/arm64/include/uapi/asm/perf_regs.h
+arch/powerpc/include/uapi/asm/perf_regs.h
+arch/x86/include/uapi/asm/perf_regs.h
+arch/x86/include/uapi/asm/kvm.h
+arch/x86/include/uapi/asm/kvm_perf.h
+arch/x86/include/uapi/asm/svm.h
+arch/x86/include/uapi/asm/vmx.h
+arch/powerpc/include/uapi/asm/kvm.h
+arch/s390/include/uapi/asm/kvm.h
+arch/s390/include/uapi/asm/kvm_perf.h
+arch/s390/include/uapi/asm/sie.h
+arch/arm/include/uapi/asm/kvm.h
+arch/arm64/include/uapi/asm/kvm.h
+include/asm-generic/bitops/arch_hweight.h
+include/asm-generic/bitops/const_hweight.h
+include/asm-generic/bitops/__fls.h
+include/asm-generic/bitops/fls.h
+include/asm-generic/bitops/fls64.h
+include/linux/coresight-pmu.h
+include/uapi/asm-generic/mman-common.h
+'
+
+check () {
+  file=$1
+  opts=
+
+  shift
+  while [ -n "$*" ]; do
+    opts="$opts \"$1\""
+    shift
+  done
+
+  cmd="diff $opts ../$file ../../$file > /dev/null"
+
+  test -f ../../$file &&
+  eval $cmd || echo "Warning: $file differs from kernel" >&2
+}
+
+
+# simple diff check
+for i in $HEADERS; do
+  check $i -B
+done
+
+# diff with extra ignore lines
+check arch/x86/lib/memcpy_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
+check arch/x86/lib/memset_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
+check include/uapi/asm-generic/mman.h -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>"
+check include/uapi/linux/mman.h       -B -I "^#include <\(uapi/\)*asm/mman.h>"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 02/22] perf sched timehist: Split is_idle_sample()
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 01/22] perf tools: Move headers check into bash script Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 03/22] perf sched timehist: Introduce struct idle_time_data Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The is_idle_sample() function actually does more than determining
whether sample come from idle task.  Split the callchain part into
save_task_callchain() to make it clearer.

Also checking prev_pid from trace data looks preferred than just
checking sample->pid since it's possible, although rare, to have invalid
0 pid/tid on scheduling an exiting task.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-2-namhyung@kernel.org
[ Remove some needless () in some return statements ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 1a3f1be93372..966eddce1609 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1939,39 +1939,40 @@ static void timehist_update_runtime_stats(struct thread_runtime *r,
 	r->total_run_time += r->dt_run;
 }
 
-static bool is_idle_sample(struct perf_sched *sched,
-			   struct perf_sample *sample,
-			   struct perf_evsel *evsel,
-			   struct machine *machine)
+static bool is_idle_sample(struct perf_sample *sample,
+			   struct perf_evsel *evsel)
 {
-	struct thread *thread;
-	struct callchain_cursor *cursor = &callchain_cursor;
-
 	/* pid 0 == swapper == idle task */
-	if (sample->pid == 0)
-		return true;
+	if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0)
+		return perf_evsel__intval(evsel, sample, "prev_pid") == 0;
 
-	if (strcmp(perf_evsel__name(evsel), "sched:sched_switch") == 0) {
-		if (perf_evsel__intval(evsel, sample, "prev_pid") == 0)
-			return true;
-	}
+	return sample->pid == 0;
+}
+
+static void save_task_callchain(struct perf_sched *sched,
+				struct perf_sample *sample,
+				struct perf_evsel *evsel,
+				struct machine *machine)
+{
+	struct callchain_cursor *cursor = &callchain_cursor;
+	struct thread *thread;
 
 	/* want main thread for process - has maps */
 	thread = machine__findnew_thread(machine, sample->pid, sample->pid);
 	if (thread == NULL) {
 		pr_debug("Failed to get thread for pid %d.\n", sample->pid);
-		return false;
+		return;
 	}
 
 	if (!symbol_conf.use_callchain || sample->callchain == NULL)
-		return false;
+		return;
 
 	if (thread__resolve_callchain(thread, cursor, evsel, sample,
 				      NULL, NULL, sched->max_stack + 2) != 0) {
 		if (verbose)
 			error("Failed to resolve callchain. Skipping\n");
 
-		return false;
+		return;
 	}
 
 	callchain_cursor_commit(cursor);
@@ -1994,8 +1995,6 @@ static bool is_idle_sample(struct perf_sched *sched,
 
 		callchain_cursor_advance(cursor);
 	}
-
-	return false;
 }
 
 /*
@@ -2111,7 +2110,7 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
 {
 	struct thread *thread;
 
-	if (is_idle_sample(sched, sample, evsel, machine)) {
+	if (is_idle_sample(sample, evsel)) {
 		thread = get_idle_thread(sample->cpu);
 		if (thread == NULL)
 			pr_err("Failed to get idle thread for cpu %d.\n", sample->cpu);
@@ -2124,6 +2123,8 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
 			pr_debug("Failed to get thread for tid %d. skipping sample.\n",
 				 sample->tid);
 		}
+
+		save_task_callchain(sched, sample, evsel, machine);
 	}
 
 	return thread;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 03/22] perf sched timehist: Introduce struct idle_time_data
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 01/22] perf tools: Move headers check into bash script Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 02/22] perf sched timehist: Split is_idle_sample() Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 04/22] perf sched timehist: Save callchain when entering idle Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The struct idle_time_data is to keep idle stats with callchains entering
to the idle task.  The normal thread_runtime calculation is done
transparently since it extends the struct thread_runtime.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-3-namhyung@kernel.org
[ Align struct field names ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 966eddce1609..e108b0f6a246 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -230,6 +230,15 @@ struct evsel_runtime {
 	u32 ncpu;       /* highest cpu slot allocated */
 };
 
+/* per cpu idle time data */
+struct idle_thread_runtime {
+	struct thread_runtime	tr;
+	struct thread		*last_thread;
+	struct rb_root		sorted_root;
+	struct callchain_root	callchain;
+	struct callchain_cursor	cursor;
+};
+
 /* track idle times per cpu */
 static struct thread **idle_threads;
 static int idle_max_cpu;
@@ -1997,13 +2006,31 @@ static void save_task_callchain(struct perf_sched *sched,
 	}
 }
 
+static int init_idle_thread(struct thread *thread)
+{
+	struct idle_thread_runtime *itr;
+
+	thread__set_comm(thread, idle_comm, 0);
+
+	itr = zalloc(sizeof(*itr));
+	if (itr == NULL)
+		return -ENOMEM;
+
+	init_stats(&itr->tr.run_stats);
+	callchain_init(&itr->callchain);
+	callchain_cursor_reset(&itr->cursor);
+	thread__set_priv(thread, itr);
+
+	return 0;
+}
+
 /*
  * Track idle stats per cpu by maintaining a local thread
  * struct for the idle task on each cpu.
  */
 static int init_idle_threads(int ncpu)
 {
-	int i;
+	int i, ret;
 
 	idle_threads = zalloc(ncpu * sizeof(struct thread *));
 	if (!idle_threads)
@@ -2017,7 +2044,9 @@ static int init_idle_threads(int ncpu)
 		if (idle_threads[i] == NULL)
 			return -ENOMEM;
 
-		thread__set_comm(idle_threads[i], idle_comm, 0);
+		ret = init_idle_thread(idle_threads[i]);
+		if (ret < 0)
+			return ret;
 	}
 
 	return 0;
@@ -2064,8 +2093,8 @@ static struct thread *get_idle_thread(int cpu)
 		idle_threads[cpu] = thread__new(0, 0);
 
 		if (idle_threads[cpu]) {
-			idle_threads[cpu]->tid = 0;
-			thread__set_comm(idle_threads[cpu], idle_comm, 0);
+			if (init_idle_thread(idle_threads[cpu]) < 0)
+				return NULL;
 		}
 	}
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 04/22] perf sched timehist: Save callchain when entering idle
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 03/22] perf sched timehist: Introduce struct idle_time_data Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 05/22] perf sched timehist: Skip non-idle events when necessary Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

In order to investigate the idleness reason, it is necessary to keep the
callchains when entering idle.  This can be identified by the
sched:sched_switch event having the next_pid field as 0.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-4-namhyung@kernel.org
Link: http://lkml.kernel.org/r/20161213080632.19099-1-namhyung@kernel.org
[ Merged fix from Namhyung, see second Link: tag ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e108b0f6a246..dc83b803ca54 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -200,6 +200,7 @@ struct perf_sched {
 	/* options for timehist command */
 	bool		summary;
 	bool		summary_only;
+	bool		idle_hist;
 	bool		show_callchain;
 	unsigned int	max_stack;
 	bool		show_cpu_visual;
@@ -2101,6 +2102,15 @@ static struct thread *get_idle_thread(int cpu)
 	return idle_threads[cpu];
 }
 
+static void save_idle_callchain(struct idle_thread_runtime *itr,
+				struct perf_sample *sample)
+{
+	if (!symbol_conf.use_callchain || sample->callchain == NULL)
+		return;
+
+	callchain_cursor__copy(&itr->cursor, &callchain_cursor);
+}
+
 /*
  * handle runtime stats saved per thread
  */
@@ -2154,6 +2164,26 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
 		}
 
 		save_task_callchain(sched, sample, evsel, machine);
+		if (sched->idle_hist) {
+			struct thread *idle;
+			struct idle_thread_runtime *itr;
+
+			idle = get_idle_thread(sample->cpu);
+			if (idle == NULL) {
+				pr_err("Failed to get idle thread for cpu %d.\n", sample->cpu);
+				return NULL;
+			}
+
+			itr = thread__priv(idle);
+			if (itr == NULL)
+				return NULL;
+
+			itr->last_thread = thread;
+
+			/* copy task callchain when entering to idle */
+			if (perf_evsel__intval(evsel, sample, "next_pid") == 0)
+				save_idle_callchain(itr, sample);
+		}
 	}
 
 	return thread;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 05/22] perf sched timehist: Skip non-idle events when necessary
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 04/22] perf sched timehist: Save callchain when entering idle Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 06/22] perf sched timehist: Add -I/--idle-hist option Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Sometimes it only focuses on idle-related events like upcoming idle-hist
feature.  In this case we don't want to see other event to reduce noise.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index dc83b803ca54..c8e7848e71a7 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2190,7 +2190,9 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
 }
 
 static bool timehist_skip_sample(struct perf_sched *sched,
-				 struct thread *thread)
+				 struct thread *thread,
+				 struct perf_evsel *evsel,
+				 struct perf_sample *sample)
 {
 	bool rc = false;
 
@@ -2199,10 +2201,19 @@ static bool timehist_skip_sample(struct perf_sched *sched,
 		sched->skipped_samples++;
 	}
 
+	if (sched->idle_hist) {
+		if (strcmp(perf_evsel__name(evsel), "sched:sched_switch"))
+			rc = true;
+		else if (perf_evsel__intval(evsel, sample, "prev_pid") != 0 &&
+			 perf_evsel__intval(evsel, sample, "next_pid") != 0)
+			rc = true;
+	}
+
 	return rc;
 }
 
 static void timehist_print_wakeup_event(struct perf_sched *sched,
+					struct perf_evsel *evsel,
 					struct perf_sample *sample,
 					struct machine *machine,
 					struct thread *awakened)
@@ -2215,8 +2226,8 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,
 		return;
 
 	/* show wakeup unless both awakee and awaker are filtered */
-	if (timehist_skip_sample(sched, thread) &&
-	    timehist_skip_sample(sched, awakened)) {
+	if (timehist_skip_sample(sched, thread, evsel, sample) &&
+	    timehist_skip_sample(sched, awakened, evsel, sample)) {
 		return;
 	}
 
@@ -2261,7 +2272,7 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
 	/* show wakeups if requested */
 	if (sched->show_wakeups &&
 	    !perf_time__skip_sample(&sched->ptime, sample->time))
-		timehist_print_wakeup_event(sched, sample, machine, thread);
+		timehist_print_wakeup_event(sched, evsel, sample, machine, thread);
 
 	return 0;
 }
@@ -2288,8 +2299,8 @@ static void timehist_print_migration_event(struct perf_sched *sched,
 	if (thread == NULL)
 		return;
 
-	if (timehist_skip_sample(sched, thread) &&
-	    timehist_skip_sample(sched, migrated)) {
+	if (timehist_skip_sample(sched, thread, evsel, sample) &&
+	    timehist_skip_sample(sched, migrated, evsel, sample)) {
 		return;
 	}
 
@@ -2374,7 +2385,7 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 		goto out;
 	}
 
-	if (timehist_skip_sample(sched, thread))
+	if (timehist_skip_sample(sched, thread, evsel, sample))
 		goto out;
 
 	tr = thread__get_runtime(thread);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 06/22] perf sched timehist: Add -I/--idle-hist option
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 05/22] perf sched timehist: Skip non-idle events when necessary Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 07/22] perf sched timehist: Show callchains for idle stat Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The --idle-hist option is to analyze system idle state so which process
makes cpu to go idle.  If this option is specified, non-idle events will
be skipped and processes switching to/from idle will be shown.

This option is mostly useful when used with --summary(-only) option.  In
the idle-time summary view, idle time is accounted to previous thread
which is run before idle task.

The example output looks like following:

  Idle-time summary
                  comm parent sched-out idle-time min-idle avg-idle max-idle stddev migrations
                                (count)    (msec)   (msec)   (msec)   (msec)      %
  --------------------------------------------------------------------------------------------
        rcu_preempt[7]      2        95   550.872    0.011    5.798   23.146   7.63      0
       migration/1[16]      2         1    15.558   15.558   15.558   15.558   0.00      0
        khugepaged[39]      2         1     3.062    3.062    3.062    3.062   0.00      0
     kworker/0:1H[124]      2         2     4.728    0.611    2.364    4.116  74.12      0
  systemd-journal[167]      1         1     4.510    4.510    4.510    4.510   0.00      0
    kworker/u16:3[558]      2        13    74.737    0.080    5.749   12.960  21.96      0
   irq/34-iwlwifi[628]      2        21   118.403    0.032    5.638   23.990  24.00      0
    kworker/u17:0[673]      2         1     3.523    3.523    3.523    3.523   0.00      0
      dbus-daemon[722]      1         1     6.743    6.743    6.743    6.743   0.00      0
          ifplugd[741]      1         1    58.826   58.826   58.826   58.826   0.00      0
  wpa_supplicant[1490]      1         1    13.302   13.302   13.302   13.302   0.00      0
     wpa_actiond[1492]      1         2     4.064    0.168    2.032    3.896  91.72      0
         dockerd[1500]      1         1     0.055    0.055    0.055    0.055   0.00      0
  ...

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-6-namhyung@kernel.org
Link: http://lkml.kernel.org/r/20161213080632.19099-2-namhyung@kernel.org
[ Merged fix sent by Namhyumg, as posted in the second Link: tag ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-sched.txt |  4 +++
 tools/perf/builtin-sched.c              | 46 +++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 7775b1eb2bee..76173969ab80 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -132,6 +132,10 @@ OPTIONS for 'perf sched timehist'
 --migrations::
 	Show migration events.
 
+-I::
+--idle-hist::
+	Show idle-related events only.
+
 --time::
 	Only analyze samples within given time window: <start>,<stop>. Times
 	have the format seconds.microseconds. If start is not given (i.e., time
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index c8e7848e71a7..0b14265432df 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2421,7 +2421,36 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 			t = ptime->end;
 	}
 
-	timehist_update_runtime_stats(tr, t, tprev);
+	if (!sched->idle_hist || thread->tid == 0) {
+		timehist_update_runtime_stats(tr, t, tprev);
+
+		if (sched->idle_hist) {
+			struct idle_thread_runtime *itr = (void *)tr;
+			struct thread_runtime *last_tr;
+
+			BUG_ON(thread->tid != 0);
+
+			if (itr->last_thread == NULL)
+				goto out;
+
+			/* add current idle time as last thread's runtime */
+			last_tr = thread__get_runtime(itr->last_thread);
+			if (last_tr == NULL)
+				goto out;
+
+			timehist_update_runtime_stats(last_tr, t, tprev);
+			/*
+			 * remove delta time of last thread as it's not updated
+			 * and otherwise it will show an invalid value next
+			 * time.  we only care total run time and run stat.
+			 */
+			last_tr->dt_run = 0;
+			last_tr->dt_wait = 0;
+			last_tr->dt_delay = 0;
+
+			itr->last_thread = NULL;
+		}
+	}
 
 	if (!sched->summary_only)
 		timehist_print_sample(sched, sample, &al, thread, t);
@@ -2543,9 +2572,15 @@ static void timehist_print_summary(struct perf_sched *sched,
 	if (comm_width < 30)
 		comm_width = 30;
 
-	printf("\nRuntime summary\n");
-	printf("%*s  parent   sched-in  ", comm_width, "comm");
-	printf("   run-time    min-run     avg-run     max-run  stddev  migrations\n");
+	if (sched->idle_hist) {
+		printf("\nIdle-time summary\n");
+		printf("%*s  parent  sched-out  ", comm_width, "comm");
+		printf("  idle-time   min-idle    avg-idle    max-idle  stddev  migrations\n");
+	} else {
+		printf("\nRuntime summary\n");
+		printf("%*s  parent   sched-in  ", comm_width, "comm");
+		printf("   run-time    min-run     avg-run     max-run  stddev  migrations\n");
+	}
 	printf("%*s            (count)  ", comm_width, "");
 	printf("     (msec)     (msec)      (msec)      (msec)       %%\n");
 	printf("%.117s\n", graph_dotted_line);
@@ -2561,7 +2596,7 @@ static void timehist_print_summary(struct perf_sched *sched,
 		printf("<no terminated tasks>\n");
 
 	/* CPU idle stats not tracked when samples were skipped */
-	if (sched->skipped_samples)
+	if (sched->skipped_samples && !sched->idle_hist)
 		return;
 
 	printf("\nIdle stats:\n");
@@ -3107,6 +3142,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN('w', "wakeups", &sched.show_wakeups, "Show wakeup events"),
 	OPT_BOOLEAN('M', "migrations", &sched.show_migrations, "Show migration events"),
 	OPT_BOOLEAN('V', "cpu-visual", &sched.show_cpu_visual, "Add CPU visual"),
+	OPT_BOOLEAN('I', "idle-hist", &sched.idle_hist, "Show idle events only"),
 	OPT_STRING(0, "time", &sched.time_str, "str",
 		   "Time span for analysis (start,stop)"),
 	OPT_PARENT(sched_options)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 07/22] perf sched timehist: Show callchains for idle stat
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 06/22] perf sched timehist: Add -I/--idle-hist option Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 08/22] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Andi Kleen, Jiri Olsa, Minchan Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

When --idle-hist option is used with --summary, it now shows idle stats
with callchains like below:

  Idle stats by callchain:
  CPU  0:   902.195 msec
  Idle time (msec)    Count Callchains
  ----------------  ------- --------------------------------------------------
           370.589       69 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- entry_SYSCALL_64_fastpath
           178.799       17 worker_thread <- kthread <- ret_from_fork
           128.352       17 schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
           125.111       19 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_select <- core_sys_select
            71.599       50 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_poll
            23.146        1 rcu_gp_kthread <- kthread <- ret_from_fork
             4.510        1 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- do_syscall_64
             0.085        1 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- do_restart_poll
  ...

Committer notes:

Extra testing:

  # uname -a
  Linux jouet 4.8.8-300.fc25.x86_64 #1 SMP Tue Nov 15 18:10:06 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

1) Run 'perf sched record -g'

2) Run 'perf sched timehist --idle --summary'

<SNIP>
  Idle stats by callchain:
  CPU  0: 13456.840 msec
  Idle time (msec) Count Callchains
  ---------------- ----- --------------------------------------------------
          5386.637  3283 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_poll
          2750.238  2299 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- do_syscall_64
          1275.672  1287 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- entry_SYSCALL_64_fastpath
           936.322   452 worker_thread <- kthread <- ret_from_fork
           741.311   385 rcu_nocb_kthread <- kthread <- ret_from_fork
           729.385   248 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_sys_poll <- sys_ppoll
           365.386   229 irq_thread <- kthread <- ret_from_fork
           338.934   265 futex_wait_queue_me <- futex_wait <- do_futex <- sys_futex <- entry_SYSCALL_64_fastpath
           219.488   201 schedule_timeout <- rcu_gp_kthread <- kthread <- ret_from_fork
           186.839   410 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- ep_poll <- sys_epoll_wait <- do_syscall_64
           142.541    59 kvm_vcpu_block <- kvm_arch_vcpu_ioctl_run <- kvm_vcpu_ioctl <- do_vfs_ioctl <- sys_ioctl
            83.887    92 smpboot_thread_fn <- kthread <- ret_from_fork
            62.722    96 do_exit <- do_group_exit <- 0x2a5594 <- entry_SYSCALL_64_fastpath
            47.894    83 pipe_wait <- pipe_read <- __vfs_read <- vfs_read <- sys_read
            46.554    61 rcu_gp_kthread <- kthread <- ret_from_fork
            34.337    21 schedule_timeout <- intel_fbc_work_fn <- process_one_work <- worker_thread <- kthread
            29.521    14 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_timeout <- do_select <- core_sys_select
            20.274    10 schedule_timeout <- io_schedule_timeout <- bit_wait_io <- __wait_on_bit <- out_of_line_wait_on_bit
            15.085    55 schedule_timeout <- unix_stream_read_generic <- unix_stream_recvmsg <- sock_recvmsg <- SYSC_recvfrom
<SNIP>

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161208144755.16673-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0b14265432df..c1c07bfe132c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2448,6 +2448,9 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 			last_tr->dt_wait = 0;
 			last_tr->dt_delay = 0;
 
+			if (itr->cursor.nr)
+				callchain_append(&itr->callchain, &itr->cursor, t - tprev);
+
 			itr->last_thread = NULL;
 		}
 	}
@@ -2557,6 +2560,60 @@ static int show_deadthread_runtime(struct thread *t, void *priv)
 	return __show_thread_runtime(t, priv);
 }
 
+static size_t callchain__fprintf_folded(FILE *fp, struct callchain_node *node)
+{
+	const char *sep = " <- ";
+	struct callchain_list *chain;
+	size_t ret = 0;
+	char bf[1024];
+	bool first;
+
+	if (node == NULL)
+		return 0;
+
+	ret = callchain__fprintf_folded(fp, node->parent);
+	first = (ret == 0);
+
+	list_for_each_entry(chain, &node->val, list) {
+		if (chain->ip >= PERF_CONTEXT_MAX)
+			continue;
+		if (chain->ms.sym && chain->ms.sym->ignore)
+			continue;
+		ret += fprintf(fp, "%s%s", first ? "" : sep,
+			       callchain_list__sym_name(chain, bf, sizeof(bf),
+							false));
+		first = false;
+	}
+
+	return ret;
+}
+
+static size_t timehist_print_idlehist_callchain(struct rb_root *root)
+{
+	size_t ret = 0;
+	FILE *fp = stdout;
+	struct callchain_node *chain;
+	struct rb_node *rb_node = rb_first(root);
+
+	printf("  %16s  %8s  %s\n", "Idle time (msec)", "Count", "Callchains");
+	printf("  %.16s  %.8s  %.50s\n", graph_dotted_line, graph_dotted_line,
+	       graph_dotted_line);
+
+	while (rb_node) {
+		chain = rb_entry(rb_node, struct callchain_node, rb_node);
+		rb_node = rb_next(rb_node);
+
+		ret += fprintf(fp, "  ");
+		print_sched_time(chain->hit, 12);
+		ret += 16;  /* print_sched_time returns 2nd arg + 4 */
+		ret += fprintf(fp, " %8d  ", chain->count);
+		ret += callchain__fprintf_folded(fp, chain);
+		ret += fprintf(fp, "\n");
+	}
+
+	return ret;
+}
+
 static void timehist_print_summary(struct perf_sched *sched,
 				   struct perf_session *session)
 {
@@ -2615,6 +2672,35 @@ static void timehist_print_summary(struct perf_sched *sched,
 			printf("    CPU %2d idle entire time window\n", i);
 	}
 
+	if (sched->idle_hist && symbol_conf.use_callchain) {
+		callchain_param.mode  = CHAIN_FOLDED;
+		callchain_param.value = CCVAL_PERIOD;
+
+		callchain_register_param(&callchain_param);
+
+		printf("\nIdle stats by callchain:\n");
+		for (i = 0; i < idle_max_cpu; ++i) {
+			struct idle_thread_runtime *itr;
+
+			t = idle_threads[i];
+			if (!t)
+				continue;
+
+			itr = thread__priv(t);
+			if (itr == NULL)
+				continue;
+
+			callchain_param.sort(&itr->sorted_root, &itr->callchain,
+					     0, &callchain_param);
+
+			printf("  CPU %2d:", i);
+			print_sched_time(itr->tr.total_run_time, 6);
+			printf(" msec\n");
+			timehist_print_idlehist_callchain(&itr->sorted_root);
+			printf("\n");
+		}
+	}
+
 	printf("\n"
 	       "    Total number of unique tasks: %" PRIu64 "\n"
 	       "Total number of context switches: %" PRIu64 "\n"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 08/22] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 07/22] perf sched timehist: Show callchains for idle stat Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 09/22] tools lib bpf: use __u32 from linux/types.h Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

The tools version of this header is out of date; update it to the latest
version from the kernel headers.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Link: http://lkml.kernel.org/r/20161209024620.31660-2-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/uapi/linux/bpf.h | 51 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 9e5fc168c8a3..f09c70b97eca 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -95,6 +95,7 @@ enum bpf_prog_type {
 	BPF_PROG_TYPE_SCHED_ACT,
 	BPF_PROG_TYPE_TRACEPOINT,
 	BPF_PROG_TYPE_XDP,
+	BPF_PROG_TYPE_PERF_EVENT,
 };
 
 #define BPF_PSEUDO_MAP_FD	1
@@ -375,6 +376,56 @@ enum bpf_func_id {
 	 */
 	BPF_FUNC_probe_write_user,
 
+	/**
+	 * bpf_current_task_under_cgroup(map, index) - Check cgroup2 membership of current task
+	 * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type
+	 * @index: index of the cgroup in the bpf_map
+	 * Return:
+	 *   == 0 current failed the cgroup2 descendant test
+	 *   == 1 current succeeded the cgroup2 descendant test
+	 *    < 0 error
+	 */
+	BPF_FUNC_current_task_under_cgroup,
+
+	/**
+	 * bpf_skb_change_tail(skb, len, flags)
+	 * The helper will resize the skb to the given new size,
+	 * to be used f.e. with control messages.
+	 * @skb: pointer to skb
+	 * @len: new skb length
+	 * @flags: reserved
+	 * Return: 0 on success or negative error
+	 */
+	BPF_FUNC_skb_change_tail,
+
+	/**
+	 * bpf_skb_pull_data(skb, len)
+	 * The helper will pull in non-linear data in case the
+	 * skb is non-linear and not all of len are part of the
+	 * linear section. Only needed for read/write with direct
+	 * packet access.
+	 * @skb: pointer to skb
+	 * @len: len to make read/writeable
+	 * Return: 0 on success or negative error
+	 */
+	BPF_FUNC_skb_pull_data,
+
+	/**
+	 * bpf_csum_update(skb, csum)
+	 * Adds csum into skb->csum in case of CHECKSUM_COMPLETE.
+	 * @skb: pointer to skb
+	 * @csum: csum to add
+	 * Return: csum on success or negative error
+	 */
+	BPF_FUNC_csum_update,
+
+	/**
+	 * bpf_set_hash_invalid(skb)
+	 * Invalidate current skb>hash.
+	 * @skb: pointer to skb
+	 */
+	BPF_FUNC_set_hash_invalid,
+
 	__BPF_FUNC_MAX_ID,
 };
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 09/22] tools lib bpf: use __u32 from linux/types.h
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 08/22] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 10/22] tools lib bpf: Add flags to bpf_create_map() Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

Fixes the following issue when building without access to 'u32' type:

./tools/lib/bpf/bpf.h:27:23: error: unknown type name ‘u32’

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Link: http://lkml.kernel.org/r/20161209024620.31660-3-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/bpf/bpf.c | 4 ++--
 tools/lib/bpf/bpf.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 8143536b462a..89e8e8e5b60e 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -70,7 +70,7 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size,
 
 int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
 		     size_t insns_cnt, char *license,
-		     u32 kern_version, char *log_buf, size_t log_buf_sz)
+		     __u32 kern_version, char *log_buf, size_t log_buf_sz)
 {
 	int fd;
 	union bpf_attr attr;
@@ -98,7 +98,7 @@ int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
 }
 
 int bpf_map_update_elem(int fd, void *key, void *value,
-			u64 flags)
+			__u64 flags)
 {
 	union bpf_attr attr;
 
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 253c3dbb06b4..61130170a6ad 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -30,11 +30,11 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
 #define BPF_LOG_BUF_SIZE 65536
 int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
 		     size_t insns_cnt, char *license,
-		     u32 kern_version, char *log_buf,
+		     __u32 kern_version, char *log_buf,
 		     size_t log_buf_sz);
 
 int bpf_map_update_elem(int fd, void *key, void *value,
-			u64 flags);
+			__u64 flags);
 
 int bpf_map_lookup_elem(int fd, void *key, void *value);
 int bpf_map_delete_elem(int fd, void *key);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 10/22] tools lib bpf: Add flags to bpf_create_map()
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 09/22] tools lib bpf: use __u32 from linux/types.h Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 11/22] samples/bpf: Make samples more libbpf-centric Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

Commit 6c905981743 ("bpf: pre-allocate hash map elements") introduces
map_flags to bpf_attr for BPF_MAP_CREATE command. Expose this new
parameter in libbpf.

By exposing it, users can access flags such as whether or not to
preallocate the map.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Link: http://lkml.kernel.org/r/20161209024620.31660-4-joe@ovn.org
[ Added clarifying comment made by Wang Nan ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/bpf/bpf.c    | 3 ++-
 tools/lib/bpf/bpf.h    | 2 +-
 tools/lib/bpf/libbpf.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 89e8e8e5b60e..d0afb26c2e0f 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -54,7 +54,7 @@ static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
 }
 
 int bpf_create_map(enum bpf_map_type map_type, int key_size,
-		   int value_size, int max_entries)
+		   int value_size, int max_entries, __u32 map_flags)
 {
 	union bpf_attr attr;
 
@@ -64,6 +64,7 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size,
 	attr.key_size = key_size;
 	attr.value_size = value_size;
 	attr.max_entries = max_entries;
+	attr.map_flags = map_flags;
 
 	return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
 }
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 61130170a6ad..7fcdce16fd62 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -24,7 +24,7 @@
 #include <linux/bpf.h>
 
 int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-		   int max_entries);
+		   int max_entries, __u32 map_flags);
 
 /* Recommend log buffer size */
 #define BPF_LOG_BUF_SIZE 65536
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 2e974593f3e8..84e6b35da4bd 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -854,7 +854,8 @@ bpf_object__create_maps(struct bpf_object *obj)
 		*pfd = bpf_create_map(def->type,
 				      def->key_size,
 				      def->value_size,
-				      def->max_entries);
+				      def->max_entries,
+				      0);
 		if (*pfd < 0) {
 			size_t j;
 			int err = *pfd;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 11/22] samples/bpf: Make samples more libbpf-centric
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 10/22] tools lib bpf: Add flags to bpf_create_map() Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 12/22] samples/bpf: Switch over to libbpf Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Wang Nan, Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

Switch all of the sample code to use the function names from
tools/lib/bpf so that they're consistent with that, and to declare their
own log buffers. This allow the next commit to be purely devoted to
getting rid of the duplicate library in samples/bpf.

Signed-off-by: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161209024620.31660-5-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 samples/bpf/bpf_load.c                            |  17 ++-
 samples/bpf/fds_example.c                         |   9 +-
 samples/bpf/lathist_user.c                        |   3 +-
 samples/bpf/libbpf.c                              |  23 ++--
 samples/bpf/libbpf.h                              |  18 +--
 samples/bpf/map_perf_test_user.c                  |   1 +
 samples/bpf/offwaketime_user.c                    |  10 +-
 samples/bpf/sampleip_user.c                       |   5 +-
 samples/bpf/sock_example.c                        |  10 +-
 samples/bpf/sockex1_user.c                        |   8 +-
 samples/bpf/sockex2_user.c                        |   6 +-
 samples/bpf/sockex3_user.c                        |   6 +-
 samples/bpf/spintest_user.c                       |  10 +-
 samples/bpf/tc_l2_redirect_user.c                 |   4 +-
 samples/bpf/test_cgrp2_array_pin.c                |   4 +-
 samples/bpf/test_current_task_under_cgroup_user.c |  10 +-
 samples/bpf/test_maps.c                           | 142 +++++++++++-----------
 samples/bpf/test_overhead_user.c                  |   2 +
 samples/bpf/test_probe_write_user_user.c          |   4 +-
 samples/bpf/test_verifier.c                       |   8 +-
 samples/bpf/trace_event_user.c                    |  15 +--
 samples/bpf/trace_output_user.c                   |   3 +-
 samples/bpf/tracex1_user.c                        |   2 +
 samples/bpf/tracex2_user.c                        |  12 +-
 samples/bpf/tracex3_user.c                        |   6 +-
 samples/bpf/tracex4_user.c                        |   6 +-
 samples/bpf/tracex5_user.c                        |   2 +
 samples/bpf/tracex6_user.c                        |   4 +-
 samples/bpf/xdp1_user.c                           |   4 +-
 29 files changed, 200 insertions(+), 154 deletions(-)

diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index 97913e109b14..f8e3c58a0897 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -18,7 +18,6 @@
 #include <poll.h>
 #include <ctype.h>
 #include "libbpf.h"
-#include "bpf_helpers.h"
 #include "bpf_load.h"
 
 #define DEBUGFS "/sys/kernel/debug/tracing/"
@@ -26,17 +25,26 @@
 static char license[128];
 static int kern_version;
 static bool processed_sec[128];
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 int map_fd[MAX_MAPS];
 int prog_fd[MAX_PROGS];
 int event_fd[MAX_PROGS];
 int prog_cnt;
 int prog_array_fd = -1;
 
+struct bpf_map_def {
+	unsigned int type;
+	unsigned int key_size;
+	unsigned int value_size;
+	unsigned int max_entries;
+	unsigned int map_flags;
+};
+
 static int populate_prog_array(const char *event, int prog_fd)
 {
 	int ind = atoi(event), err;
 
-	err = bpf_update_elem(prog_array_fd, &ind, &prog_fd, BPF_ANY);
+	err = bpf_map_update_elem(prog_array_fd, &ind, &prog_fd, BPF_ANY);
 	if (err < 0) {
 		printf("failed to store prog_fd in prog_array\n");
 		return -1;
@@ -77,9 +85,10 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
 		return -1;
 	}
 
-	fd = bpf_prog_load(prog_type, prog, size, license, kern_version);
+	fd = bpf_load_program(prog_type, prog, size, license, kern_version,
+			      NULL, 0);
 	if (fd < 0) {
-		printf("bpf_prog_load() err=%d\n%s", errno, bpf_log_buf);
+		printf("bpf_load_program() err=%d\n%s", errno, bpf_log_buf);
 		return -1;
 	}
 
diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c
index 625e797be6ef..4ffd8f340496 100644
--- a/samples/bpf/fds_example.c
+++ b/samples/bpf/fds_example.c
@@ -58,8 +58,9 @@ static int bpf_prog_create(const char *object)
 		assert(!load_bpf_file((char *)object));
 		return prog_fd[0];
 	} else {
-		return bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER,
-				     insns, sizeof(insns), "GPL", 0);
+		return bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER,
+					insns, sizeof(insns), "GPL", 0, NULL,
+					0);
 	}
 }
 
@@ -83,12 +84,12 @@ static int bpf_do_map(const char *file, uint32_t flags, uint32_t key,
 	}
 
 	if ((flags & BPF_F_KEY_VAL) == BPF_F_KEY_VAL) {
-		ret = bpf_update_elem(fd, &key, &value, 0);
+		ret = bpf_map_update_elem(fd, &key, &value, 0);
 		printf("bpf: fd:%d u->(%u:%u) ret:(%d,%s)\n", fd, key, value,
 		       ret, strerror(errno));
 		assert(ret == 0);
 	} else if (flags & BPF_F_KEY) {
-		ret = bpf_lookup_elem(fd, &key, &value);
+		ret = bpf_map_lookup_elem(fd, &key, &value);
 		printf("bpf: fd:%d l->(%u):%u ret:(%d,%s)\n", fd, key, value,
 		       ret, strerror(errno));
 		assert(ret == 0);
diff --git a/samples/bpf/lathist_user.c b/samples/bpf/lathist_user.c
index 65da8c1576de..bcdee00816b2 100644
--- a/samples/bpf/lathist_user.c
+++ b/samples/bpf/lathist_user.c
@@ -23,6 +23,7 @@ struct cpu_hist {
 };
 
 static struct cpu_hist cpu_hist[MAX_CPU];
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 static void stars(char *str, long val, long max, int width)
 {
@@ -73,7 +74,7 @@ static void get_data(int fd)
 	for (c = 0; c < MAX_CPU; c++) {
 		for (i = 0; i < MAX_ENTRIES; i++) {
 			key = c * MAX_ENTRIES + i;
-			bpf_lookup_elem(fd, &key, &value);
+			bpf_map_lookup_elem(fd, &key, &value);
 
 			cpu_hist[c].data[i] = value;
 			if (value > cpu_hist[c].max)
diff --git a/samples/bpf/libbpf.c b/samples/bpf/libbpf.c
index 9969e35550c3..e5c5a69996fc 100644
--- a/samples/bpf/libbpf.c
+++ b/samples/bpf/libbpf.c
@@ -32,7 +32,7 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
 	return syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr));
 }
 
-int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags)
+int bpf_map_update_elem(int fd, void *key, void *value, unsigned long long flags)
 {
 	union bpf_attr attr = {
 		.map_fd = fd,
@@ -44,7 +44,7 @@ int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags)
 	return syscall(__NR_bpf, BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
 }
 
-int bpf_lookup_elem(int fd, void *key, void *value)
+int bpf_map_lookup_elem(int fd, void *key, void *value)
 {
 	union bpf_attr attr = {
 		.map_fd = fd,
@@ -55,7 +55,7 @@ int bpf_lookup_elem(int fd, void *key, void *value)
 	return syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
 }
 
-int bpf_delete_elem(int fd, void *key)
+int bpf_map_delete_elem(int fd, void *key)
 {
 	union bpf_attr attr = {
 		.map_fd = fd,
@@ -65,7 +65,7 @@ int bpf_delete_elem(int fd, void *key)
 	return syscall(__NR_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
 }
 
-int bpf_get_next_key(int fd, void *key, void *next_key)
+int bpf_map_get_next_key(int fd, void *key, void *next_key)
 {
 	union bpf_attr attr = {
 		.map_fd = fd,
@@ -78,19 +78,18 @@ int bpf_get_next_key(int fd, void *key, void *next_key)
 
 #define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u))
 
-char bpf_log_buf[LOG_BUF_SIZE];
-
-int bpf_prog_load(enum bpf_prog_type prog_type,
-		  const struct bpf_insn *insns, int prog_len,
-		  const char *license, int kern_version)
+int bpf_load_program(enum bpf_prog_type prog_type,
+		     const struct bpf_insn *insns, int prog_len,
+		     const char *license, int kern_version,
+		     char *log_buf, size_t log_buf_sz)
 {
 	union bpf_attr attr = {
 		.prog_type = prog_type,
 		.insns = ptr_to_u64((void *) insns),
 		.insn_cnt = prog_len / sizeof(struct bpf_insn),
 		.license = ptr_to_u64((void *) license),
-		.log_buf = ptr_to_u64(bpf_log_buf),
-		.log_size = LOG_BUF_SIZE,
+		.log_buf = ptr_to_u64(log_buf),
+		.log_size = log_buf_sz,
 		.log_level = 1,
 	};
 
@@ -99,7 +98,7 @@ int bpf_prog_load(enum bpf_prog_type prog_type,
 	 */
 	attr.kern_version = kern_version;
 
-	bpf_log_buf[0] = 0;
+	log_buf[0] = 0;
 
 	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
 }
diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h
index ac6edb61b64a..1325152be4cd 100644
--- a/samples/bpf/libbpf.h
+++ b/samples/bpf/libbpf.h
@@ -6,20 +6,20 @@ struct bpf_insn;
 
 int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
 		   int max_entries, int map_flags);
-int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags);
-int bpf_lookup_elem(int fd, void *key, void *value);
-int bpf_delete_elem(int fd, void *key);
-int bpf_get_next_key(int fd, void *key, void *next_key);
+int bpf_map_update_elem(int fd, void *key, void *value, unsigned long long flags);
+int bpf_map_lookup_elem(int fd, void *key, void *value);
+int bpf_map_delete_elem(int fd, void *key);
+int bpf_map_get_next_key(int fd, void *key, void *next_key);
 
-int bpf_prog_load(enum bpf_prog_type prog_type,
-		  const struct bpf_insn *insns, int insn_len,
-		  const char *license, int kern_version);
+int bpf_load_program(enum bpf_prog_type prog_type,
+		     const struct bpf_insn *insns, int insn_len,
+		     const char *license, int kern_version,
+		     char *log_buf, size_t log_buf_sz);
 
 int bpf_obj_pin(int fd, const char *pathname);
 int bpf_obj_get(const char *pathname);
 
-#define LOG_BUF_SIZE 65536
-extern char bpf_log_buf[LOG_BUF_SIZE];
+#define BPF_LOG_BUF_SIZE 65536
 
 /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
 
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
index 3147377e8fd3..62ed870590cc 100644
--- a/samples/bpf/map_perf_test_user.c
+++ b/samples/bpf/map_perf_test_user.c
@@ -37,6 +37,7 @@ static __u64 time_get_ns(void)
 #define PERCPU_HASH_KMALLOC	(1 << 3)
 
 static int test_flags = ~0;
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 static void test_hash_prealloc(int cpu)
 {
diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c
index 6f002a9c24fa..dd2598b1fabc 100644
--- a/samples/bpf/offwaketime_user.c
+++ b/samples/bpf/offwaketime_user.c
@@ -20,6 +20,8 @@
 
 #define PRINT_RAW_ADDR 0
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static void print_ksym(__u64 addr)
 {
 	struct ksym *sym;
@@ -49,14 +51,14 @@ static void print_stack(struct key_t *key, __u64 count)
 	int i;
 
 	printf("%s;", key->target);
-	if (bpf_lookup_elem(map_fd[3], &key->tret, ip) != 0) {
+	if (bpf_map_lookup_elem(map_fd[3], &key->tret, ip) != 0) {
 		printf("---;");
 	} else {
 		for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
 			print_ksym(ip[i]);
 	}
 	printf("-;");
-	if (bpf_lookup_elem(map_fd[3], &key->wret, ip) != 0) {
+	if (bpf_map_lookup_elem(map_fd[3], &key->wret, ip) != 0) {
 		printf("---;");
 	} else {
 		for (i = 0; i < PERF_MAX_STACK_DEPTH; i++)
@@ -77,8 +79,8 @@ static void print_stacks(int fd)
 	struct key_t key = {}, next_key;
 	__u64 value;
 
-	while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-		bpf_lookup_elem(fd, &next_key, &value);
+	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+		bpf_map_lookup_elem(fd, &next_key, &value);
 		print_stack(&next_key, value);
 		key = next_key;
 	}
diff --git a/samples/bpf/sampleip_user.c b/samples/bpf/sampleip_user.c
index 260a6bdd6413..09ab620b324c 100644
--- a/samples/bpf/sampleip_user.c
+++ b/samples/bpf/sampleip_user.c
@@ -28,6 +28,7 @@
 #define PAGE_OFFSET	0xffff880000000000
 
 static int nr_cpus;
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 static void usage(void)
 {
@@ -95,8 +96,8 @@ static void print_ip_map(int fd)
 
 	/* fetch IPs and counts */
 	key = 0, i = 0;
-	while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-		bpf_lookup_elem(fd, &next_key, &value);
+	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+		bpf_map_lookup_elem(fd, &next_key, &value);
 		counts[i].ip = next_key;
 		counts[i++].count = value;
 		key = next_key;
diff --git a/samples/bpf/sock_example.c b/samples/bpf/sock_example.c
index 28b60baa9fa8..7ab636c30154 100644
--- a/samples/bpf/sock_example.c
+++ b/samples/bpf/sock_example.c
@@ -55,8 +55,8 @@ static int test_sock(void)
 		BPF_EXIT_INSN(),
 	};
 
-	prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, prog, sizeof(prog),
-				"GPL", 0);
+	prog_fd = bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER, prog, sizeof(prog),
+				   "GPL", 0, NULL, 0);
 	if (prog_fd < 0) {
 		printf("failed to load prog '%s'\n", strerror(errno));
 		goto cleanup;
@@ -72,13 +72,13 @@ static int test_sock(void)
 
 	for (i = 0; i < 10; i++) {
 		key = IPPROTO_TCP;
-		assert(bpf_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
 
 		key = IPPROTO_UDP;
-		assert(bpf_lookup_elem(map_fd, &key, &udp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0);
 
 		key = IPPROTO_ICMP;
-		assert(bpf_lookup_elem(map_fd, &key, &icmp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0);
 
 		printf("TCP %lld UDP %lld ICMP %lld packets\n",
 		       tcp_cnt, udp_cnt, icmp_cnt);
diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c
index 678ce4693551..2956d893d732 100644
--- a/samples/bpf/sockex1_user.c
+++ b/samples/bpf/sockex1_user.c
@@ -6,6 +6,8 @@
 #include <unistd.h>
 #include <arpa/inet.h>
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 int main(int ac, char **argv)
 {
 	char filename[256];
@@ -32,13 +34,13 @@ int main(int ac, char **argv)
 		int key;
 
 		key = IPPROTO_TCP;
-		assert(bpf_lookup_elem(map_fd[0], &key, &tcp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd[0], &key, &tcp_cnt) == 0);
 
 		key = IPPROTO_UDP;
-		assert(bpf_lookup_elem(map_fd[0], &key, &udp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd[0], &key, &udp_cnt) == 0);
 
 		key = IPPROTO_ICMP;
-		assert(bpf_lookup_elem(map_fd[0], &key, &icmp_cnt) == 0);
+		assert(bpf_map_lookup_elem(map_fd[0], &key, &icmp_cnt) == 0);
 
 		printf("TCP %lld UDP %lld ICMP %lld bytes\n",
 		       tcp_cnt, udp_cnt, icmp_cnt);
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c
index 8a4085c2d117..c43958a67cca 100644
--- a/samples/bpf/sockex2_user.c
+++ b/samples/bpf/sockex2_user.c
@@ -7,6 +7,8 @@
 #include <arpa/inet.h>
 #include <sys/resource.h>
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 struct pair {
 	__u64 packets;
 	__u64 bytes;
@@ -39,8 +41,8 @@ int main(int ac, char **argv)
 		int key = 0, next_key;
 		struct pair value;
 
-		while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-			bpf_lookup_elem(map_fd[0], &next_key, &value);
+		while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+			bpf_map_lookup_elem(map_fd[0], &next_key, &value);
 			printf("ip %s bytes %lld packets %lld\n",
 			       inet_ntoa((struct in_addr){htonl(next_key)}),
 			       value.bytes, value.packets);
diff --git a/samples/bpf/sockex3_user.c b/samples/bpf/sockex3_user.c
index 3fcfd8c4b2a3..2cb9011ea440 100644
--- a/samples/bpf/sockex3_user.c
+++ b/samples/bpf/sockex3_user.c
@@ -7,6 +7,8 @@
 #include <arpa/inet.h>
 #include <sys/resource.h>
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 struct bpf_flow_keys {
 	__be32 src;
 	__be32 dst;
@@ -54,8 +56,8 @@ int main(int argc, char **argv)
 
 		sleep(1);
 		printf("IP     src.port -> dst.port               bytes      packets\n");
-		while (bpf_get_next_key(map_fd[2], &key, &next_key) == 0) {
-			bpf_lookup_elem(map_fd[2], &next_key, &value);
+		while (bpf_map_get_next_key(map_fd[2], &key, &next_key) == 0) {
+			bpf_map_lookup_elem(map_fd[2], &next_key, &value);
 			printf("%s.%05d -> %s.%05d %12lld %12lld\n",
 			       inet_ntoa((struct in_addr){htonl(next_key.src)}),
 			       next_key.port16[0],
diff --git a/samples/bpf/spintest_user.c b/samples/bpf/spintest_user.c
index 311ede532230..8950a3d27a92 100644
--- a/samples/bpf/spintest_user.c
+++ b/samples/bpf/spintest_user.c
@@ -7,6 +7,8 @@
 #include "libbpf.h"
 #include "bpf_load.h"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 int main(int ac, char **argv)
 {
 	struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
@@ -31,8 +33,8 @@ int main(int ac, char **argv)
 	for (i = 0; i < 5; i++) {
 		key = 0;
 		printf("kprobing funcs:");
-		while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-			bpf_lookup_elem(map_fd[0], &next_key, &value);
+		while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+			bpf_map_lookup_elem(map_fd[0], &next_key, &value);
 			assert(next_key == value);
 			sym = ksym_search(value);
 			printf(" %s", sym->name);
@@ -41,8 +43,8 @@ int main(int ac, char **argv)
 		if (key)
 			printf("\n");
 		key = 0;
-		while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0)
-			bpf_delete_elem(map_fd[0], &next_key);
+		while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0)
+			bpf_map_delete_elem(map_fd[0], &next_key);
 		sleep(1);
 	}
 
diff --git a/samples/bpf/tc_l2_redirect_user.c b/samples/bpf/tc_l2_redirect_user.c
index 4013c5337b91..28995a776560 100644
--- a/samples/bpf/tc_l2_redirect_user.c
+++ b/samples/bpf/tc_l2_redirect_user.c
@@ -60,9 +60,9 @@ int main(int argc, char **argv)
 	}
 
 	/* bpf_tunnel_key.remote_ipv4 expects host byte orders */
-	ret = bpf_update_elem(array_fd, &array_key, &ifindex, 0);
+	ret = bpf_map_update_elem(array_fd, &array_key, &ifindex, 0);
 	if (ret) {
-		perror("bpf_update_elem");
+		perror("bpf_map_update_elem");
 		goto out;
 	}
 
diff --git a/samples/bpf/test_cgrp2_array_pin.c b/samples/bpf/test_cgrp2_array_pin.c
index 70e86f7be69d..8a1b8b5d8def 100644
--- a/samples/bpf/test_cgrp2_array_pin.c
+++ b/samples/bpf/test_cgrp2_array_pin.c
@@ -85,9 +85,9 @@ int main(int argc, char **argv)
 		}
 	}
 
-	ret = bpf_update_elem(array_fd, &array_key, &cg2_fd, 0);
+	ret = bpf_map_update_elem(array_fd, &array_key, &cg2_fd, 0);
 	if (ret) {
-		perror("bpf_update_elem");
+		perror("bpf_map_update_elem");
 		goto out;
 	}
 
diff --git a/samples/bpf/test_current_task_under_cgroup_user.c b/samples/bpf/test_current_task_under_cgroup_user.c
index 30b0bce884f9..054915324aeb 100644
--- a/samples/bpf/test_current_task_under_cgroup_user.c
+++ b/samples/bpf/test_current_task_under_cgroup_user.c
@@ -28,6 +28,8 @@
 #define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
 	__FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static int join_cgroup(char *path)
 {
 	int fd, rc = 0;
@@ -94,7 +96,7 @@ int main(int argc, char **argv)
 		goto cleanup_cgroup_err;
 	}
 
-	if (bpf_update_elem(map_fd[0], &idx, &cg2, BPF_ANY)) {
+	if (bpf_map_update_elem(map_fd[0], &idx, &cg2, BPF_ANY)) {
 		log_err("Adding target cgroup to map");
 		goto cleanup_cgroup_err;
 	}
@@ -109,7 +111,7 @@ int main(int argc, char **argv)
 	 */
 
 	sync();
-	bpf_lookup_elem(map_fd[1], &idx, &remote_pid);
+	bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid);
 
 	if (local_pid != remote_pid) {
 		fprintf(stderr,
@@ -123,10 +125,10 @@ int main(int argc, char **argv)
 		goto leave_cgroup_err;
 
 	remote_pid = 0;
-	bpf_update_elem(map_fd[1], &idx, &remote_pid, BPF_ANY);
+	bpf_map_update_elem(map_fd[1], &idx, &remote_pid, BPF_ANY);
 
 	sync();
-	bpf_lookup_elem(map_fd[1], &idx, &remote_pid);
+	bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid);
 
 	if (local_pid == remote_pid) {
 		fprintf(stderr, "BPF cgroup negative test did not work\n");
diff --git a/samples/bpf/test_maps.c b/samples/bpf/test_maps.c
index cce2b59751eb..2618394a3cc7 100644
--- a/samples/bpf/test_maps.c
+++ b/samples/bpf/test_maps.c
@@ -36,68 +36,68 @@ static void test_hashmap_sanity(int i, void *data)
 	key = 1;
 	value = 1234;
 	/* insert key=1 element */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
 
 	value = 0;
 	/* BPF_NOEXIST means: add new element if it doesn't exist */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
 	       /* key=1 already exists */
 	       errno == EEXIST);
 
-	assert(bpf_update_elem(map_fd, &key, &value, -1) == -1 && errno == EINVAL);
+	assert(bpf_map_update_elem(map_fd, &key, &value, -1) == -1 && errno == EINVAL);
 
 	/* check that key=1 can be found */
-	assert(bpf_lookup_elem(map_fd, &key, &value) == 0 && value == 1234);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0 && value == 1234);
 
 	key = 2;
 	/* check that key=2 is not found */
-	assert(bpf_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
 
 	/* BPF_EXIST means: update existing element */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_EXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_EXIST) == -1 &&
 	       /* key=2 is not there */
 	       errno == ENOENT);
 
 	/* insert key=2 element */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
 
 	/* key=1 and key=2 were inserted, check that key=0 cannot be inserted
 	 * due to max_entries limit
 	 */
 	key = 0;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
 	       errno == E2BIG);
 
 	/* update existing element, thought the map is full */
 	key = 1;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_EXIST) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_EXIST) == 0);
 	key = 2;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
 	key = 1;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
 
 	/* check that key = 0 doesn't exist */
 	key = 0;
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
 
 	/* iterate over two elements */
-	assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &key, &next_key) == 0 &&
 	       (next_key == 1 || next_key == 2));
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == 0 &&
 	       (next_key == 1 || next_key == 2));
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == -1 &&
 	       errno == ENOENT);
 
 	/* delete both elements */
 	key = 1;
-	assert(bpf_delete_elem(map_fd, &key) == 0);
+	assert(bpf_map_delete_elem(map_fd, &key) == 0);
 	key = 2;
-	assert(bpf_delete_elem(map_fd, &key) == 0);
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
+	assert(bpf_map_delete_elem(map_fd, &key) == 0);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
 
 	key = 0;
 	/* check that map is empty */
-	assert(bpf_get_next_key(map_fd, &key, &next_key) == -1 &&
+	assert(bpf_map_get_next_key(map_fd, &key, &next_key) == -1 &&
 	       errno == ENOENT);
 	close(map_fd);
 }
@@ -123,54 +123,54 @@ static void test_percpu_hashmap_sanity(int task, void *data)
 	key = 1;
 	/* insert key=1 element */
 	assert(!(expected_key_mask & key));
-	assert(bpf_update_elem(map_fd, &key, value, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_ANY) == 0);
 	expected_key_mask |= key;
 
 	/* BPF_NOEXIST means: add new element if it doesn't exist */
-	assert(bpf_update_elem(map_fd, &key, value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST) == -1 &&
 	       /* key=1 already exists */
 	       errno == EEXIST);
 
 	/* -1 is an invalid flag */
-	assert(bpf_update_elem(map_fd, &key, value, -1) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, value, -1) == -1 &&
 	       errno == EINVAL);
 
 	/* check that key=1 can be found. value could be 0 if the lookup
 	 * was run from a different cpu.
 	 */
 	value[0] = 1;
-	assert(bpf_lookup_elem(map_fd, &key, value) == 0 && value[0] == 100);
+	assert(bpf_map_lookup_elem(map_fd, &key, value) == 0 && value[0] == 100);
 
 	key = 2;
 	/* check that key=2 is not found */
-	assert(bpf_lookup_elem(map_fd, &key, value) == -1 && errno == ENOENT);
+	assert(bpf_map_lookup_elem(map_fd, &key, value) == -1 && errno == ENOENT);
 
 	/* BPF_EXIST means: update existing element */
-	assert(bpf_update_elem(map_fd, &key, value, BPF_EXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_EXIST) == -1 &&
 	       /* key=2 is not there */
 	       errno == ENOENT);
 
 	/* insert key=2 element */
 	assert(!(expected_key_mask & key));
-	assert(bpf_update_elem(map_fd, &key, value, BPF_NOEXIST) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST) == 0);
 	expected_key_mask |= key;
 
 	/* key=1 and key=2 were inserted, check that key=0 cannot be inserted
 	 * due to max_entries limit
 	 */
 	key = 0;
-	assert(bpf_update_elem(map_fd, &key, value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST) == -1 &&
 	       errno == E2BIG);
 
 	/* check that key = 0 doesn't exist */
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
 
 	/* iterate over two elements */
-	while (!bpf_get_next_key(map_fd, &key, &next_key)) {
+	while (!bpf_map_get_next_key(map_fd, &key, &next_key)) {
 		assert((expected_key_mask & next_key) == next_key);
 		expected_key_mask &= ~next_key;
 
-		assert(bpf_lookup_elem(map_fd, &next_key, value) == 0);
+		assert(bpf_map_lookup_elem(map_fd, &next_key, value) == 0);
 		for (i = 0; i < nr_cpus; i++)
 			assert(value[i] == i + 100);
 
@@ -180,18 +180,18 @@ static void test_percpu_hashmap_sanity(int task, void *data)
 
 	/* Update with BPF_EXIST */
 	key = 1;
-	assert(bpf_update_elem(map_fd, &key, value, BPF_EXIST) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, value, BPF_EXIST) == 0);
 
 	/* delete both elements */
 	key = 1;
-	assert(bpf_delete_elem(map_fd, &key) == 0);
+	assert(bpf_map_delete_elem(map_fd, &key) == 0);
 	key = 2;
-	assert(bpf_delete_elem(map_fd, &key) == 0);
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
+	assert(bpf_map_delete_elem(map_fd, &key) == 0);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == ENOENT);
 
 	key = 0;
 	/* check that map is empty */
-	assert(bpf_get_next_key(map_fd, &key, &next_key) == -1 &&
+	assert(bpf_map_get_next_key(map_fd, &key, &next_key) == -1 &&
 	       errno == ENOENT);
 	close(map_fd);
 }
@@ -211,41 +211,41 @@ static void test_arraymap_sanity(int i, void *data)
 	key = 1;
 	value = 1234;
 	/* insert key=1 element */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_ANY) == 0);
 
 	value = 0;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
 	       errno == EEXIST);
 
 	/* check that key=1 can be found */
-	assert(bpf_lookup_elem(map_fd, &key, &value) == 0 && value == 1234);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0 && value == 1234);
 
 	key = 0;
 	/* check that key=0 is also found and zero initialized */
-	assert(bpf_lookup_elem(map_fd, &key, &value) == 0 && value == 0);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0 && value == 0);
 
 
 	/* key=0 and key=1 were inserted, check that key=2 cannot be inserted
 	 * due to max_entries limit
 	 */
 	key = 2;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_EXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_EXIST) == -1 &&
 	       errno == E2BIG);
 
 	/* check that key = 2 doesn't exist */
-	assert(bpf_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
 
 	/* iterate over two elements */
-	assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &key, &next_key) == 0 &&
 	       next_key == 0);
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == 0 &&
 	       next_key == 1);
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == -1 &&
 	       errno == ENOENT);
 
 	/* delete shouldn't succeed */
 	key = 1;
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == EINVAL);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == EINVAL);
 
 	close(map_fd);
 }
@@ -269,12 +269,12 @@ static void test_percpu_arraymap_many_keys(void)
 		values[i] = i + 10;
 
 	for (key = 0; key < nr_keys; key++)
-		assert(bpf_update_elem(map_fd, &key, values, BPF_ANY) == 0);
+		assert(bpf_map_update_elem(map_fd, &key, values, BPF_ANY) == 0);
 
 	for (key = 0; key < nr_keys; key++) {
 		for (i = 0; i < nr_cpus; i++)
 			values[i] = 0;
-		assert(bpf_lookup_elem(map_fd, &key, values) == 0);
+		assert(bpf_map_lookup_elem(map_fd, &key, values) == 0);
 		for (i = 0; i < nr_cpus; i++)
 			assert(values[i] == i + 10);
 	}
@@ -300,40 +300,40 @@ static void test_percpu_arraymap_sanity(int i, void *data)
 
 	key = 1;
 	/* insert key=1 element */
-	assert(bpf_update_elem(map_fd, &key, values, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd, &key, values, BPF_ANY) == 0);
 
 	values[0] = 0;
-	assert(bpf_update_elem(map_fd, &key, values, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, values, BPF_NOEXIST) == -1 &&
 	       errno == EEXIST);
 
 	/* check that key=1 can be found */
-	assert(bpf_lookup_elem(map_fd, &key, values) == 0 && values[0] == 100);
+	assert(bpf_map_lookup_elem(map_fd, &key, values) == 0 && values[0] == 100);
 
 	key = 0;
 	/* check that key=0 is also found and zero initialized */
-	assert(bpf_lookup_elem(map_fd, &key, values) == 0 &&
+	assert(bpf_map_lookup_elem(map_fd, &key, values) == 0 &&
 	       values[0] == 0 && values[nr_cpus - 1] == 0);
 
 
 	/* check that key=2 cannot be inserted due to max_entries limit */
 	key = 2;
-	assert(bpf_update_elem(map_fd, &key, values, BPF_EXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, values, BPF_EXIST) == -1 &&
 	       errno == E2BIG);
 
 	/* check that key = 2 doesn't exist */
-	assert(bpf_lookup_elem(map_fd, &key, values) == -1 && errno == ENOENT);
+	assert(bpf_map_lookup_elem(map_fd, &key, values) == -1 && errno == ENOENT);
 
 	/* iterate over two elements */
-	assert(bpf_get_next_key(map_fd, &key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &key, &next_key) == 0 &&
 	       next_key == 0);
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == 0 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == 0 &&
 	       next_key == 1);
-	assert(bpf_get_next_key(map_fd, &next_key, &next_key) == -1 &&
+	assert(bpf_map_get_next_key(map_fd, &next_key, &next_key) == -1 &&
 	       errno == ENOENT);
 
 	/* delete shouldn't succeed */
 	key = 1;
-	assert(bpf_delete_elem(map_fd, &key) == -1 && errno == EINVAL);
+	assert(bpf_map_delete_elem(map_fd, &key) == -1 && errno == EINVAL);
 
 	close(map_fd);
 }
@@ -359,21 +359,21 @@ static void test_map_large(void)
 	for (i = 0; i < MAP_SIZE; i++) {
 		key = (struct bigkey) {.c = i};
 		value = i;
-		assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
+		assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
 	}
 	key.c = -1;
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
 	       errno == E2BIG);
 
 	/* iterate through all elements */
 	for (i = 0; i < MAP_SIZE; i++)
-		assert(bpf_get_next_key(map_fd, &key, &key) == 0);
-	assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
+		assert(bpf_map_get_next_key(map_fd, &key, &key) == 0);
+	assert(bpf_map_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
 
 	key.c = 0;
-	assert(bpf_lookup_elem(map_fd, &key, &value) == 0 && value == 0);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0 && value == 0);
 	key.a = 1;
-	assert(bpf_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
+	assert(bpf_map_lookup_elem(map_fd, &key, &value) == -1 && errno == ENOENT);
 
 	close(map_fd);
 }
@@ -423,10 +423,10 @@ static void do_work(int fn, void *data)
 	for (i = fn; i < MAP_SIZE; i += TASKS) {
 		key = value = i;
 		if (do_update) {
-			assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
-			assert(bpf_update_elem(map_fd, &key, &value, BPF_EXIST) == 0);
+			assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == 0);
+			assert(bpf_map_update_elem(map_fd, &key, &value, BPF_EXIST) == 0);
 		} else {
-			assert(bpf_delete_elem(map_fd, &key) == 0);
+			assert(bpf_map_delete_elem(map_fd, &key) == 0);
 		}
 	}
 }
@@ -454,19 +454,19 @@ static void test_map_parallel(void)
 	run_parallel(TASKS, do_work, data);
 
 	/* check that key=0 is already there */
-	assert(bpf_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
+	assert(bpf_map_update_elem(map_fd, &key, &value, BPF_NOEXIST) == -1 &&
 	       errno == EEXIST);
 
 	/* check that all elements were inserted */
 	key = -1;
 	for (i = 0; i < MAP_SIZE; i++)
-		assert(bpf_get_next_key(map_fd, &key, &key) == 0);
-	assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
+		assert(bpf_map_get_next_key(map_fd, &key, &key) == 0);
+	assert(bpf_map_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
 
 	/* another check for all elements */
 	for (i = 0; i < MAP_SIZE; i++) {
 		key = MAP_SIZE - i - 1;
-		assert(bpf_lookup_elem(map_fd, &key, &value) == 0 &&
+		assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0 &&
 		       value == key);
 	}
 
@@ -476,7 +476,7 @@ static void test_map_parallel(void)
 
 	/* nothing should be left */
 	key = -1;
-	assert(bpf_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
+	assert(bpf_map_get_next_key(map_fd, &key, &key) == -1 && errno == ENOENT);
 }
 
 static void run_all_tests(void)
diff --git a/samples/bpf/test_overhead_user.c b/samples/bpf/test_overhead_user.c
index d291167fd3c7..74b79af98ba2 100644
--- a/samples/bpf/test_overhead_user.c
+++ b/samples/bpf/test_overhead_user.c
@@ -24,6 +24,8 @@
 
 #define MAX_CNT 1000000
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static __u64 time_get_ns(void)
 {
 	struct timespec ts;
diff --git a/samples/bpf/test_probe_write_user_user.c b/samples/bpf/test_probe_write_user_user.c
index a44bf347bedd..29af2160e4e2 100644
--- a/samples/bpf/test_probe_write_user_user.c
+++ b/samples/bpf/test_probe_write_user_user.c
@@ -9,6 +9,8 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 int main(int ac, char **argv)
 {
 	int serverfd, serverconnfd, clientfd;
@@ -50,7 +52,7 @@ int main(int ac, char **argv)
 	mapped_addr_in->sin_port = htons(5555);
 	mapped_addr_in->sin_addr.s_addr = inet_addr("255.255.255.255");
 
-	assert(!bpf_update_elem(map_fd[0], &mapped_addr, &serv_addr, BPF_ANY));
+	assert(!bpf_map_update_elem(map_fd[0], &mapped_addr, &serv_addr, BPF_ANY));
 
 	assert(listen(serverfd, 5) == 0);
 
diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c
index 369ffaad3799..2e85a8e2d696 100644
--- a/samples/bpf/test_verifier.c
+++ b/samples/bpf/test_verifier.c
@@ -24,6 +24,8 @@
 
 #define MAX_FIXUPS 8
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 struct bpf_test {
 	const char *descr;
 	struct bpf_insn	insns[MAX_INSNS];
@@ -2466,9 +2468,9 @@ static int test(void)
 
 		printf("#%d %s ", i, tests[i].descr);
 
-		prog_fd = bpf_prog_load(prog_type ?: BPF_PROG_TYPE_SOCKET_FILTER,
-					prog, prog_len * sizeof(struct bpf_insn),
-					"GPL", 0);
+		prog_fd = bpf_load_program(prog_type ?: BPF_PROG_TYPE_SOCKET_FILTER,
+					   prog, prog_len * sizeof(struct bpf_insn),
+					   "GPL", 0, NULL, 0);
 
 		if (unpriv && tests[i].result_unpriv != UNDEF)
 			expected_result = tests[i].result_unpriv;
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 9a130d31ecf2..de8fd0266d78 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -24,6 +24,7 @@
 #define SAMPLE_FREQ 50
 
 static bool sys_read_seen, sys_write_seen;
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 static void print_ksym(__u64 addr)
 {
@@ -61,14 +62,14 @@ static void print_stack(struct key_t *key, __u64 count)
 	int i;
 
 	printf("%3lld %s;", count, key->comm);
-	if (bpf_lookup_elem(map_fd[1], &key->kernstack, ip) != 0) {
+	if (bpf_map_lookup_elem(map_fd[1], &key->kernstack, ip) != 0) {
 		printf("---;");
 	} else {
 		for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
 			print_ksym(ip[i]);
 	}
 	printf("-;");
-	if (bpf_lookup_elem(map_fd[1], &key->userstack, ip) != 0) {
+	if (bpf_map_lookup_elem(map_fd[1], &key->userstack, ip) != 0) {
 		printf("---;");
 	} else {
 		for (i = PERF_MAX_STACK_DEPTH - 1; i >= 0; i--)
@@ -98,10 +99,10 @@ static void print_stacks(void)
 	int fd = map_fd[0], stack_map = map_fd[1];
 
 	sys_read_seen = sys_write_seen = false;
-	while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-		bpf_lookup_elem(fd, &next_key, &value);
+	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+		bpf_map_lookup_elem(fd, &next_key, &value);
 		print_stack(&next_key, value);
-		bpf_delete_elem(fd, &next_key);
+		bpf_map_delete_elem(fd, &next_key);
 		key = next_key;
 	}
 
@@ -111,8 +112,8 @@ static void print_stacks(void)
 	}
 
 	/* clear stack map */
-	while (bpf_get_next_key(stack_map, &stackid, &next_id) == 0) {
-		bpf_delete_elem(stack_map, &next_id);
+	while (bpf_map_get_next_key(stack_map, &stackid, &next_id) == 0) {
+		bpf_map_delete_elem(stack_map, &next_id);
 		stackid = next_id;
 	}
 }
diff --git a/samples/bpf/trace_output_user.c b/samples/bpf/trace_output_user.c
index 661a7d052f2c..9c38f7aa4515 100644
--- a/samples/bpf/trace_output_user.c
+++ b/samples/bpf/trace_output_user.c
@@ -27,6 +27,7 @@ static int pmu_fd;
 int page_size;
 int page_cnt = 8;
 volatile struct perf_event_mmap_page *header;
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
 
 typedef void (*print_fn)(void *data, int size);
 
@@ -162,7 +163,7 @@ static void test_bpf_perf_event(void)
 	pmu_fd = perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
 
 	assert(pmu_fd >= 0);
-	assert(bpf_update_elem(map_fd[0], &key, &pmu_fd, BPF_ANY) == 0);
+	assert(bpf_map_update_elem(map_fd[0], &key, &pmu_fd, BPF_ANY) == 0);
 	ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0);
 }
 
diff --git a/samples/bpf/tracex1_user.c b/samples/bpf/tracex1_user.c
index 31a48183beea..aa60cc3ef38c 100644
--- a/samples/bpf/tracex1_user.c
+++ b/samples/bpf/tracex1_user.c
@@ -4,6 +4,8 @@
 #include "libbpf.h"
 #include "bpf_load.h"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 int main(int ac, char **argv)
 {
 	FILE *f;
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c
index ab5b19e68acf..5dd128cc5785 100644
--- a/samples/bpf/tracex2_user.c
+++ b/samples/bpf/tracex2_user.c
@@ -10,6 +10,8 @@
 #define MAX_INDEX	64
 #define MAX_STARS	38
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static void stars(char *str, long val, long max, int width)
 {
 	int i;
@@ -46,12 +48,12 @@ static void print_hist_for_pid(int fd, void *task)
 	long max_value = 0;
 	int i, ind;
 
-	while (bpf_get_next_key(fd, &key, &next_key) == 0) {
+	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
 		if (memcmp(&next_key, task, SIZE)) {
 			key = next_key;
 			continue;
 		}
-		bpf_lookup_elem(fd, &next_key, values);
+		bpf_map_lookup_elem(fd, &next_key, values);
 		value = 0;
 		for (i = 0; i < nr_cpus; i++)
 			value += values[i];
@@ -81,7 +83,7 @@ static void print_hist(int fd)
 	int task_cnt = 0;
 	int i;
 
-	while (bpf_get_next_key(fd, &key, &next_key) == 0) {
+	while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
 		int found = 0;
 
 		for (i = 0; i < task_cnt; i++)
@@ -134,8 +136,8 @@ int main(int ac, char **argv)
 
 	for (i = 0; i < 5; i++) {
 		key = 0;
-		while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-			bpf_lookup_elem(map_fd[0], &next_key, &value);
+		while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+			bpf_map_lookup_elem(map_fd[0], &next_key, &value);
 			printf("location 0x%lx count %ld\n", next_key, value);
 			key = next_key;
 		}
diff --git a/samples/bpf/tracex3_user.c b/samples/bpf/tracex3_user.c
index 48716f7f0d8b..9c6ee595a882 100644
--- a/samples/bpf/tracex3_user.c
+++ b/samples/bpf/tracex3_user.c
@@ -18,6 +18,8 @@
 
 #define SLOTS 100
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static void clear_stats(int fd)
 {
 	unsigned int nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -26,7 +28,7 @@ static void clear_stats(int fd)
 
 	memset(values, 0, sizeof(values));
 	for (key = 0; key < SLOTS; key++)
-		bpf_update_elem(fd, &key, values, BPF_ANY);
+		bpf_map_update_elem(fd, &key, values, BPF_ANY);
 }
 
 const char *color[] = {
@@ -87,7 +89,7 @@ static void print_hist(int fd)
 	int i;
 
 	for (key = 0; key < SLOTS; key++) {
-		bpf_lookup_elem(fd, &key, values);
+		bpf_map_lookup_elem(fd, &key, values);
 		value = 0;
 		for (i = 0; i < nr_cpus; i++)
 			value += values[i];
diff --git a/samples/bpf/tracex4_user.c b/samples/bpf/tracex4_user.c
index bc4a3bdea6ed..8b2f98c6c99a 100644
--- a/samples/bpf/tracex4_user.c
+++ b/samples/bpf/tracex4_user.c
@@ -15,6 +15,8 @@
 #include "libbpf.h"
 #include "bpf_load.h"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 struct pair {
 	long long val;
 	__u64 ip;
@@ -37,8 +39,8 @@ static void print_old_objects(int fd)
 	key = write(1, "\e[1;1H\e[2J", 12); /* clear screen */
 
 	key = -1;
-	while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) {
-		bpf_lookup_elem(map_fd[0], &next_key, &v);
+	while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) {
+		bpf_map_lookup_elem(map_fd[0], &next_key, &v);
 		key = next_key;
 		if (val - v.val < 1000000000ll)
 			/* object was allocated more then 1 sec ago */
diff --git a/samples/bpf/tracex5_user.c b/samples/bpf/tracex5_user.c
index 36b5925bb137..035beea6b31c 100644
--- a/samples/bpf/tracex5_user.c
+++ b/samples/bpf/tracex5_user.c
@@ -8,6 +8,8 @@
 #include "bpf_load.h"
 #include <sys/resource.h>
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 /* install fake seccomp program to enable seccomp code path inside the kernel,
  * so that our kprobe attached to seccomp_phase1() can be triggered
  */
diff --git a/samples/bpf/tracex6_user.c b/samples/bpf/tracex6_user.c
index 8ea4976cfcf1..7a3b4a4b19f3 100644
--- a/samples/bpf/tracex6_user.c
+++ b/samples/bpf/tracex6_user.c
@@ -13,6 +13,8 @@
 
 #define SAMPLE_PERIOD  0x7fffffffffffffffULL
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static void test_bpf_perf_event(void)
 {
 	int nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -36,7 +38,7 @@ static void test_bpf_perf_event(void)
 			goto exit;
 		}
 
-		bpf_update_elem(map_fd[0], &i, &pmu_fd[i], BPF_ANY);
+		bpf_map_update_elem(map_fd[0], &i, &pmu_fd[i], BPF_ANY);
 		ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE, 0);
 	}
 
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index a5e109e398a1..7302322f26ff 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -18,6 +18,8 @@
 #include "bpf_load.h"
 #include "libbpf.h"
 
+char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
 static int set_link_xdp_fd(int ifindex, int fd)
 {
 	struct sockaddr_nl sa;
@@ -134,7 +136,7 @@ static void poll_stats(int interval)
 		for (key = 0; key < nr_keys; key++) {
 			__u64 sum = 0;
 
-			assert(bpf_lookup_elem(map_fd[0], &key, values) == 0);
+			assert(bpf_map_lookup_elem(map_fd[0], &key, values) == 0);
 			for (i = 0; i < nr_cpus; i++)
 				sum += (values[i] - prev[key][i]);
 			if (sum)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 12/22] samples/bpf: Switch over to libbpf
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 11/22] samples/bpf: Make samples more libbpf-centric Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 13/22] samples/bpf: Remove perf_event_open() declaration Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Wang Nan, Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

Now that libbpf under tools/lib/bpf/* is synced with the version from
samples/bpf, we can get rid most of the libbpf library here.

Signed-off-by: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161209024620.31660-6-joe@ovn.org
[ Use -I$(srctree)/tools/lib/ to support out of source code tree builds, as noticed by Wang Nan ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 samples/bpf/Makefile   |  60 +++++++++++++-------------
 samples/bpf/README.rst |   4 +-
 samples/bpf/libbpf.c   | 111 -------------------------------------------------
 samples/bpf/libbpf.h   |  19 +--------
 tools/lib/bpf/Makefile |   2 +
 5 files changed, 38 insertions(+), 158 deletions(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 72c58675973e..7307b2bf43be 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -29,35 +29,38 @@ hostprogs-y += trace_event
 hostprogs-y += sampleip
 hostprogs-y += tc_l2_redirect
 
-test_verifier-objs := test_verifier.o libbpf.o
-test_maps-objs := test_maps.o libbpf.o
-sock_example-objs := sock_example.o libbpf.o
-fds_example-objs := bpf_load.o libbpf.o fds_example.o
-sockex1-objs := bpf_load.o libbpf.o sockex1_user.o
-sockex2-objs := bpf_load.o libbpf.o sockex2_user.o
-sockex3-objs := bpf_load.o libbpf.o sockex3_user.o
-tracex1-objs := bpf_load.o libbpf.o tracex1_user.o
-tracex2-objs := bpf_load.o libbpf.o tracex2_user.o
-tracex3-objs := bpf_load.o libbpf.o tracex3_user.o
-tracex4-objs := bpf_load.o libbpf.o tracex4_user.o
-tracex5-objs := bpf_load.o libbpf.o tracex5_user.o
-tracex6-objs := bpf_load.o libbpf.o tracex6_user.o
-test_probe_write_user-objs := bpf_load.o libbpf.o test_probe_write_user_user.o
-trace_output-objs := bpf_load.o libbpf.o trace_output_user.o
-lathist-objs := bpf_load.o libbpf.o lathist_user.o
-offwaketime-objs := bpf_load.o libbpf.o offwaketime_user.o
-spintest-objs := bpf_load.o libbpf.o spintest_user.o
-map_perf_test-objs := bpf_load.o libbpf.o map_perf_test_user.o
-test_overhead-objs := bpf_load.o libbpf.o test_overhead_user.o
-test_cgrp2_array_pin-objs := libbpf.o test_cgrp2_array_pin.o
-xdp1-objs := bpf_load.o libbpf.o xdp1_user.o
+# Libbpf dependencies
+LIBBPF := libbpf.o ../../tools/lib/bpf/bpf.o
+
+test_verifier-objs := test_verifier.o $(LIBBPF)
+test_maps-objs := test_maps.o $(LIBBPF)
+sock_example-objs := sock_example.o $(LIBBPF)
+fds_example-objs := bpf_load.o $(LIBBPF) fds_example.o
+sockex1-objs := bpf_load.o $(LIBBPF) sockex1_user.o
+sockex2-objs := bpf_load.o $(LIBBPF) sockex2_user.o
+sockex3-objs := bpf_load.o $(LIBBPF) sockex3_user.o
+tracex1-objs := bpf_load.o $(LIBBPF) tracex1_user.o
+tracex2-objs := bpf_load.o $(LIBBPF) tracex2_user.o
+tracex3-objs := bpf_load.o $(LIBBPF) tracex3_user.o
+tracex4-objs := bpf_load.o $(LIBBPF) tracex4_user.o
+tracex5-objs := bpf_load.o $(LIBBPF) tracex5_user.o
+tracex6-objs := bpf_load.o $(LIBBPF) tracex6_user.o
+test_probe_write_user-objs := bpf_load.o $(LIBBPF) test_probe_write_user_user.o
+trace_output-objs := bpf_load.o $(LIBBPF) trace_output_user.o
+lathist-objs := bpf_load.o $(LIBBPF) lathist_user.o
+offwaketime-objs := bpf_load.o $(LIBBPF) offwaketime_user.o
+spintest-objs := bpf_load.o $(LIBBPF) spintest_user.o
+map_perf_test-objs := bpf_load.o $(LIBBPF) map_perf_test_user.o
+test_overhead-objs := bpf_load.o $(LIBBPF) test_overhead_user.o
+test_cgrp2_array_pin-objs := $(LIBBPF) test_cgrp2_array_pin.o
+xdp1-objs := bpf_load.o $(LIBBPF) xdp1_user.o
 # reuse xdp1 source intentionally
-xdp2-objs := bpf_load.o libbpf.o xdp1_user.o
-test_current_task_under_cgroup-objs := bpf_load.o libbpf.o \
+xdp2-objs := bpf_load.o $(LIBBPF) xdp1_user.o
+test_current_task_under_cgroup-objs := bpf_load.o $(LIBBPF) \
 				       test_current_task_under_cgroup_user.o
-trace_event-objs := bpf_load.o libbpf.o trace_event_user.o
-sampleip-objs := bpf_load.o libbpf.o sampleip_user.o
-tc_l2_redirect-objs := bpf_load.o libbpf.o tc_l2_redirect_user.o
+trace_event-objs := bpf_load.o $(LIBBPF) trace_event_user.o
+sampleip-objs := bpf_load.o $(LIBBPF) sampleip_user.o
+tc_l2_redirect-objs := bpf_load.o $(LIBBPF) tc_l2_redirect_user.o
 
 # Tell kbuild to always build the programs
 always := $(hostprogs-y)
@@ -89,7 +92,7 @@ always += test_current_task_under_cgroup_kern.o
 always += trace_event_kern.o
 always += sampleip_kern.o
 
-HOSTCFLAGS += -I$(objtree)/usr/include
+HOSTCFLAGS += -I$(objtree)/usr/include -I$(srctree)/tools/lib/
 
 HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
 HOSTLOADLIBES_fds_example += -lelf
@@ -123,6 +126,7 @@ CLANG ?= clang
 
 # Trick to allow make to be run from this directory
 all:
+	$(MAKE) -C ../../ tools/lib/bpf/
 	$(MAKE) -C ../../ $$PWD/
 
 clean:
diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst
index a43eae3f0551..79f9a58f1872 100644
--- a/samples/bpf/README.rst
+++ b/samples/bpf/README.rst
@@ -1,8 +1,8 @@
 eBPF sample programs
 ====================
 
-This directory contains a mini eBPF library, test stubs, verifier
-test-suite and examples for using eBPF.
+This directory contains a test stubs, verifier test-suite and examples
+for using eBPF. The examples use libbpf from tools/lib/bpf.
 
 Build dependencies
 ==================
diff --git a/samples/bpf/libbpf.c b/samples/bpf/libbpf.c
index e5c5a69996fc..d9af876b4a2c 100644
--- a/samples/bpf/libbpf.c
+++ b/samples/bpf/libbpf.c
@@ -4,8 +4,6 @@
 #include <linux/unistd.h>
 #include <unistd.h>
 #include <string.h>
-#include <linux/netlink.h>
-#include <linux/bpf.h>
 #include <errno.h>
 #include <net/ethernet.h>
 #include <net/if.h>
@@ -13,115 +11,6 @@
 #include <arpa/inet.h>
 #include "libbpf.h"
 
-static __u64 ptr_to_u64(void *ptr)
-{
-	return (__u64) (unsigned long) ptr;
-}
-
-int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-		   int max_entries, int map_flags)
-{
-	union bpf_attr attr = {
-		.map_type = map_type,
-		.key_size = key_size,
-		.value_size = value_size,
-		.max_entries = max_entries,
-		.map_flags = map_flags,
-	};
-
-	return syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr));
-}
-
-int bpf_map_update_elem(int fd, void *key, void *value, unsigned long long flags)
-{
-	union bpf_attr attr = {
-		.map_fd = fd,
-		.key = ptr_to_u64(key),
-		.value = ptr_to_u64(value),
-		.flags = flags,
-	};
-
-	return syscall(__NR_bpf, BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_map_lookup_elem(int fd, void *key, void *value)
-{
-	union bpf_attr attr = {
-		.map_fd = fd,
-		.key = ptr_to_u64(key),
-		.value = ptr_to_u64(value),
-	};
-
-	return syscall(__NR_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_map_delete_elem(int fd, void *key)
-{
-	union bpf_attr attr = {
-		.map_fd = fd,
-		.key = ptr_to_u64(key),
-	};
-
-	return syscall(__NR_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
-}
-
-int bpf_map_get_next_key(int fd, void *key, void *next_key)
-{
-	union bpf_attr attr = {
-		.map_fd = fd,
-		.key = ptr_to_u64(key),
-		.next_key = ptr_to_u64(next_key),
-	};
-
-	return syscall(__NR_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr));
-}
-
-#define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u))
-
-int bpf_load_program(enum bpf_prog_type prog_type,
-		     const struct bpf_insn *insns, int prog_len,
-		     const char *license, int kern_version,
-		     char *log_buf, size_t log_buf_sz)
-{
-	union bpf_attr attr = {
-		.prog_type = prog_type,
-		.insns = ptr_to_u64((void *) insns),
-		.insn_cnt = prog_len / sizeof(struct bpf_insn),
-		.license = ptr_to_u64((void *) license),
-		.log_buf = ptr_to_u64(log_buf),
-		.log_size = log_buf_sz,
-		.log_level = 1,
-	};
-
-	/* assign one field outside of struct init to make sure any
-	 * padding is zero initialized
-	 */
-	attr.kern_version = kern_version;
-
-	log_buf[0] = 0;
-
-	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
-}
-
-int bpf_obj_pin(int fd, const char *pathname)
-{
-	union bpf_attr attr = {
-		.pathname	= ptr_to_u64((void *)pathname),
-		.bpf_fd		= fd,
-	};
-
-	return syscall(__NR_bpf, BPF_OBJ_PIN, &attr, sizeof(attr));
-}
-
-int bpf_obj_get(const char *pathname)
-{
-	union bpf_attr attr = {
-		.pathname	= ptr_to_u64((void *)pathname),
-	};
-
-	return syscall(__NR_bpf, BPF_OBJ_GET, &attr, sizeof(attr));
-}
-
 int open_raw_sock(const char *name)
 {
 	struct sockaddr_ll sll;
diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h
index 1325152be4cd..cc815624aacf 100644
--- a/samples/bpf/libbpf.h
+++ b/samples/bpf/libbpf.h
@@ -2,24 +2,9 @@
 #ifndef __LIBBPF_H
 #define __LIBBPF_H
 
-struct bpf_insn;
-
-int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
-		   int max_entries, int map_flags);
-int bpf_map_update_elem(int fd, void *key, void *value, unsigned long long flags);
-int bpf_map_lookup_elem(int fd, void *key, void *value);
-int bpf_map_delete_elem(int fd, void *key);
-int bpf_map_get_next_key(int fd, void *key, void *next_key);
-
-int bpf_load_program(enum bpf_prog_type prog_type,
-		     const struct bpf_insn *insns, int insn_len,
-		     const char *license, int kern_version,
-		     char *log_buf, size_t log_buf_sz);
+#include <bpf/bpf.h>
 
-int bpf_obj_pin(int fd, const char *pathname);
-int bpf_obj_get(const char *pathname);
-
-#define BPF_LOG_BUF_SIZE 65536
+struct bpf_insn;
 
 /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
 
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 62d89d50fcbd..616bd55f3be8 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -149,6 +149,8 @@ CMD_TARGETS = $(LIB_FILE)
 
 TARGETS = $(CMD_TARGETS)
 
+libbpf: all
+
 all: fixdep $(VERSION_FILES) all_cmd
 
 all_cmd: $(CMD_TARGETS)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 13/22] samples/bpf: Remove perf_event_open() declaration
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 12/22] samples/bpf: Switch over to libbpf Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 14/22] samples/bpf: Move open_raw_sock to separate header Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Wang Nan, Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

This declaration was made in samples/bpf/libbpf.c for convenience, but
there's already one in tools/perf/perf-sys.h. Reuse that one.

Committer notes:

Testing it:

  $ make -j4 O=../build/v4.9.0-rc8+ samples/bpf/
  make[1]: Entering directory '/home/build/v4.9.0-rc8+'
    CHK     include/config/kernel.release
    GEN     ./Makefile
    CHK     include/generated/uapi/linux/version.h
    Using /home/acme/git/linux as source for kernel
    CHK     include/generated/utsrelease.h
    CHK     include/generated/timeconst.h
    CHK     include/generated/bounds.h
    CHK     include/generated/asm-offsets.h
    CALL    /home/acme/git/linux/scripts/checksyscalls.sh
    HOSTCC  samples/bpf/test_verifier.o
    HOSTCC  samples/bpf/libbpf.o
    HOSTCC  samples/bpf/../../tools/lib/bpf/bpf.o
    HOSTCC  samples/bpf/test_maps.o
    HOSTCC  samples/bpf/sock_example.o
    HOSTCC  samples/bpf/bpf_load.o
<SNIP>
    HOSTLD  samples/bpf/trace_event
    HOSTLD  samples/bpf/sampleip
    HOSTLD  samples/bpf/tc_l2_redirect
  make[1]: Leaving directory '/home/build/v4.9.0-rc8+'
  $

Signed-off-by: Joe Stringer <joe@ovn.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161209024620.31660-7-joe@ovn.org
[ Use -I$(srctree)/tools/lib/ to support out of source code tree builds ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 samples/bpf/Makefile            | 3 ++-
 samples/bpf/bpf_load.c          | 3 ++-
 samples/bpf/libbpf.c            | 7 -------
 samples/bpf/libbpf.h            | 3 ---
 samples/bpf/sampleip_user.c     | 3 ++-
 samples/bpf/trace_event_user.c  | 9 +++++----
 samples/bpf/trace_output_user.c | 3 ++-
 samples/bpf/tracex6_user.c      | 3 ++-
 8 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 7307b2bf43be..0bcc3906361b 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -92,7 +92,8 @@ always += test_current_task_under_cgroup_kern.o
 always += trace_event_kern.o
 always += sampleip_kern.o
 
-HOSTCFLAGS += -I$(objtree)/usr/include -I$(srctree)/tools/lib/
+HOSTCFLAGS += -I$(objtree)/usr/include -I$(srctree)/tools/lib/ \
+	      -I$(srctree)/tools/include -I$(srctree)/tools/perf
 
 HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
 HOSTLOADLIBES_fds_example += -lelf
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index f8e3c58a0897..d683bd278171 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -19,6 +19,7 @@
 #include <ctype.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define DEBUGFS "/sys/kernel/debug/tracing/"
 
@@ -168,7 +169,7 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
 	id = atoi(buf);
 	attr.config = id;
 
-	efd = perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
+	efd = sys_perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
 	if (efd < 0) {
 		printf("event %d fd %d err %s\n", id, efd, strerror(errno));
 		return -1;
diff --git a/samples/bpf/libbpf.c b/samples/bpf/libbpf.c
index d9af876b4a2c..bee473a494f1 100644
--- a/samples/bpf/libbpf.c
+++ b/samples/bpf/libbpf.c
@@ -34,10 +34,3 @@ int open_raw_sock(const char *name)
 
 	return sock;
 }
-
-int perf_event_open(struct perf_event_attr *attr, int pid, int cpu,
-		    int group_fd, unsigned long flags)
-{
-	return syscall(__NR_perf_event_open, attr, pid, cpu,
-		       group_fd, flags);
-}
diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h
index cc815624aacf..09aedc320009 100644
--- a/samples/bpf/libbpf.h
+++ b/samples/bpf/libbpf.h
@@ -188,7 +188,4 @@ struct bpf_insn;
 /* create RAW socket and bind to interface 'name' */
 int open_raw_sock(const char *name);
 
-struct perf_event_attr;
-int perf_event_open(struct perf_event_attr *attr, int pid, int cpu,
-		    int group_fd, unsigned long flags);
 #endif
diff --git a/samples/bpf/sampleip_user.c b/samples/bpf/sampleip_user.c
index 09ab620b324c..476a11947180 100644
--- a/samples/bpf/sampleip_user.c
+++ b/samples/bpf/sampleip_user.c
@@ -21,6 +21,7 @@
 #include <sys/ioctl.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define DEFAULT_FREQ	99
 #define DEFAULT_SECS	5
@@ -50,7 +51,7 @@ static int sampling_start(int *pmu_fd, int freq)
 	};
 
 	for (i = 0; i < nr_cpus; i++) {
-		pmu_fd[i] = perf_event_open(&pe_sample_attr, -1 /* pid */, i,
+		pmu_fd[i] = sys_perf_event_open(&pe_sample_attr, -1 /* pid */, i,
 					    -1 /* group_fd */, 0 /* flags */);
 		if (pmu_fd[i] < 0) {
 			fprintf(stderr, "ERROR: Initializing perf sampling\n");
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index de8fd0266d78..ccb0cba8324a 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -20,6 +20,7 @@
 #include <sys/resource.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define SAMPLE_FREQ 50
 
@@ -126,9 +127,9 @@ static void test_perf_event_all_cpu(struct perf_event_attr *attr)
 
 	/* open perf_event on all cpus */
 	for (i = 0; i < nr_cpus; i++) {
-		pmu_fd[i] = perf_event_open(attr, -1, i, -1, 0);
+		pmu_fd[i] = sys_perf_event_open(attr, -1, i, -1, 0);
 		if (pmu_fd[i] < 0) {
-			printf("perf_event_open failed\n");
+			printf("sys_perf_event_open failed\n");
 			goto all_cpu_err;
 		}
 		assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
@@ -147,9 +148,9 @@ static void test_perf_event_task(struct perf_event_attr *attr)
 	int pmu_fd;
 
 	/* open task bound event */
-	pmu_fd = perf_event_open(attr, 0, -1, -1, 0);
+	pmu_fd = sys_perf_event_open(attr, 0, -1, -1, 0);
 	if (pmu_fd < 0) {
-		printf("perf_event_open failed\n");
+		printf("sys_perf_event_open failed\n");
 		return;
 	}
 	assert(ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0);
diff --git a/samples/bpf/trace_output_user.c b/samples/bpf/trace_output_user.c
index 9c38f7aa4515..64e692fd7d51 100644
--- a/samples/bpf/trace_output_user.c
+++ b/samples/bpf/trace_output_user.c
@@ -21,6 +21,7 @@
 #include <signal.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 static int pmu_fd;
 
@@ -160,7 +161,7 @@ static void test_bpf_perf_event(void)
 	};
 	int key = 0;
 
-	pmu_fd = perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
+	pmu_fd = sys_perf_event_open(&attr, -1/*pid*/, 0/*cpu*/, -1/*group_fd*/, 0);
 
 	assert(pmu_fd >= 0);
 	assert(bpf_map_update_elem(map_fd[0], &key, &pmu_fd, BPF_ANY) == 0);
diff --git a/samples/bpf/tracex6_user.c b/samples/bpf/tracex6_user.c
index 7a3b4a4b19f3..1681cb7cd713 100644
--- a/samples/bpf/tracex6_user.c
+++ b/samples/bpf/tracex6_user.c
@@ -10,6 +10,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define SAMPLE_PERIOD  0x7fffffffffffffffULL
 
@@ -32,7 +33,7 @@ static void test_bpf_perf_event(void)
 	};
 
 	for (i = 0; i < nr_cpus; i++) {
-		pmu_fd[i] = perf_event_open(&attr_insn_pmu, -1/*pid*/, i/*cpu*/, -1/*group_fd*/, 0);
+		pmu_fd[i] = sys_perf_event_open(&attr_insn_pmu, -1/*pid*/, i/*cpu*/, -1/*group_fd*/, 0);
 		if (pmu_fd[i] < 0) {
 			printf("event syscall failed\n");
 			goto exit;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 14/22] samples/bpf: Move open_raw_sock to separate header
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 13/22] samples/bpf: Remove perf_event_open() declaration Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 15/22] perf sdt: Add scanning of sdt probles arguments Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Wang Nan, Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

This function was declared in libbpf.c and was the only remaining
function in this library, but has nothing to do with BPF. Shift it out
into a new header, sock_example.h, and include it from the relevant
samples.

Signed-off-by: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161209024620.31660-8-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 samples/bpf/Makefile                     | 2 +-
 samples/bpf/fds_example.c                | 1 +
 samples/bpf/libbpf.h                     | 3 ---
 samples/bpf/sock_example.c               | 1 +
 samples/bpf/{libbpf.c => sock_example.h} | 3 +--
 samples/bpf/sockex1_user.c               | 1 +
 samples/bpf/sockex2_user.c               | 1 +
 samples/bpf/sockex3_user.c               | 1 +
 8 files changed, 7 insertions(+), 6 deletions(-)
 rename samples/bpf/{libbpf.c => sock_example.h} (92%)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 0bcc3906361b..9ffa6a2c061d 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -30,7 +30,7 @@ hostprogs-y += sampleip
 hostprogs-y += tc_l2_redirect
 
 # Libbpf dependencies
-LIBBPF := libbpf.o ../../tools/lib/bpf/bpf.o
+LIBBPF := ../../tools/lib/bpf/bpf.o
 
 test_verifier-objs := test_verifier.o $(LIBBPF)
 test_maps-objs := test_maps.o $(LIBBPF)
diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c
index 4ffd8f340496..7ae3b19f5c42 100644
--- a/samples/bpf/fds_example.c
+++ b/samples/bpf/fds_example.c
@@ -14,6 +14,7 @@
 
 #include "bpf_load.h"
 #include "libbpf.h"
+#include "sock_example.h"
 
 #define BPF_F_PIN	(1 << 0)
 #define BPF_F_GET	(1 << 1)
diff --git a/samples/bpf/libbpf.h b/samples/bpf/libbpf.h
index 09aedc320009..3705fba453a0 100644
--- a/samples/bpf/libbpf.h
+++ b/samples/bpf/libbpf.h
@@ -185,7 +185,4 @@ struct bpf_insn;
 		.off   = 0,					\
 		.imm   = 0 })
 
-/* create RAW socket and bind to interface 'name' */
-int open_raw_sock(const char *name);
-
 #endif
diff --git a/samples/bpf/sock_example.c b/samples/bpf/sock_example.c
index 7ab636c30154..bb418fd0a1f2 100644
--- a/samples/bpf/sock_example.c
+++ b/samples/bpf/sock_example.c
@@ -27,6 +27,7 @@
 #include <linux/ip.h>
 #include <stddef.h>
 #include "libbpf.h"
+#include "sock_example.h"
 
 static int test_sock(void)
 {
diff --git a/samples/bpf/libbpf.c b/samples/bpf/sock_example.h
similarity index 92%
rename from samples/bpf/libbpf.c
rename to samples/bpf/sock_example.h
index bee473a494f1..09f7fe7e5fd7 100644
--- a/samples/bpf/libbpf.c
+++ b/samples/bpf/sock_example.h
@@ -1,4 +1,3 @@
-/* eBPF mini library */
 #include <stdlib.h>
 #include <stdio.h>
 #include <linux/unistd.h>
@@ -11,7 +10,7 @@
 #include <arpa/inet.h>
 #include "libbpf.h"
 
-int open_raw_sock(const char *name)
+static inline int open_raw_sock(const char *name)
 {
 	struct sockaddr_ll sll;
 	int sock;
diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c
index 2956d893d732..5cdddc5c9015 100644
--- a/samples/bpf/sockex1_user.c
+++ b/samples/bpf/sockex1_user.c
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c
index c43958a67cca..7ae4e2e5cf3a 100644
--- a/samples/bpf/sockex2_user.c
+++ b/samples/bpf/sockex2_user.c
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/resource.h>
diff --git a/samples/bpf/sockex3_user.c b/samples/bpf/sockex3_user.c
index 2cb9011ea440..a100cf6c95bb 100644
--- a/samples/bpf/sockex3_user.c
+++ b/samples/bpf/sockex3_user.c
@@ -3,6 +3,7 @@
 #include <linux/bpf.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "sock_example.h"
 #include <unistd.h>
 #include <arpa/inet.h>
 #include <sys/resource.h>
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 15/22] perf sdt: Add scanning of sdt probles arguments
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 14/22] samples/bpf: Move open_raw_sock to separate header Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 16/22] perf tools: Remove some needless __maybe_unused Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Alexis Berlemont, Alexander Shishkin, Hemant Kumar,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Alexis Berlemont <alexis.berlemont@gmail.com>

During a "perf buildid-cache --add" command, the section ".note.stapsdt"
of the "added" binary is scanned in order to list the available SDT
markers available in a binary. The parts containing the probes arguments
were left unscanned.

The whole section is now parsed; the probe arguments are extracted for
later use.

Signed-off-by: Alexis Berlemont <alexis.berlemont@gmail.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161126005803.25693-2-alexis.berlemont@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol-elf.c | 25 +++++++++++++++++++++++--
 tools/perf/util/symbol.h     |  1 +
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 99400b0e8f2a..7725c3f9d6a2 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1822,7 +1822,7 @@ void kcore_extract__delete(struct kcore_extract *kce)
 static int populate_sdt_note(Elf **elf, const char *data, size_t len,
 			     struct list_head *sdt_notes)
 {
-	const char *provider, *name;
+	const char *provider, *name, *args;
 	struct sdt_note *tmp = NULL;
 	GElf_Ehdr ehdr;
 	GElf_Addr base_off = 0;
@@ -1881,6 +1881,25 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len,
 		goto out_free_prov;
 	}
 
+	args = memchr(name, '\0', data + len - name);
+
+	/*
+	 * There is no argument if:
+	 * - We reached the end of the note;
+	 * - There is not enough room to hold a potential string;
+	 * - The argument string is empty or just contains ':'.
+	 */
+	if (args == NULL || data + len - args < 2 ||
+		args[1] == ':' || args[1] == '\0')
+		tmp->args = NULL;
+	else {
+		tmp->args = strdup(++args);
+		if (!tmp->args) {
+			ret = -ENOMEM;
+			goto out_free_name;
+		}
+	}
+
 	if (gelf_getclass(*elf) == ELFCLASS32) {
 		memcpy(&tmp->addr, &buf, 3 * sizeof(Elf32_Addr));
 		tmp->bit32 = true;
@@ -1892,7 +1911,7 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len,
 	if (!gelf_getehdr(*elf, &ehdr)) {
 		pr_debug("%s : cannot get elf header.\n", __func__);
 		ret = -EBADF;
-		goto out_free_name;
+		goto out_free_args;
 	}
 
 	/* Adjust the prelink effect :
@@ -1917,6 +1936,8 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len,
 	list_add_tail(&tmp->note_list, sdt_notes);
 	return 0;
 
+out_free_args:
+	free(tmp->args);
 out_free_name:
 	free(tmp->name);
 out_free_prov:
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 6c358b7ed336..9222c7e702f3 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -351,6 +351,7 @@ int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);
 struct sdt_note {
 	char *name;			/* name of the note*/
 	char *provider;			/* provider name */
+	char *args;
 	bool bit32;			/* whether the location is 32 bits? */
 	union {				/* location, base and semaphore addrs */
 		Elf64_Addr a64[3];
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 16/22] perf tools: Remove some needless __maybe_unused
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 15/22] perf sdt: Add scanning of sdt probles arguments Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 17/22] perf mem: Fix --all-user/--all-kernel options Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

I.e. those parameters/functions _are_ used, so ditch that misleading attribute.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-13cqtjh0yojg5gzvpq1zzpl0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-c2c.c    | 13 ++++++-------
 tools/perf/builtin-report.c |  2 +-
 tools/perf/builtin-stat.c   |  6 +++---
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 4b419631753d..f8ca7a4ebabc 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -208,7 +208,7 @@ static void compute_stats(struct c2c_hist_entry *c2c_he,
 static int process_sample_event(struct perf_tool *tool __maybe_unused,
 				union perf_event *event,
 				struct perf_sample *sample,
-				struct perf_evsel *evsel __maybe_unused,
+				struct perf_evsel *evsel,
 				struct machine *machine)
 {
 	struct c2c_hists *c2c_hists = &c2c.hists;
@@ -379,7 +379,7 @@ static int symbol_width(struct hists *hists, struct sort_entry *se)
 
 static int c2c_width(struct perf_hpp_fmt *fmt,
 		     struct perf_hpp *hpp __maybe_unused,
-		     struct hists *hists __maybe_unused)
+		     struct hists *hists)
 {
 	struct c2c_fmt *c2c_fmt;
 	struct c2c_dimension *dim;
@@ -1127,7 +1127,7 @@ MEAN_ENTRY(mean_lcl_entry,  lcl_hitm);
 MEAN_ENTRY(mean_load_entry, load);
 
 static int
-cpucnt_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cpucnt_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 	     struct hist_entry *he)
 {
 	struct c2c_hist_entry *c2c_he;
@@ -1141,7 +1141,7 @@ cpucnt_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
 }
 
 static int
-cl_idx_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cl_idx_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 	     struct hist_entry *he)
 {
 	struct c2c_hist_entry *c2c_he;
@@ -1155,7 +1155,7 @@ cl_idx_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
 }
 
 static int
-cl_idx_empty_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
+cl_idx_empty_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		   struct hist_entry *he)
 {
 	int width = c2c_width(fmt, hpp, he->hists);
@@ -1779,7 +1779,6 @@ static int c2c_hists__init(struct c2c_hists *hists,
 	return hpp_list__parse(&hists->list, NULL, sort);
 }
 
-__maybe_unused
 static int c2c_hists__reinit(struct c2c_hists *c2c_hists,
 			     const char *output,
 			     const char *sort)
@@ -2658,7 +2657,7 @@ static int perf_c2c__report(int argc, const char **argv)
 	return err;
 }
 
-static int parse_record_events(const struct option *opt __maybe_unused,
+static int parse_record_events(const struct option *opt,
 			       const char *str, int unset __maybe_unused)
 {
 	bool *event_set = (bool *) opt->value;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d2afbe4a240d..06cc759a4597 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -648,7 +648,7 @@ report_parse_ignore_callees_opt(const struct option *opt __maybe_unused,
 }
 
 static int
-parse_branch_mode(const struct option *opt __maybe_unused,
+parse_branch_mode(const struct option *opt,
 		  const char *str __maybe_unused, int unset)
 {
 	int *branch_mode = opt->value;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 688dea7cb08f..a02f2e965628 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2195,7 +2195,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
 }
 
 static
-int process_stat_config_event(struct perf_tool *tool __maybe_unused,
+int process_stat_config_event(struct perf_tool *tool,
 			      union perf_event *event,
 			      struct perf_session *session __maybe_unused)
 {
@@ -2238,7 +2238,7 @@ static int set_maps(struct perf_stat *st)
 }
 
 static
-int process_thread_map_event(struct perf_tool *tool __maybe_unused,
+int process_thread_map_event(struct perf_tool *tool,
 			     union perf_event *event,
 			     struct perf_session *session __maybe_unused)
 {
@@ -2257,7 +2257,7 @@ int process_thread_map_event(struct perf_tool *tool __maybe_unused,
 }
 
 static
-int process_cpu_map_event(struct perf_tool *tool __maybe_unused,
+int process_cpu_map_event(struct perf_tool *tool,
 			  union perf_event *event,
 			  struct perf_session *session __maybe_unused)
 {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 17/22] perf mem: Fix --all-user/--all-kernel options
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 16/22] perf tools: Remove some needless __maybe_unused Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 18/22] perf evsel: Use variable instead of repeating lengthy FD macro Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Removing extra '--' prefix.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: ad16511b0e40 ("perf mem: Add -U/-K (--all-user/--all-kernel) options")
Link: http://lkml.kernel.org/r/1481538943-21874-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index d1ce29be560e..cd7bc4d104e2 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -70,8 +70,8 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
 	OPT_UINTEGER(0, "ldlat", &perf_mem_events__loads_ldlat, "mem-loads latency"),
 	OPT_INCR('v', "verbose", &verbose,
 		 "be more verbose (show counter open errors, etc)"),
-	OPT_BOOLEAN('U', "--all-user", &all_user, "collect only user level data"),
-	OPT_BOOLEAN('K', "--all-kernel", &all_kernel, "collect only kernel level data"),
+	OPT_BOOLEAN('U', "all-user", &all_user, "collect only user level data"),
+	OPT_BOOLEAN('K', "all-kernel", &all_kernel, "collect only kernel level data"),
 	OPT_END()
 	};
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 18/22] perf evsel: Use variable instead of repeating lengthy FD macro
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 17/22] perf mem: Fix --all-user/--all-kernel options Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 19/22] perf thread_map: Add thread_map__remove function Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

It's more readable and will ease up following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481538943-21874-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index b2365a63db45..fd61ebd77c26 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1474,7 +1474,7 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
 
 		for (thread = 0; thread < nthreads; thread++) {
-			int group_fd;
+			int fd, group_fd;
 
 			if (!evsel->cgrp && !evsel->system_wide)
 				pid = thread_map__pid(threads, thread);
@@ -1484,21 +1484,22 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 			pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 				  pid, cpus->map[cpu], group_fd, flags);
 
-			FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
-								     pid,
-								     cpus->map[cpu],
-								     group_fd, flags);
-			if (FD(evsel, cpu, thread) < 0) {
+			fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
+						 group_fd, flags);
+
+			FD(evsel, cpu, thread) = fd;
+
+			if (fd < 0) {
 				err = -errno;
 				pr_debug2("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+			pr_debug2(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
-				int evt_fd = FD(evsel, cpu, thread);
+				int evt_fd = fd;
 				int bpf_fd = evsel->bpf_fd;
 
 				err = ioctl(evt_fd,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 19/22] perf thread_map: Add thread_map__remove function
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 18/22] perf evsel: Use variable instead of repeating lengthy FD macro Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 20/22] perf evsel: Allow to ignore missing pid Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Add thread_map__remove function to remove thread from thread map.

Add automated test also.

Committer notes:

Testing it:

  # perf test "Remove thread map"
  39: Remove thread map                          : Ok
  # perf test -v "Remove thread map"
  39: Remove thread map                          :
  --- start ---
  test child forked, pid 4483
  2 threads: 4482, 4483
  1 thread: 4483
  0 thread:
  test child finished with 0
  ---- end ----
  Remove thread map: Ok
  #

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481538943-21874-4-git-send-email-jolsa@kernel.org
[ Added stdlib.h, to get the free() declaration ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/builtin-test.c |  4 ++++
 tools/perf/tests/tests.h        |  1 +
 tools/perf/tests/thread-map.c   | 44 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/thread_map.c    | 22 +++++++++++++++++++++
 tools/perf/util/thread_map.h    |  1 +
 5 files changed, 72 insertions(+)

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 23605202d4a1..a77dcc0d24e3 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -186,6 +186,10 @@ static struct test generic_tests[] = {
 		.func = test__thread_map_synthesize,
 	},
 	{
+		.desc = "Remove thread map",
+		.func = test__thread_map_remove,
+	},
+	{
 		.desc = "Synthesize cpu map",
 		.func = test__cpu_map_synthesize,
 	},
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 0d7b251305af..a512f0c8ff5b 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -80,6 +80,7 @@ const char *test__bpf_subtest_get_desc(int subtest);
 int test__bpf_subtest_get_nr(void);
 int test_session_topology(int subtest);
 int test__thread_map_synthesize(int subtest);
+int test__thread_map_remove(int subtest);
 int test__cpu_map_synthesize(int subtest);
 int test__synthesize_stat_config(int subtest);
 int test__synthesize_stat(int subtest);
diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c
index cee2a2cdc933..a4a4b4625ac3 100644
--- a/tools/perf/tests/thread-map.c
+++ b/tools/perf/tests/thread-map.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/prctl.h>
@@ -93,3 +94,46 @@ int test__thread_map_synthesize(int subtest __maybe_unused)
 
 	return 0;
 }
+
+int test__thread_map_remove(int subtest __maybe_unused)
+{
+	struct thread_map *threads;
+	char *str;
+	int i;
+
+	TEST_ASSERT_VAL("failed to allocate map string",
+			asprintf(&str, "%d,%d", getpid(), getppid()) >= 0);
+
+	threads = thread_map__new_str(str, NULL, 0);
+
+	TEST_ASSERT_VAL("failed to allocate thread_map",
+			threads);
+
+	if (verbose)
+		thread_map__fprintf(threads, stderr);
+
+	TEST_ASSERT_VAL("failed to remove thread",
+			!thread_map__remove(threads, 0));
+
+	TEST_ASSERT_VAL("thread_map count != 1", threads->nr == 1);
+
+	if (verbose)
+		thread_map__fprintf(threads, stderr);
+
+	TEST_ASSERT_VAL("failed to remove thread",
+			!thread_map__remove(threads, 0));
+
+	TEST_ASSERT_VAL("thread_map count != 0", threads->nr == 0);
+
+	if (verbose)
+		thread_map__fprintf(threads, stderr);
+
+	TEST_ASSERT_VAL("failed to not remove thread",
+			thread_map__remove(threads, 0));
+
+	for (i = 0; i < threads->nr; i++)
+		free(threads->map[i].comm);
+
+	free(threads);
+	return 0;
+}
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 40585f5b7027..f9eab200fd75 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -448,3 +448,25 @@ bool thread_map__has(struct thread_map *threads, pid_t pid)
 
 	return false;
 }
+
+int thread_map__remove(struct thread_map *threads, int idx)
+{
+	int i;
+
+	if (threads->nr < 1)
+		return -EINVAL;
+
+	if (idx >= threads->nr)
+		return -EINVAL;
+
+	/*
+	 * Free the 'idx' item and shift the rest up.
+	 */
+	free(threads->map[idx].comm);
+
+	for (i = idx; i < threads->nr - 1; i++)
+		threads->map[i] = threads->map[i + 1];
+
+	threads->nr--;
+	return 0;
+}
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index bd3b971588da..ea0ef08c6303 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -58,4 +58,5 @@ static inline char *thread_map__comm(struct thread_map *map, int thread)
 
 void thread_map__read_comms(struct thread_map *threads);
 bool thread_map__has(struct thread_map *threads, pid_t pid);
+int thread_map__remove(struct thread_map *threads, int idx);
 #endif	/* __PERF_THREAD_MAP_H */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 20/22] perf evsel: Allow to ignore missing pid
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 19/22] perf thread_map: Add thread_map__remove function Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 21/22] perf record: Force ignore_missing_thread for uid option Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 22/22] samples/bpf: Drop unnecessary build targets Arnaldo Carvalho de Melo
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding perf_evsel::ignore_missing_cpu_thread bool.

When set true, it allows perf to ignore error of missing pid of perf
event syscall.

We remove missing thread id from the thread_map, so the rest of the
processing like ioctl and mmap won't get disturbed with -1 fd.

The reason for supporting this is to ease up monitoring group of pids,
that 'disappear' before perf opens their event. This currently leads
perf to report error and exit and makes perf record's -u option unusable
under certain setup.

With this change we will allow this race and ignore such failure with
following warning:

  WARNING: Ignored open failure for pid 8605

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20161213074622.GA3084@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf.h       |  1 +
 tools/perf/util/evsel.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.h |  1 +
 3 files changed, 46 insertions(+)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 9a0236a4cf95..1c27d947c2fe 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -55,6 +55,7 @@ struct record_opts {
 	bool	     all_user;
 	bool	     tail_synthesize;
 	bool	     overwrite;
+	bool	     ignore_missing_thread;
 	unsigned int freq;
 	unsigned int mmap_pages;
 	unsigned int auxtrace_mmap_pages;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index fd61ebd77c26..04e536ae4d88 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -990,6 +990,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
 	 * it overloads any global configuration.
 	 */
 	apply_config_terms(evsel, opts);
+
+	evsel->ignore_missing_thread = opts->ignore_missing_thread;
 }
 
 static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
@@ -1419,6 +1421,33 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
 	return fprintf(fp, "  %-32s %s\n", name, val);
 }
 
+static bool ignore_missing_thread(struct perf_evsel *evsel,
+				  struct thread_map *threads,
+				  int thread, int err)
+{
+	if (!evsel->ignore_missing_thread)
+		return false;
+
+	/* The system wide setup does not work with threads. */
+	if (evsel->system_wide)
+		return false;
+
+	/* The -ESRCH is perf event syscall errno for pid's not found. */
+	if (err != -ESRCH)
+		return false;
+
+	/* If there's only one thread, let it fail. */
+	if (threads->nr == 1)
+		return false;
+
+	if (thread_map__remove(threads, thread))
+		return false;
+
+	pr_warning("WARNING: Ignored open failure for pid %d\n",
+		   thread_map__pid(threads, thread));
+	return true;
+}
+
 static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 			      struct thread_map *threads)
 {
@@ -1491,6 +1520,21 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 
 			if (fd < 0) {
 				err = -errno;
+
+				if (ignore_missing_thread(evsel, threads, thread, err)) {
+					/*
+					 * We just removed 1 thread, so take a step
+					 * back on thread index and lower the upper
+					 * nthreads limit.
+					 */
+					nthreads--;
+					thread--;
+
+					/* ... and pretend like nothing have happened. */
+					err = 0;
+					continue;
+				}
+
 				pr_debug2("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 6abb89cd27f9..06ef6f29efa1 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -120,6 +120,7 @@ struct perf_evsel {
 	bool			tracking;
 	bool			per_pkg;
 	bool			precise_max;
+	bool			ignore_missing_thread;
 	/* parse modifier helper */
 	int			exclude_GH;
 	int			nr_members;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 21/22] perf record: Force ignore_missing_thread for uid option
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 20/22] perf evsel: Allow to ignore missing pid Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  2016-12-13 15:09 ` [PATCH 22/22] samples/bpf: Drop unnecessary build targets Arnaldo Carvalho de Melo
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Enable perf_evsel::ignore_missing_thread for -u option to ignore
complete failure if any of the user's processes die between its
enumeration and time we open the event.

Committer notes:

While doing a 'make -j4 allmodconfig' we sometimes get into the race:

Before:

  # perf record -u acme
  Error:
  The sys_perf_event_open() syscall returned with 3 (No such process) for event (cycles:ppp).
  /bin/dmesg may provide additional information.
  No CONFIG_PERF_EVENTS=y kernel support configured?
  #

After:

  [root@jouet ~]# perf record -u acme
  WARNING: Ignored open failure for pid 9888
  WARNING: Ignored open failure for pid 18059
  [root@jouet ~]#

Which is an improvement, with the races not preventing the remaining threads
for the specified user from being monitored, but the message probably needs
further clarification.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481538943-21874-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index fa26865364b6..74d6a035133a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1687,6 +1687,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 		goto out;
 	}
 
+	/* Enable ignoring missing threads when -u option is defined. */
+	rec->opts.ignore_missing_thread = rec->opts.target.uid != UINT_MAX;
+
 	err = -ENOMEM;
 	if (perf_evlist__create_maps(rec->evlist, &rec->opts.target) < 0)
 		usage_with_options(record_usage, record_options);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 22/22] samples/bpf: Drop unnecessary build targets.
  2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2016-12-13 15:09 ` [PATCH 21/22] perf record: Force ignore_missing_thread for uid option Arnaldo Carvalho de Melo
@ 2016-12-13 15:09 ` Arnaldo Carvalho de Melo
  21 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-13 15:09 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Joe Stringer, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo

From: Joe Stringer <joe@ovn.org>

Commit f72179ef11db ("samples/bpf: Switch over to libbpf") added these
two makefile changes that were unnecessary for switching samples to use
libbpf. The extra make is already handled by the build dependency, and
libbpf target doesn't build because it lacks main(). Remove these.

Reported-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Link: http://lkml.kernel.org/r/20161209175109.6779-1-joe@ovn.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 samples/bpf/Makefile   | 1 -
 tools/lib/bpf/Makefile | 2 --
 2 files changed, 3 deletions(-)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 9ffa6a2c061d..60ffc8115b67 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -127,7 +127,6 @@ CLANG ?= clang
 
 # Trick to allow make to be run from this directory
 all:
-	$(MAKE) -C ../../ tools/lib/bpf/
 	$(MAKE) -C ../../ $$PWD/
 
 clean:
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 616bd55f3be8..62d89d50fcbd 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -149,8 +149,6 @@ CMD_TARGETS = $(LIB_FILE)
 
 TARGETS = $(CMD_TARGETS)
 
-libbpf: all
-
 all: fixdep $(VERSION_FILES) all_cmd
 
 all_cmd: $(CMD_TARGETS)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2018-11-30 18:26 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-11-30 18:26 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Clark Williams, linux-kernel, linux-perf-users,
	Arnaldo Carvalho de Melo, Adrian Hunter, Alexander Shishkin,
	Alexei Starovoitov, Alexey Budankov, Andi Kleen, Anton Blanchard,
	Daniel Borkmann, David Ahern, David Howells, David S . Miller,
	Eric Saint-Etienne, Ivan Babrou, Jin Yao, Jiri Olsa,
	Julia Lawall, Leo Yan, Mathieu Poirier, Namhyung Kim,
	Peter Zijlstra, Ravi Bangoria, Slavomir Kaslev, Stephane Eranian,
	Steven Rostedt, Thomas Richter, Tzvetomir Stoyanov, Wang Nan,
	Wen Yang, yuzhoujian, zhong.weidong, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, more to come,

Regards,

- Arnaldo

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

The following changes since commit b1a9d7b0190119dad5b9b7841751b5a7586bbc8b:

  Merge tag 'perf-urgent-for-mingo-4.20-20181121' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2018-11-21 15:57:21 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 09d3f015d1e1b4fee7e9bbdcf54201d239393391:

  uprobes: Fix handle_swbp() vs. unregister() + register() race once more (2018-11-23 08:31:19 +0100)

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

- Introduce 'perf record --aio' to use asynchronous IO trace writing in
  'perf record' disabled by default, i.e. one needs to explicitly use
  'perf record --aio' to use it, in which case the number of AIO aiocb
  structs will be one, specify 'perf record --aio=N' to ask for more,
  according to your needs, related to the number of processors in your
  machine. Reports about the effectiveness of this option are welcome
  so that we can decide on making it the default mode of operation. Read
  the respective patches commit logs for further information (Alexey Budankov)

- Add fallback routines to be used in places where we don't have the cpu mode
  (kernel/user space/hypervisor) and thus must first fallback lookups looking
  at all map trees when trying to resolve symbols (Adrian Hunter)

- Introduce 'perf top --kallsyms file' to match 'perf report --kallsyms', useful
  when dealing with BPF, where symbol resolution happens via kallsyms, not via
  the default vmlinux ELF symtabs (Arnaldo Carvalho de Melo)

- Fix CSV mode column output for non-cgroup events in 'perf stat' (Stephane Eranian)

- Fix 'perf stat' shadow stats for clock events. (Ravi Bangoria)

- Fix error with config term "pt=0", where we should just force "pt=1" and
  warn the user about the former being non-sensical (Adrian Hunter)

- Fix 'perf test' entry where we expect 'sleep' to come in a PERF_RECORD_COMM
  but instead we get 'coreutils' when sleep is provided by some versions of
  the 'coreutils' package (Adrian Hunter)

- Remove needless rb_tree extra indirection from map__find() (Eric Saint-Etienne)

- Add sanity check to libtraceevent's is_timestamp_in_us() (Tzvetomir Stoyanov)

- Use ERR_CAST instead of ERR_PTR(PTR_ERR()) (Wen Yang)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andrea Parri (1):
      uprobes: Fix handle_swbp() vs. unregister() + register() race once more

Jiri Olsa (3):
      perf/x86/intel: Move branch tracing setup to the Intel-specific source file
      perf/x86/intel: Add generic branch tracing check to intel_pmu_has_bts()
      perf/x86/intel: Disallow precise_ip on BTS events

 arch/x86/events/core.c       | 20 ----------------
 arch/x86/events/intel/core.c | 56 ++++++++++++++++++++++++++++++++++----------
 arch/x86/events/perf_event.h | 13 ++++++----
 kernel/events/uprobes.c      | 12 ++++++++--
 4 files changed, 63 insertions(+), 38 deletions(-)

Test results:

XXX: Investigation on the watchpoint and breakpoint 'perf test' failures is
     underway, doesn't look like related to patches in this batch.

The first ones are container (docker) 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.

  # dm
   1 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   6 alpine:edge                   : Ok   gcc (Alpine 6.4.0) 6.4.0
   7 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
   8 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
   9 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  10 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  11 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  12 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  13 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
  14 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 8.2.1 20180502
  15 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  16 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u1) 4.9.2
  17 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
  18 debian:experimental           : Ok   gcc (Debian 8.2.0-10) 8.2.0
  19 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.2.0-10) 8.2.0
  20 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 8.2.0-7) 8.2.0
  21 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 8.2.0-10) 8.2.0
  22 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 8.2.0-7) 8.2.0
  23 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  24 fedora:21                     : Ok   gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
  25 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  26 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  27 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  28 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  29 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  30 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
  31 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
  32 fedora:28                     : Ok   gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
  33 fedora:29                     : Ok   gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4)
  34 fedora:rawhide                : Ok   gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4)
  35 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
  36 mageia:5                      : Ok   gcc (GCC) 4.9.2
  37 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0
  38 opensuse:13.2                 : Ok   gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
  39 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  40 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  41 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  42 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
  43 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  44 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)
  45 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  46 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
  47 ubuntu:14.04.4-x-linaro-arm64 : Ok   aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
  48 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  49 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  50 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  51 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  52 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  53 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  54 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  55 ubuntu:16.10                  : Ok   gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
  56 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
  57 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  58 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
  59 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
  60 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  61 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  62 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  63 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  64 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  65 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  66 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  67 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  68 ubuntu:18.10                  : Ok   gcc (Ubuntu 8.2.0-7ubuntu1) 8.2.0
  # 

  # uname -a
  Linux seventh 4.18.19-100.fc27.x86_64 #1 SMP Wed Nov 14 22:04:34 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  # git log --oneline -1
  ceed7c10bbb4 tools lib traceevent: Add sanity check to is_timestamp_in_us()
  # perf version --build-options
  perf version 4.20.rc3.gceed7c
                   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
  # 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                                   : FAILED!
  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: x86 rdpmc                                             : Ok
  60: Convert perf time to TSC                              : Ok
  61: DWARF unwind                                          : Ok
  62: x86 instruction decoder - new instructions            : Ok
  63: x86 bp modify                                         : FAILED!
  64: probe libc's inet_pton & backtrace it with ping       : Ok
  65: Check open filename arg using perf trace + vfs_getname: Ok
  66: Use vfs_getname probe to get syscall args filenames   : Ok
  67: Add vfs_getname probe to get syscall args filenames   : Ok

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
             make_util_map_o_O: make util/map.o
       make_util_pmu_bison_o_O: make util/pmu-bison.o
                   make_help_O: make help
         make_with_clangllvm_O: make LIBCLANGLLVM=1
         make_install_prefix_O: make install prefix=/tmp/krava
           make_no_libbionic_O: make NO_LIBBIONIC=1
                make_no_newt_O: make NO_NEWT=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
                make_install_O: make install
            make_no_auxtrace_O: make NO_AUXTRACE=1
                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
                  make_debug_O: make DEBUG=1
                    make_doc_O: make doc
              make_no_libbpf_O: make NO_LIBBPF=1
              make_no_libelf_O: make NO_LIBELF=1
                make_no_gtk2_O: make NO_GTK2=1
               make_no_slang_O: make NO_SLANG=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
            make_no_demangle_O: make NO_DEMANGLE=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
           make_no_backtrace_O: make NO_BACKTRACE=1
             make_no_libnuma_O: make NO_LIBNUMA=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
                 make_perf_o_O: make perf.o
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
           make_no_libpython_O: make NO_LIBPYTHON=1
            make_install_bin_O: make install-bin
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
                   make_pure_O: make
             make_no_libperl_O: make NO_LIBPERL=1
              make_clean_all_O: make clean all
                 make_static_O: make LDFLAGS=-static
                   make_tags_O: make tags
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2017-04-24 19:54 Arnaldo Carvalho de Melo
@ 2017-04-24 20:40 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2017-04-24 20:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Al Viro, Andi Kleen, David Ahern,
	David Howells, Jiri Olsa, Kyle Huey, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian, Taeung Song, Thomas Gleixner,
	Tony Luck, Wang Nan, Yao Jin, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider applying,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 07590a7d4030c159b9a0d7171f81049a9ce23245:
> 
>   Merge tag 'perf-core-for-mingo-4.12-20170419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-04-20 10:07:18 +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-4.12-20170424
> 
> for you to fetch changes up to 9d43f5e8df6804ae271407500af9062e9278167a:
> 
>   perf tools: Fix the code to strip command name (2017-04-24 13:43:37 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Fix display of data source snoop indication in 'perf mem' (Andi Kleen)
> 
> - Fix the code to strip command name from /proc/PID/stat (Jiri Olsa)
> 
> Infrastructure:
> 
> - Continue the disentanglement of headers, specially util.h (Arnaldo Carvalho de Melo)
> 
> - Synchronize some header files with the kernel (Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (1):
>       perf mem: Fix display of data source snoop indication
> 
> Arnaldo Carvalho de Melo (20):
>       perf unwind: Provide only forward declarations for pointer types
>       perf tools: Add signal.h to places using its definitions
>       perf tools: Move units conversion/formatting routines to separate object
>       perf tools: Move timestamp routines from util.h to time-utils.h
>       perf kvm: Make function only used by 'perf kvm' static
>       perf debug: Move dump_stack() and sighandler_dump_stack() to debug.h
>       perf tools: Add compress.h for the *_decompress_to_file() headers
>       perf callchain: Move callchain specific routines from util.[ch]
>       perf tools: Include sys/param.h where needed
>       perf tools: Remove a few more needless includes from util.h
>       perf tools: Remove sys/ioctl.h from util.h
>       perf tools: Remove string.h from util.h
>       perf tools: Remove stale prototypes from builtin.h
>       perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
>       perf tools: Remove poll.h and wait.h from util.h
>       perf tools: Add the right header to obtain PERF_ALIGN()
>       perf tools: Use just forward declarations for struct thread where possible
>       tools: Update asm-generic/mman-common.h copy from the kernel
>       tools arch: Sync arch/x86/lib/memcpy_64.S with the kernel
>       tools arch x86: Sync cpufeatures.h
> 
> Jiri Olsa (1):
>       perf tools: Fix the code to strip command name
> 
>  tools/arch/x86/include/asm/cpufeatures.h  |   1 +
>  tools/arch/x86/lib/memcpy_64.S            |   2 +-
>  tools/include/uapi/linux/stat.h           |   5 +-
>  tools/lib/subcmd/help.h                   |   1 +
>  tools/perf/arch/arm/util/cs-etm.c         |   1 +
>  tools/perf/arch/arm/util/unwind-libdw.c   |   1 +
>  tools/perf/arch/arm64/util/dwarf-regs.c   |   1 +
>  tools/perf/arch/x86/tests/intel-cqm.c     |   2 +
>  tools/perf/arch/x86/util/unwind-libdw.c   |   1 +
>  tools/perf/builtin-buildid-cache.c        |   1 +
>  tools/perf/builtin-c2c.c                  |   2 +
>  tools/perf/builtin-ftrace.c               |   1 +
>  tools/perf/builtin-help.c                 |   4 +
>  tools/perf/builtin-inject.c               |   2 +
>  tools/perf/builtin-kvm.c                  |  17 +++
>  tools/perf/builtin-mem.c                  |   4 +
>  tools/perf/builtin-record.c               |   5 +
>  tools/perf/builtin-report.c               |   5 +
>  tools/perf/builtin-script.c               |   5 +
>  tools/perf/builtin-stat.c                 |   5 +
>  tools/perf/builtin-timechart.c            |   1 +
>  tools/perf/builtin-top.c                  |   1 +
>  tools/perf/builtin-trace.c                |   2 +
>  tools/perf/builtin-version.c              |   3 +-
>  tools/perf/builtin.h                      |   4 -
>  tools/perf/perf.c                         |   6 +-
>  tools/perf/tests/attr.c                   |   4 +
>  tools/perf/tests/bpf.c                    |   2 +
>  tools/perf/tests/builtin-test.c           |   1 +
>  tools/perf/tests/code-reading.c           |   1 +
>  tools/perf/tests/event-times.c            |   1 +
>  tools/perf/tests/parse-events.c           |   3 +
>  tools/perf/tests/unit_number__scnprintf.c |   2 +-
>  tools/perf/trace/beauty/signum.c          |   1 +
>  tools/perf/ui/browsers/hists.c            |   2 +
>  tools/perf/ui/gtk/annotate.c              |   1 +
>  tools/perf/ui/gtk/hists.c                 |   1 +
>  tools/perf/ui/stdio/hist.c                |   1 +
>  tools/perf/util/Build                     |   1 +
>  tools/perf/util/build-id.c                |   3 +
>  tools/perf/util/callchain.c               | 103 +++++++++++++++
>  tools/perf/util/color.h                   |   2 +
>  tools/perf/util/comm.c                    |   1 +
>  tools/perf/util/compress.h                |  12 ++
>  tools/perf/util/config.c                  |   4 +
>  tools/perf/util/debug.c                   |  33 ++++-
>  tools/perf/util/debug.h                   |   3 +
>  tools/perf/util/dso.c                     |   4 +
>  tools/perf/util/event.c                   |  12 +-
>  tools/perf/util/event.h                   |   2 +-
>  tools/perf/util/evlist.c                  |   3 +
>  tools/perf/util/evlist.h                  |   1 +
>  tools/perf/util/evsel.c                   |   1 +
>  tools/perf/util/header.c                  |   4 +
>  tools/perf/util/help-unknown-cmd.c        |   1 +
>  tools/perf/util/hist.c                    |   2 +
>  tools/perf/util/llvm-utils.c              |   1 +
>  tools/perf/util/lzma.c                    |   1 +
>  tools/perf/util/machine.c                 |   3 +
>  tools/perf/util/mem-events.c              |   2 +-
>  tools/perf/util/namespaces.c              |   1 +
>  tools/perf/util/parse-events.c            |   2 +
>  tools/perf/util/pmu.c                     |   1 +
>  tools/perf/util/probe-file.c              |   3 +
>  tools/perf/util/python-ext-sources        |   1 +
>  tools/perf/util/python.c                  |  13 ++
>  tools/perf/util/session.c                 |   1 +
>  tools/perf/util/session.h                 |   3 +-
>  tools/perf/util/sort.c                    |   1 +
>  tools/perf/util/sort.h                    |   3 +-
>  tools/perf/util/strlist.c                 |   1 +
>  tools/perf/util/time-utils.c              |  25 ++++
>  tools/perf/util/time-utils.h              |   7 +
>  tools/perf/util/top.h                     |   2 +-
>  tools/perf/util/units.c                   |  39 ++++++
>  tools/perf/util/units.h                   |  10 ++
>  tools/perf/util/unwind-libdw.h            |   6 +-
>  tools/perf/util/unwind.h                  |   9 +-
>  tools/perf/util/util.c                    | 211 +-----------------------------
>  tools/perf/util/util.h                    |  38 ------
>  tools/perf/util/xyarray.c                 |   2 +
>  tools/perf/util/zlib.c                    |   1 +
>  82 files changed, 412 insertions(+), 270 deletions(-)
>  create mode 100644 tools/perf/util/compress.h
>  create mode 100644 tools/perf/util/units.c
>  create mode 100644 tools/perf/util/units.h

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2017-04-24 19:54 Arnaldo Carvalho de Melo
  2017-04-24 20:40 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-04-24 19:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter, Al Viro,
	Andi Kleen, David Ahern, David Howells, Jiri Olsa, Kyle Huey,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian, Taeung Song,
	Thomas Gleixner, Tony Luck, Wang Nan, Yao Jin,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider applying,

- Arnaldo

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

The following changes since commit 07590a7d4030c159b9a0d7171f81049a9ce23245:

  Merge tag 'perf-core-for-mingo-4.12-20170419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-04-20 10:07:18 +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-4.12-20170424

for you to fetch changes up to 9d43f5e8df6804ae271407500af9062e9278167a:

  perf tools: Fix the code to strip command name (2017-04-24 13:43:37 -0300)

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

User visible:

- Fix display of data source snoop indication in 'perf mem' (Andi Kleen)

- Fix the code to strip command name from /proc/PID/stat (Jiri Olsa)

Infrastructure:

- Continue the disentanglement of headers, specially util.h (Arnaldo Carvalho de Melo)

- Synchronize some header files with the kernel (Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (1):
      perf mem: Fix display of data source snoop indication

Arnaldo Carvalho de Melo (20):
      perf unwind: Provide only forward declarations for pointer types
      perf tools: Add signal.h to places using its definitions
      perf tools: Move units conversion/formatting routines to separate object
      perf tools: Move timestamp routines from util.h to time-utils.h
      perf kvm: Make function only used by 'perf kvm' static
      perf debug: Move dump_stack() and sighandler_dump_stack() to debug.h
      perf tools: Add compress.h for the *_decompress_to_file() headers
      perf callchain: Move callchain specific routines from util.[ch]
      perf tools: Include sys/param.h where needed
      perf tools: Remove a few more needless includes from util.h
      perf tools: Remove sys/ioctl.h from util.h
      perf tools: Remove string.h from util.h
      perf tools: Remove stale prototypes from builtin.h
      perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
      perf tools: Remove poll.h and wait.h from util.h
      perf tools: Add the right header to obtain PERF_ALIGN()
      perf tools: Use just forward declarations for struct thread where possible
      tools: Update asm-generic/mman-common.h copy from the kernel
      tools arch: Sync arch/x86/lib/memcpy_64.S with the kernel
      tools arch x86: Sync cpufeatures.h

Jiri Olsa (1):
      perf tools: Fix the code to strip command name

 tools/arch/x86/include/asm/cpufeatures.h  |   1 +
 tools/arch/x86/lib/memcpy_64.S            |   2 +-
 tools/include/uapi/linux/stat.h           |   5 +-
 tools/lib/subcmd/help.h                   |   1 +
 tools/perf/arch/arm/util/cs-etm.c         |   1 +
 tools/perf/arch/arm/util/unwind-libdw.c   |   1 +
 tools/perf/arch/arm64/util/dwarf-regs.c   |   1 +
 tools/perf/arch/x86/tests/intel-cqm.c     |   2 +
 tools/perf/arch/x86/util/unwind-libdw.c   |   1 +
 tools/perf/builtin-buildid-cache.c        |   1 +
 tools/perf/builtin-c2c.c                  |   2 +
 tools/perf/builtin-ftrace.c               |   1 +
 tools/perf/builtin-help.c                 |   4 +
 tools/perf/builtin-inject.c               |   2 +
 tools/perf/builtin-kvm.c                  |  17 +++
 tools/perf/builtin-mem.c                  |   4 +
 tools/perf/builtin-record.c               |   5 +
 tools/perf/builtin-report.c               |   5 +
 tools/perf/builtin-script.c               |   5 +
 tools/perf/builtin-stat.c                 |   5 +
 tools/perf/builtin-timechart.c            |   1 +
 tools/perf/builtin-top.c                  |   1 +
 tools/perf/builtin-trace.c                |   2 +
 tools/perf/builtin-version.c              |   3 +-
 tools/perf/builtin.h                      |   4 -
 tools/perf/perf.c                         |   6 +-
 tools/perf/tests/attr.c                   |   4 +
 tools/perf/tests/bpf.c                    |   2 +
 tools/perf/tests/builtin-test.c           |   1 +
 tools/perf/tests/code-reading.c           |   1 +
 tools/perf/tests/event-times.c            |   1 +
 tools/perf/tests/parse-events.c           |   3 +
 tools/perf/tests/unit_number__scnprintf.c |   2 +-
 tools/perf/trace/beauty/signum.c          |   1 +
 tools/perf/ui/browsers/hists.c            |   2 +
 tools/perf/ui/gtk/annotate.c              |   1 +
 tools/perf/ui/gtk/hists.c                 |   1 +
 tools/perf/ui/stdio/hist.c                |   1 +
 tools/perf/util/Build                     |   1 +
 tools/perf/util/build-id.c                |   3 +
 tools/perf/util/callchain.c               | 103 +++++++++++++++
 tools/perf/util/color.h                   |   2 +
 tools/perf/util/comm.c                    |   1 +
 tools/perf/util/compress.h                |  12 ++
 tools/perf/util/config.c                  |   4 +
 tools/perf/util/debug.c                   |  33 ++++-
 tools/perf/util/debug.h                   |   3 +
 tools/perf/util/dso.c                     |   4 +
 tools/perf/util/event.c                   |  12 +-
 tools/perf/util/event.h                   |   2 +-
 tools/perf/util/evlist.c                  |   3 +
 tools/perf/util/evlist.h                  |   1 +
 tools/perf/util/evsel.c                   |   1 +
 tools/perf/util/header.c                  |   4 +
 tools/perf/util/help-unknown-cmd.c        |   1 +
 tools/perf/util/hist.c                    |   2 +
 tools/perf/util/llvm-utils.c              |   1 +
 tools/perf/util/lzma.c                    |   1 +
 tools/perf/util/machine.c                 |   3 +
 tools/perf/util/mem-events.c              |   2 +-
 tools/perf/util/namespaces.c              |   1 +
 tools/perf/util/parse-events.c            |   2 +
 tools/perf/util/pmu.c                     |   1 +
 tools/perf/util/probe-file.c              |   3 +
 tools/perf/util/python-ext-sources        |   1 +
 tools/perf/util/python.c                  |  13 ++
 tools/perf/util/session.c                 |   1 +
 tools/perf/util/session.h                 |   3 +-
 tools/perf/util/sort.c                    |   1 +
 tools/perf/util/sort.h                    |   3 +-
 tools/perf/util/strlist.c                 |   1 +
 tools/perf/util/time-utils.c              |  25 ++++
 tools/perf/util/time-utils.h              |   7 +
 tools/perf/util/top.h                     |   2 +-
 tools/perf/util/units.c                   |  39 ++++++
 tools/perf/util/units.h                   |  10 ++
 tools/perf/util/unwind-libdw.h            |   6 +-
 tools/perf/util/unwind.h                  |   9 +-
 tools/perf/util/util.c                    | 211 +-----------------------------
 tools/perf/util/util.h                    |  38 ------
 tools/perf/util/xyarray.c                 |   2 +
 tools/perf/util/zlib.c                    |   1 +
 82 files changed, 412 insertions(+), 270 deletions(-)
 create mode 100644 tools/perf/util/compress.h
 create mode 100644 tools/perf/util/units.c
 create mode 100644 tools/perf/util/units.h

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.

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.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:edge: Ok
   4 android-ndk:r12b-arm: Ok
   5 archlinux:latest: Ok
   6 centos:5: Ok
   7 centos:6: Ok
   8 centos:7: Ok
   9 debian:7: Ok
  10 debian:8: Ok
  11 debian:9: Ok
  12 debian:experimental: Ok
  13 debian:experimental-x-arm64: Ok
  14 debian:experimental-x-mips: Ok
  15 debian:experimental-x-mips64: Ok
  16 debian:experimental-x-mipsel: Ok
  17 fedora:20: Ok
  18 fedora:21: Ok
  19 fedora:22: Ok
  20 fedora:23: Ok
  21 fedora:24: Ok
  22 fedora:24-x-ARC-uClibc: Ok
  23 fedora:25: Ok
  24 fedora:rawhide: Ok
  25 mageia:5: Ok
  26 opensuse:13.2: Ok
  27 opensuse:42.1: Ok
  28 opensuse:tumbleweed: Ok
  29 ubuntu:12.04.5: Ok
  30 ubuntu:14.04.4: Ok
  31 ubuntu:14.04.4-x-linaro-arm64: Ok
  32 ubuntu:15.10: Ok
  33 ubuntu:16.04: Ok
  34 ubuntu:16.04-x-arm: Ok
  35 ubuntu:16.04-x-arm64: Ok
  36 ubuntu:16.04-x-powerpc: Ok
  37 ubuntu:16.04-x-powerpc64: Ok
  38 ubuntu:16.04-x-s390: Ok
  39 ubuntu:16.10: Ok
  40 ubuntu:17.04: Ok
  #

  # 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: Parse event definition strings             : Ok
   6: Simple expression parser                   : Ok
   7: PERF_RECORD_* events & perf_sample fields  : Ok
   8: Parse perf pmu format                      : Ok
   9: DSO data read                              : Ok
  10: DSO data cache                             : Ok
  11: DSO data reopen                            : Ok
  12: Roundtrip evsel->name                      : Ok
  13: Parse sched tracepoints fields             : Ok
  14: syscalls:sys_enter_openat event fields     : Ok
  15: Setup struct perf_event_attr               : Ok
  16: Match and link multiple hists              : Ok
  17: 'import perf' in python                    : Ok
  18: Breakpoint overflow signal handler         : Ok
  19: Breakpoint overflow sampling               : Ok
  20: Number of exit events of a simple workload : Ok
  21: Software clock events period values        : Ok
  22: Object code reading                        : Ok
  23: Sample parsing                             : Ok
  24: Use a dummy software event to keep tracking: Ok
  25: Parse with no sample_id_all bit set        : Ok
  26: Filter hist entries                        : Ok
  27: Lookup mmap thread                         : Ok
  28: Share thread mg                            : Ok
  29: Sort output of hist entries                : Ok
  30: Cumulate child hist entries                : Ok
  31: Track with sched_switch                    : Ok
  32: Filter fds with revents mask in a fdarray  : Ok
  33: Add fd to a fdarray, making it autogrow    : Ok
  34: kmod_path__parse                           : Ok
  35: Thread map                                 : Ok
  36: LLVM search and compile                    :
  36.1: Basic BPF llvm compile                    : Ok
  36.2: kbuild searching                          : Ok
  36.3: Compile source for BPF prologue generation: Ok
  36.4: Compile source for BPF relocation         : Ok
  37: Session topology                           : Ok
  38: BPF filter                                 :
  38.1: Basic BPF filtering                      : Ok
  38.2: BPF pinning                              : Ok
  38.3: BPF prologue generation                  : Ok
  38.4: BPF relocation checker                   : Ok
  39: Synthesize thread map                      : Ok
  40: Remove thread map                          : Ok
  41: Synthesize cpu map                         : Ok
  42: Synthesize stat config                     : Ok
  43: Synthesize stat                            : Ok
  44: Synthesize stat round                      : Ok
  45: Synthesize attr update                     : Ok
  46: Event times                                : Ok
  47: Read backward ring buffer                  : Ok
  48: Print cpu map                              : Ok
  49: Probe SDT events                           : Ok
  50: is_printable_array                         : Ok
  51: Print bitmap                               : Ok
  52: perf hooks                                 : Ok
  53: builtin clang support                      : Skip (not compiled in)
  54: unit_number__scnprintf                     : Ok
  55: x86 rdpmc                                  : Ok
  56: Convert perf time to TSC                   : Ok
  57: DWARF unwind                               : Ok
  58: x86 instruction decoder - new instructions : Ok
  59: Intel cqm nmi context read                 : Skip
  #
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
  cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
                    make_doc_O: && make doc
         make_install_prefix_O: && make install prefix=/tmp/krava
            make_no_libaudit_O: && make NO_LIBAUDIT=1
             make_util_map_o_O: && make util/map.o
              make_no_libelf_O: && make NO_LIBELF=1
             make_no_scripts_O: && make NO_LIBPYTHON=1 NO_LIBPERL=1
                make_no_gtk2_O: && make NO_GTK2=1
           make_no_backtrace_O: && make NO_BACKTRACE=1
                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
                  make_no_ui_O: && make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
            make_no_auxtrace_O: && make NO_AUXTRACE=1
                 make_perf_o_O: && make perf.o
   make_install_prefix_slash_O: && make install prefix=/tmp/krava/
        make_with_babeltrace_O: && make LIBBABELTRACE=1
                make_no_newt_O: && make NO_NEWT=1
             make_no_libperl_O: && make NO_LIBPERL=1
            make_no_demangle_O: && make NO_DEMANGLE=1
                  make_debug_O: && make DEBUG=1
           make_no_libunwind_O: && make NO_LIBUNWIND=1
                   make_tags_O: && make tags
            make_install_bin_O: && make install-bin
              make_no_libbpf_O: && make NO_LIBBPF=1
                   make_help_O: && make help
                   make_pure_O: && make
                 make_static_O: && make LDFLAGS=-static
         make_with_clangllvm_O: && make LIBCLANGLLVM=1
       make_util_pmu_bison_o_O: && make util/pmu-bison.o
           make_no_libbionic_O: && make NO_LIBBIONIC=1
               make_no_slang_O: && make NO_SLANG=1
           make_no_libpython_O: && make NO_LIBPYTHON=1
              make_clean_all_O: && make clean all
  make_no_libdw_dwarf_unwind_O: && make NO_LIBDW_DWARF_UNWIND=1
             make_no_libnuma_O: && make NO_LIBNUMA=1
                make_install_O: && make install
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2016-10-04  2:36 Arnaldo Carvalho de Melo
@ 2016-10-04  8:07 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2016-10-04  8:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Linux Weekly News, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, Colin Ian King, David Ahern,
	Jiri Olsa, linuxppc-dev, Madhavan Srinivasan, Masami Hiramatsu,
	Namhyung Kim, Peter Zijlstra, Ravi Bangoria, Sukadev Bhattiprolu,
	Wang Nan, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Build and test stats at the end of the message.
> 
> The following changes since commit 41aad2a6d4fcdda8d73c9739daf7a9f3f49499d6:
> 
>   Merge tag 'perf-core-for-mingo-20160929' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-09-29 19:09:58 +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-20161003
> 
> for you to fetch changes up to b42c7369e3f451e22c2b0be5d193955498d37546:
> 
>   perf pmu-events: Add Skylake frontend MSR support (2016-10-03 21:52:01 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> - Allow vendors to provide JSON files describing PMU events, that then
>   get parsed to generate C tables that are linked against perf, allowing
>   the use of the names in their documentations, such as:
> 
>   # perf list l1d
> 
>   List of pre-defined events (to be used in -e):
> 
>   Cache:
>     l1d.replacement
>          [L1D data line replacements]
>     l1d_pend_miss.fb_full
>          [Cycles a demand request was blocked due to Fill Buffers inavailability]
>     l1d_pend_miss.pending
>          [L1D miss oustandings duration in cycles]
>     l1d_pend_miss.pending_cycles
>          [Cycles with L1D load Misses outstanding]
>     l1d_pend_miss.pending_cycles_any
>          [Cycles with L1D load Misses outstanding from any thread on physical core]
>     l2_trans.l1d_wb
>          [L1D writebacks that access L2 cache]
> 
>   Pipeline:
>     cycle_activity.cycles_l1d_miss
>          [Cycles while L1 cache miss demand load is outstanding]
>     cycle_activity.cycles_l1d_pending
>          [Cycles while L1 cache miss demand load is outstanding]
>     cycle_activity.stalls_l1d_miss
>          [Execution stalls while L1 cache miss demand load is outstanding]
>     cycle_activity.stalls_l1d_pending
>          [Execution stalls while L1 cache miss demand load is outstanding]
> 
>   The above example was done on a Broadwell based ThinkPad t450s after
>   downloading and installing such JSON files which will be added to the
>   tools/perf/pmu-events/ directory in a subsequent patchkit.
> 
>   Now one can use those names with -e/--event in all 'perf tools'.
>   (Andi Kleen, Sukadev Bhattiprolu)
> 
> - Add a missing pointer dereference in 'perf probe' (Colin Ian King)
> 
> - Add support for building host programs to be used in generating files
>   to be used in the build process, such as fixdep and jevents, fixing
>   the usage of these features in a cross compilation setup (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (12):
>       perf tools: Add jsmn `jasmine' JSON parser
>       perf jevents: Program to convert JSON file
>       perf tools: Support CPU id matching for x86 v2
>       perf jevents: Handle header line in mapfile
>       perf pmu: Support alias descriptions
>       perf tools: Query terminal width and use in perf list
>       perf list: Add a --no-desc flag
>       perf pmu: Add override support for event list CPUID
>       perf list jevents: Add support for event list topics
>       perf tools: Make alias matching case-insensitive
>       perf pmu-events: Fix fixed counters on Intel
>       perf pmu-events: Add Skylake frontend MSR support
> 
> Arnaldo Carvalho de Melo (1):
>       perf tools: Experiment with cppcheck
> 
> Colin Ian King (1):
>       perf probe: Check if *ptr2 is zero and not ptr2
> 
> Jiri Olsa (2):
>       tools build: Add support for host programs format
>       tools build: Make fixdep a hostprog
> 
> Sukadev Bhattiprolu (6):
>       perf pmu: Use pmu_events table to create aliases
>       perf powerpc: Support CPU ID matching for Powerpc
>       perf jevents: Add support for long descriptions
>       perf list: Support long jevents descriptions
>       perf tools: Add README for info on parsing JSON/map files
>       perf tools: Allow period= in perf stat CPU event descriptions.
> 
>  tools/build/Build                      |   2 +
>  tools/build/Build.include              |   5 +
>  tools/build/Makefile                   |   8 +-
>  tools/build/Makefile.build             |  19 +-
>  tools/build/Makefile.include           |   4 -
>  tools/lib/subcmd/pager.c               |  16 +
>  tools/lib/subcmd/pager.h               |   1 +
>  tools/perf/Documentation/perf-list.txt |  12 +-
>  tools/perf/Makefile.perf               |  34 +-
>  tools/perf/arch/powerpc/util/header.c  |  11 +
>  tools/perf/arch/x86/util/header.c      |  24 +-
>  tools/perf/builtin-list.c              |  20 +-
>  tools/perf/pmu-events/Build            |  13 +
>  tools/perf/pmu-events/README           | 147 ++++++
>  tools/perf/pmu-events/jevents.c        | 812 +++++++++++++++++++++++++++++++++
>  tools/perf/pmu-events/jevents.h        |  18 +
>  tools/perf/pmu-events/jsmn.c           | 313 +++++++++++++
>  tools/perf/pmu-events/jsmn.h           |  67 +++
>  tools/perf/pmu-events/json.c           | 162 +++++++
>  tools/perf/pmu-events/json.h           |  38 ++
>  tools/perf/pmu-events/pmu-events.h     |  37 ++
>  tools/perf/util/evlist.c               |  12 +-
>  tools/perf/util/evsel.c                |   3 +-
>  tools/perf/util/header.h               |   1 +
>  tools/perf/util/machine.c              |   6 +-
>  tools/perf/util/parse-events.c         |   8 +-
>  tools/perf/util/parse-events.h         |   3 +-
>  tools/perf/util/pmu.c                  | 176 ++++++-
>  tools/perf/util/pmu.h                  |   6 +-
>  tools/perf/util/probe-event.c          |   2 +-
>  tools/perf/util/strbuf.h               |   3 +-
>  tools/perf/util/thread.c               |   9 +-
>  32 files changed, 1926 insertions(+), 66 deletions(-)
>  create mode 100644 tools/perf/pmu-events/Build
>  create mode 100644 tools/perf/pmu-events/README
>  create mode 100644 tools/perf/pmu-events/jevents.c
>  create mode 100644 tools/perf/pmu-events/jevents.h
>  create mode 100644 tools/perf/pmu-events/jsmn.c
>  create mode 100644 tools/perf/pmu-events/jsmn.h
>  create mode 100644 tools/perf/pmu-events/json.c
>  create mode 100644 tools/perf/pmu-events/json.h
>  create mode 100644 tools/perf/pmu-events/pmu-events.h
> 
>   # time dm
>    1 alpine:3.4: Ok
>    2 android-ndk:r12b-arm: Ok
>    3 archlinux:latest: Ok
>    4 centos:5: Ok
>    5 centos:6: Ok
>    6 centos:7: Ok
>    7 debian:7: Ok
>    8 debian:8: Ok
>    9 debian:experimental: Ok
>   10 fedora:20: Ok
>   11 fedora:21: Ok
>   12 fedora:22: Ok
>   13 fedora:23: Ok
>   14 fedora:24: Ok
>   15 fedora:24-x-ARC-uClibc: Ok
>   16 fedora:rawhide: Ok
>   17 mageia:5: Ok
>   18 opensuse:13.2: Ok
>   19 opensuse:42.1: Ok
>   20 opensuse:tumbleweed: Ok
>   21 ubuntu:12.04.5: Ok
>   22 ubuntu:14.04: Ok
>   23 ubuntu:14.04.4: Ok
>   24 ubuntu:15.10: Ok
>   25 ubuntu:16.04: Ok
>   26 ubuntu:16.04-x-arm: Ok
>   27 ubuntu:16.04-x-arm64: Ok
>   28 ubuntu:16.04-x-powerpc: Ok
>   29 ubuntu:16.04-x-powerpc64: Ok
>   30 ubuntu:16.04-x-powerpc64el: Ok
>   31 ubuntu:16.04-x-s390: Ok
>   32 ubuntu:16.10: Ok
> 
>   real	33m23.855s
>   user	0m2.128s
>   sys	0m2.305s
>   #
> 
>   # 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: parse events tests                                       : Ok
>    6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
>    7: Test perf pmu format parsing                             : Ok
>    8: Test dso data read                                       : Ok
>    9: Test dso data cache                                      : Ok
>   10: Test dso data reopen                                     : Ok
>   11: roundtrip evsel->name check                              : Ok
>   12: Check parsing of sched tracepoints fields                : Ok
>   13: Generate and check syscalls:sys_enter_openat event fields: Ok
>   14: struct perf_event_attr setup                             : Ok
>   15: Test matching and linking multiple hists                 : Ok
>   16: Try 'import perf' in python, checking link problems      : Ok
>   17: Test breakpoint overflow signal handler                  : Ok
>   18: Test breakpoint overflow sampling                        : Ok
>   19: Test number of exit event of a simple workload           : Ok
>   20: Test software clock events have valid period values      : Ok
>   21: Test object code reading                                 : Ok
>   22: Test sample parsing                                      : Ok
>   23: Test using a dummy software event to keep tracking       : Ok
>   24: Test parsing with no sample_id_all bit set               : Ok
>   25: Test filtering hist entries                              : Ok
>   26: Test mmap thread lookup                                  : Ok
>   27: Test thread mg sharing                                   : Ok
>   28: Test output sorting of hist entries                      : Ok
>   29: Test cumulation of child hist entries                    : Ok
>   30: Test tracking with sched_switch                          : Ok
>   31: Filter fds with revents mask in a fdarray                : Ok
>   32: Add fd to a fdarray, making it autogrow                  : Ok
>   33: Test kmod_path__parse function                           : Ok
>   34: Test thread map                                          : Ok
>   35: Test LLVM searching and compiling                        :
>   35.1: Basic BPF llvm compiling test                          : Ok
>   35.2: Test kbuild searching                                  : Ok
>   35.3: Compile source for BPF prologue generation test        : Ok
>   35.4: Compile source for BPF relocation test                 : Ok
>   36: Test topology in session                                 : Ok
>   37: Test BPF filter                                          :
>   37.1: Test basic BPF filtering                               : Ok
>   37.2: Test BPF prologue generation                           : Ok
>   37.3: Test BPF relocation checker                            : Ok
>   38: Test thread map synthesize                               : Ok
>   39: Test cpu map synthesize                                  : Ok
>   40: Test stat config synthesize                              : Ok
>   41: Test stat synthesize                                     : Ok
>   42: Test stat round synthesize                               : Ok
>   43: Test attr update synthesize                              : Ok
>   44: Test events times                                        : Ok
>   45: Test backward reading from ring buffer                   : Ok
>   46: Test cpu map print                                       : Ok
>   47: Test SDT event probing                                   : Ok
>   48: Test is_printable_array function                         : Ok
>   49: Test bitmap print                                        : Ok
>   50: x86 rdpmc test                                           : Ok
>   51: Test converting perf time to TSC                         : Ok
>   52: Test dwarf unwind                                        : Ok
>   53: Test x86 instruction decoder - new instructions          : Ok
>   54: Test intel cqm nmi context read                          : Skip
>   # 
> 
>   $ make -C tools/perf build-test
>   make: Entering directory '/home/acme/git/linux/tools/perf'
>                       - tarpkg: ./tests/perf-targz-src-pkg .
>              make_no_libperl_O: make NO_LIBPERL=1
>                 make_no_newt_O: make NO_NEWT=1
>                make_no_slang_O: make NO_SLANG=1
>              make_no_libnuma_O: make NO_LIBNUMA=1
>         make_with_babeltrace_O: make LIBBABELTRACE=1
>    make_install_prefix_slash_O: make install prefix=/tmp/krava/
>               make_no_libbpf_O: make NO_LIBBPF=1
>             make_no_demangle_O: make NO_DEMANGLE=1
>             make_install_bin_O: make install-bin
>                 make_install_O: make install
>            make_no_libbionic_O: make NO_LIBBIONIC=1
>            make_no_libunwind_O: make NO_LIBUNWIND=1
>             make_no_libaudit_O: make NO_LIBAUDIT=1
>            make_no_libpython_O: make NO_LIBPYTHON=1
>                    make_tags_O: make tags
>                  make_perf_o_O: make perf.o
>                  make_static_O: make LDFLAGS=-static
>               make_clean_all_O: make clean all
>          make_install_prefix_O: make install prefix=/tmp/krava
>                    make_help_O: make help
>              make_util_map_o_O: make util/map.o
>                   make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
>   make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
>                 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
>            make_no_backtrace_O: make NO_BACKTRACE=1
>                   make_debug_O: make DEBUG=1
>               make_no_libelf_O: make NO_LIBELF=1
>              make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
>             make_no_auxtrace_O: make NO_AUXTRACE=1
>                     make_doc_O: make doc
>        make_util_pmu_bison_o_O: make util/pmu-bison.o
>                 make_no_gtk2_O: make NO_GTK2=1
>   OK

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2016-10-04  2:36 Arnaldo Carvalho de Melo
  2016-10-04  8:07 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-10-04  2:36 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Linux Weekly News, Arnaldo Carvalho de Melo,
	Adrian Hunter, Alexander Shishkin, Andi Kleen, Colin Ian King,
	David Ahern, Jiri Olsa, linuxppc-dev, Madhavan Srinivasan,
	Masami Hiramatsu, Namhyung Kim, Peter Zijlstra, Ravi Bangoria,
	Sukadev Bhattiprolu, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

Build and test stats at the end of the message.

The following changes since commit 41aad2a6d4fcdda8d73c9739daf7a9f3f49499d6:

  Merge tag 'perf-core-for-mingo-20160929' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-09-29 19:09:58 +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-20161003

for you to fetch changes up to b42c7369e3f451e22c2b0be5d193955498d37546:

  perf pmu-events: Add Skylake frontend MSR support (2016-10-03 21:52:01 -0300)

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

- Allow vendors to provide JSON files describing PMU events, that then
  get parsed to generate C tables that are linked against perf, allowing
  the use of the names in their documentations, such as:

  # perf list l1d

  List of pre-defined events (to be used in -e):

  Cache:
    l1d.replacement
         [L1D data line replacements]
    l1d_pend_miss.fb_full
         [Cycles a demand request was blocked due to Fill Buffers inavailability]
    l1d_pend_miss.pending
         [L1D miss oustandings duration in cycles]
    l1d_pend_miss.pending_cycles
         [Cycles with L1D load Misses outstanding]
    l1d_pend_miss.pending_cycles_any
         [Cycles with L1D load Misses outstanding from any thread on physical core]
    l2_trans.l1d_wb
         [L1D writebacks that access L2 cache]

  Pipeline:
    cycle_activity.cycles_l1d_miss
         [Cycles while L1 cache miss demand load is outstanding]
    cycle_activity.cycles_l1d_pending
         [Cycles while L1 cache miss demand load is outstanding]
    cycle_activity.stalls_l1d_miss
         [Execution stalls while L1 cache miss demand load is outstanding]
    cycle_activity.stalls_l1d_pending
         [Execution stalls while L1 cache miss demand load is outstanding]

  The above example was done on a Broadwell based ThinkPad t450s after
  downloading and installing such JSON files which will be added to the
  tools/perf/pmu-events/ directory in a subsequent patchkit.

  Now one can use those names with -e/--event in all 'perf tools'.
  (Andi Kleen, Sukadev Bhattiprolu)

- Add a missing pointer dereference in 'perf probe' (Colin Ian King)

- Add support for building host programs to be used in generating files
  to be used in the build process, such as fixdep and jevents, fixing
  the usage of these features in a cross compilation setup (Jiri Olsa)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (12):
      perf tools: Add jsmn `jasmine' JSON parser
      perf jevents: Program to convert JSON file
      perf tools: Support CPU id matching for x86 v2
      perf jevents: Handle header line in mapfile
      perf pmu: Support alias descriptions
      perf tools: Query terminal width and use in perf list
      perf list: Add a --no-desc flag
      perf pmu: Add override support for event list CPUID
      perf list jevents: Add support for event list topics
      perf tools: Make alias matching case-insensitive
      perf pmu-events: Fix fixed counters on Intel
      perf pmu-events: Add Skylake frontend MSR support

Arnaldo Carvalho de Melo (1):
      perf tools: Experiment with cppcheck

Colin Ian King (1):
      perf probe: Check if *ptr2 is zero and not ptr2

Jiri Olsa (2):
      tools build: Add support for host programs format
      tools build: Make fixdep a hostprog

Sukadev Bhattiprolu (6):
      perf pmu: Use pmu_events table to create aliases
      perf powerpc: Support CPU ID matching for Powerpc
      perf jevents: Add support for long descriptions
      perf list: Support long jevents descriptions
      perf tools: Add README for info on parsing JSON/map files
      perf tools: Allow period= in perf stat CPU event descriptions.

 tools/build/Build                      |   2 +
 tools/build/Build.include              |   5 +
 tools/build/Makefile                   |   8 +-
 tools/build/Makefile.build             |  19 +-
 tools/build/Makefile.include           |   4 -
 tools/lib/subcmd/pager.c               |  16 +
 tools/lib/subcmd/pager.h               |   1 +
 tools/perf/Documentation/perf-list.txt |  12 +-
 tools/perf/Makefile.perf               |  34 +-
 tools/perf/arch/powerpc/util/header.c  |  11 +
 tools/perf/arch/x86/util/header.c      |  24 +-
 tools/perf/builtin-list.c              |  20 +-
 tools/perf/pmu-events/Build            |  13 +
 tools/perf/pmu-events/README           | 147 ++++++
 tools/perf/pmu-events/jevents.c        | 812 +++++++++++++++++++++++++++++++++
 tools/perf/pmu-events/jevents.h        |  18 +
 tools/perf/pmu-events/jsmn.c           | 313 +++++++++++++
 tools/perf/pmu-events/jsmn.h           |  67 +++
 tools/perf/pmu-events/json.c           | 162 +++++++
 tools/perf/pmu-events/json.h           |  38 ++
 tools/perf/pmu-events/pmu-events.h     |  37 ++
 tools/perf/util/evlist.c               |  12 +-
 tools/perf/util/evsel.c                |   3 +-
 tools/perf/util/header.h               |   1 +
 tools/perf/util/machine.c              |   6 +-
 tools/perf/util/parse-events.c         |   8 +-
 tools/perf/util/parse-events.h         |   3 +-
 tools/perf/util/pmu.c                  | 176 ++++++-
 tools/perf/util/pmu.h                  |   6 +-
 tools/perf/util/probe-event.c          |   2 +-
 tools/perf/util/strbuf.h               |   3 +-
 tools/perf/util/thread.c               |   9 +-
 32 files changed, 1926 insertions(+), 66 deletions(-)
 create mode 100644 tools/perf/pmu-events/Build
 create mode 100644 tools/perf/pmu-events/README
 create mode 100644 tools/perf/pmu-events/jevents.c
 create mode 100644 tools/perf/pmu-events/jevents.h
 create mode 100644 tools/perf/pmu-events/jsmn.c
 create mode 100644 tools/perf/pmu-events/jsmn.h
 create mode 100644 tools/perf/pmu-events/json.c
 create mode 100644 tools/perf/pmu-events/json.h
 create mode 100644 tools/perf/pmu-events/pmu-events.h

  # time dm
   1 alpine:3.4: Ok
   2 android-ndk:r12b-arm: Ok
   3 archlinux:latest: Ok
   4 centos:5: Ok
   5 centos:6: Ok
   6 centos:7: Ok
   7 debian:7: Ok
   8 debian:8: Ok
   9 debian:experimental: Ok
  10 fedora:20: Ok
  11 fedora:21: Ok
  12 fedora:22: Ok
  13 fedora:23: Ok
  14 fedora:24: Ok
  15 fedora:24-x-ARC-uClibc: Ok
  16 fedora:rawhide: Ok
  17 mageia:5: Ok
  18 opensuse:13.2: Ok
  19 opensuse:42.1: Ok
  20 opensuse:tumbleweed: Ok
  21 ubuntu:12.04.5: Ok
  22 ubuntu:14.04: Ok
  23 ubuntu:14.04.4: Ok
  24 ubuntu:15.10: Ok
  25 ubuntu:16.04: Ok
  26 ubuntu:16.04-x-arm: Ok
  27 ubuntu:16.04-x-arm64: Ok
  28 ubuntu:16.04-x-powerpc: Ok
  29 ubuntu:16.04-x-powerpc64: Ok
  30 ubuntu:16.04-x-powerpc64el: Ok
  31 ubuntu:16.04-x-s390: Ok
  32 ubuntu:16.10: Ok

  real	33m23.855s
  user	0m2.128s
  sys	0m2.305s
  #

  # 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: parse events tests                                       : Ok
   6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
   7: Test perf pmu format parsing                             : Ok
   8: Test dso data read                                       : Ok
   9: Test dso data cache                                      : Ok
  10: Test dso data reopen                                     : Ok
  11: roundtrip evsel->name check                              : Ok
  12: Check parsing of sched tracepoints fields                : Ok
  13: Generate and check syscalls:sys_enter_openat event fields: Ok
  14: struct perf_event_attr setup                             : Ok
  15: Test matching and linking multiple hists                 : Ok
  16: Try 'import perf' in python, checking link problems      : Ok
  17: Test breakpoint overflow signal handler                  : Ok
  18: Test breakpoint overflow sampling                        : Ok
  19: Test number of exit event of a simple workload           : Ok
  20: Test software clock events have valid period values      : Ok
  21: Test object code reading                                 : Ok
  22: Test sample parsing                                      : Ok
  23: Test using a dummy software event to keep tracking       : Ok
  24: Test parsing with no sample_id_all bit set               : Ok
  25: Test filtering hist entries                              : Ok
  26: Test mmap thread lookup                                  : Ok
  27: Test thread mg sharing                                   : Ok
  28: Test output sorting of hist entries                      : Ok
  29: Test cumulation of child hist entries                    : Ok
  30: Test tracking with sched_switch                          : Ok
  31: Filter fds with revents mask in a fdarray                : Ok
  32: Add fd to a fdarray, making it autogrow                  : Ok
  33: Test kmod_path__parse function                           : Ok
  34: Test thread map                                          : Ok
  35: Test LLVM searching and compiling                        :
  35.1: Basic BPF llvm compiling test                          : Ok
  35.2: Test kbuild searching                                  : Ok
  35.3: Compile source for BPF prologue generation test        : Ok
  35.4: Compile source for BPF relocation test                 : Ok
  36: Test topology in session                                 : Ok
  37: Test BPF filter                                          :
  37.1: Test basic BPF filtering                               : Ok
  37.2: Test BPF prologue generation                           : Ok
  37.3: Test BPF relocation checker                            : Ok
  38: Test thread map synthesize                               : Ok
  39: Test cpu map synthesize                                  : Ok
  40: Test stat config synthesize                              : Ok
  41: Test stat synthesize                                     : Ok
  42: Test stat round synthesize                               : Ok
  43: Test attr update synthesize                              : Ok
  44: Test events times                                        : Ok
  45: Test backward reading from ring buffer                   : Ok
  46: Test cpu map print                                       : Ok
  47: Test SDT event probing                                   : Ok
  48: Test is_printable_array function                         : Ok
  49: Test bitmap print                                        : Ok
  50: x86 rdpmc test                                           : Ok
  51: Test converting perf time to TSC                         : Ok
  52: Test dwarf unwind                                        : Ok
  53: Test x86 instruction decoder - new instructions          : Ok
  54: Test intel cqm nmi context read                          : Skip
  # 

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
                      - tarpkg: ./tests/perf-targz-src-pkg .
             make_no_libperl_O: make NO_LIBPERL=1
                make_no_newt_O: make NO_NEWT=1
               make_no_slang_O: make NO_SLANG=1
             make_no_libnuma_O: make NO_LIBNUMA=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
              make_no_libbpf_O: make NO_LIBBPF=1
            make_no_demangle_O: make NO_DEMANGLE=1
            make_install_bin_O: make install-bin
                make_install_O: make install
           make_no_libbionic_O: make NO_LIBBIONIC=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
           make_no_libpython_O: make NO_LIBPYTHON=1
                   make_tags_O: make tags
                 make_perf_o_O: make perf.o
                 make_static_O: make LDFLAGS=-static
              make_clean_all_O: make clean all
         make_install_prefix_O: make install prefix=/tmp/krava
                   make_help_O: make help
             make_util_map_o_O: make util/map.o
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
                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
           make_no_backtrace_O: make NO_BACKTRACE=1
                  make_debug_O: make DEBUG=1
              make_no_libelf_O: make NO_LIBELF=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
                    make_doc_O: make doc
       make_util_pmu_bison_o_O: make util/pmu-bison.o
                make_no_gtk2_O: make NO_GTK2=1
  OK

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2016-09-20 20:03 Arnaldo Carvalho de Melo
@ 2016-09-20 21:34 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2016-09-20 21:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin, Andi Kleen,
	Chris Riyder, David Ahern, Don Zickus, Hemant Kumar, Jiri Olsa,
	Joe Mario, Kim Phillips, Markus Trippelsdorf, Masami Hiramatsu,
	Mathieu Poirier, Michael Ellerman, Milian Wolff, Namhyung Kim,
	Naveen N . Rao, Pawel Moll, Peter Zijlstra, pi3orama,
	Ravi Bangoria, Russell King, Taeung Song, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit cd34cd97b7b4336aa2c623c37daffab264c7c6ce:
> 
>   perf/x86/intel/uncore: Add Skylake server uncore support (2016-09-10 11:18:52 +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-20160920
> 
> for you to fetch changes up to 3c028a0cb5b71f47d523bc8ad2c597cb257f41fb:
> 
>   perf symbols: Do not open device files (2016-09-20 16:20:21 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Support event group view with hierarchy mode in 'perf top' and 'perf report'
>   (Namhyung Kim)
> 
>   e.g.:
> 
>   $ perf record -e '{cycles,instructions}' make
>   $ perf report --hierarchy --stdio
>   ...
>   #               Overhead  Command / Shared Object / Symbol
>   # ......................  ..................................
>   ...
>       25.74%  27.18%        sh
>          19.96%  24.14%        libc-2.24.so
>             9.55%  14.64%        [.] __strcmp_sse2
>             1.54%   0.00%        [.] __tfind
>             1.07%   1.13%        [.] _int_malloc
>             0.95%   0.00%        [.] __strchr_sse2
>             0.89%   1.39%        [.] __tsearch
>             0.76%   0.00%        [.] strlen
> 
> - Fix the dwarf regs table for x86_64, adding a missing % to the "%di"
>   register, noticed with a failing 'perf test bpf' (Arnaldo Carvalho de Melo)
> 
> - Fix handling of mmap parameters in the 'perf trace' beautifier in
>   architectures that don't have the same mappings as x86_64 (Wang Nan)
> 
> - Handle hugetbl mappings in older systems running new kernels (Wang Nan)
> 
> - Resolve 'call' operands in 'annotate', that when using /proc/kcore
>   were appearing just as hexadecimal addresses, to function names
>   (Arnaldo Carvalho de Melo)
> 
> - Fix width computation for srcline sort entry (Jiri Olsa)
> 
> - Do not ignore call instruction with indirect target in 'annotate'
>   (Ravi Bangoria)
> 
> - Handle MADV_FREE in the madvise 'trace' beautifier (Wang Nan)
> 
> - Fix build of 'perf trace' mman beautifier in !x86_64 (Wang Nan)
> 
> Infrastructure:
> 
> - Add infrastructure for PMU specific configuration, allowing to pass
>   config variables directly to the kernel PMU driver, prefixing those
>   variables with a '@', part of a larger series to support Coresight (Mathieu Poirier)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Build stats at the end of this message.
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (5):
>       perf probe: Fix dwarf regs table for x86_64
>       perf trace beauty mmap: Fix defines for non !x86_64
>       perf tools: Do hugetlb handling in more systems
>       perf annotate: Pass the symbol's map/dso to the instruction parsers
>       perf annotate: Resolve 'call' operands to function names
> 
> Jiri Olsa (2):
>       perf hists: Fix width computation for srcline sort entry
>       perf symbols: Do not open device files
> 
> Mathieu Poirier (1):
>       perf tools: Add infrastructure for PMU specific configuration
> 
> Namhyung Kim (9):
>       perf hists browser: Fix event group display
>       perf hists: Introduce hists__match_hierarchy()
>       perf hists: Introduce hists__link_hierarchy()
>       perf hist: Initialize hierarchy tree explicitly
>       perf ui/stdio: Always reset output width for hierarchy
>       perf ui/stdio: Rename print_hierarchy_header()
>       perf report: Enable group view with hierarchy
>       perf ui/tui: Reset output width for hierarchy
>       perf hists: Factor out hists__reset_column_width()
> 
> Ravi Bangoria (1):
>       perf annotate: Do not ignore call instruction with indirect target
> 
> Wang Nan (4):
>       tools include: Add uapi mman.h for each architecture
>       perf build: Compare mman.h related headers against kernel originals
>       perf trace beauty mmap: Add missing MADV_FREE
>       tools include: Add mman macros needed by perf for all arch
> 
>  tools/arch/alpha/include/uapi/asm/mman.h       |  47 ++++++++
>  tools/arch/arc/include/uapi/asm/mman.h         |   6 +
>  tools/arch/arm/include/uapi/asm/mman.h         |   6 +
>  tools/arch/arm64/include/uapi/asm/mman.h       |   6 +
>  tools/arch/frv/include/uapi/asm/mman.h         |   6 +
>  tools/arch/h8300/include/uapi/asm/mman.h       |   6 +
>  tools/arch/hexagon/include/uapi/asm/mman.h     |   6 +
>  tools/arch/ia64/include/uapi/asm/mman.h        |   6 +
>  tools/arch/m32r/include/uapi/asm/mman.h        |   6 +
>  tools/arch/microblaze/include/uapi/asm/mman.h  |   6 +
>  tools/arch/mips/include/uapi/asm/mman.h        |  46 ++++++++
>  tools/arch/mn10300/include/uapi/asm/mman.h     |   6 +
>  tools/arch/parisc/include/uapi/asm/mman.h      |  47 ++++++++
>  tools/arch/powerpc/include/uapi/asm/mman.h     |  15 +++
>  tools/arch/s390/include/uapi/asm/mman.h        |   6 +
>  tools/arch/score/include/uapi/asm/mman.h       |   6 +
>  tools/arch/sh/include/uapi/asm/mman.h          |   6 +
>  tools/arch/sparc/include/uapi/asm/mman.h       |  15 +++
>  tools/arch/tile/include/uapi/asm/mman.h        |  15 +++
>  tools/arch/x86/include/uapi/asm/mman.h         |   5 +
>  tools/arch/xtensa/include/uapi/asm/mman.h      |  47 ++++++++
>  tools/include/uapi/asm-generic/mman-common.h   |  75 ++++++++++++
>  tools/include/uapi/asm-generic/mman.h          |  22 ++++
>  tools/include/uapi/linux/mman.h                |  13 +++
>  tools/perf/Documentation/perf-record.txt       |  12 ++
>  tools/perf/MANIFEST                            |   4 +
>  tools/perf/Makefile.perf                       |   9 ++
>  tools/perf/arch/x86/include/dwarf-regs-table.h |   2 +-
>  tools/perf/builtin-report.c                    |   1 -
>  tools/perf/trace/beauty/mmap.c                 |  72 +-----------
>  tools/perf/ui/browsers/hists.c                 |   7 +-
>  tools/perf/ui/hist.c                           |  15 +++
>  tools/perf/ui/stdio/hist.c                     |  25 +---
>  tools/perf/util/annotate.c                     |  37 +++---
>  tools/perf/util/annotate.h                     |   2 +-
>  tools/perf/util/dso.c                          |   3 +
>  tools/perf/util/event.c                        |   7 +-
>  tools/perf/util/evsel.h                        |   2 +
>  tools/perf/util/hist.c                         | 154 ++++++++++++++++++++++++-
>  tools/perf/util/hist.h                         |   1 +
>  tools/perf/util/map.c                          |   9 +-
>  tools/perf/util/parse-events.c                 |   7 +-
>  tools/perf/util/parse-events.h                 |   1 +
>  tools/perf/util/parse-events.l                 |  22 ++++
>  tools/perf/util/parse-events.y                 |  11 ++
>  tools/perf/util/sort.h                         |   1 +
>  46 files changed, 698 insertions(+), 131 deletions(-)
>  create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/arc/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/arm/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/frv/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/m32r/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/mips/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/s390/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/score/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/sh/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/tile/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/x86/include/uapi/asm/mman.h
>  create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h
>  create mode 100644 tools/include/uapi/asm-generic/mman-common.h
>  create mode 100644 tools/include/uapi/asm-generic/mman.h
>  create mode 100644 tools/include/uapi/linux/mman.h
> 
>   [root@jouet ~]# 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: parse events tests                                       : Ok
>    6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
>    7: Test perf pmu format parsing                             : Ok
>    8: Test dso data read                                       : Ok
>    9: Test dso data cache                                      : Ok
>   10: Test dso data reopen                                     : Ok
>   11: roundtrip evsel->name check                              : Ok
>   12: Check parsing of sched tracepoints fields                : Ok
>   13: Generate and check syscalls:sys_enter_openat event fields: Ok
>   14: struct perf_event_attr setup                             : Ok
>   15: Test matching and linking multiple hists                 : Ok
>   16: Try 'import perf' in python, checking link problems      : Ok
>   17: Test breakpoint overflow signal handler                  : Ok
>   18: Test breakpoint overflow sampling                        : Ok
>   19: Test number of exit event of a simple workload           : Ok
>   20: Test software clock events have valid period values      : Ok
>   21: Test object code reading                                 : Ok
>   22: Test sample parsing                                      : Ok
>   23: Test using a dummy software event to keep tracking       : Ok
>   24: Test parsing with no sample_id_all bit set               : Ok
>   25: Test filtering hist entries                              : Ok
>   26: Test mmap thread lookup                                  : Ok
>   27: Test thread mg sharing                                   : Ok
>   28: Test output sorting of hist entries                      : Ok
>   29: Test cumulation of child hist entries                    : Ok
>   30: Test tracking with sched_switch                          : Ok
>   31: Filter fds with revents mask in a fdarray                : Ok
>   32: Add fd to a fdarray, making it autogrow                  : Ok
>   33: Test kmod_path__parse function                           : Ok
>   34: Test thread map                                          : Ok
>   35: Test LLVM searching and compiling                        :
>   35.1: Basic BPF llvm compiling test                          : Ok
>   35.2: Test kbuild searching                                  : Ok
>   35.3: Compile source for BPF prologue generation test        : Ok
>   35.4: Compile source for BPF relocation test                 : Ok
>   36: Test topology in session                                 : Ok
>   37: Test BPF filter                                          :
>   37.1: Test basic BPF filtering                               : Ok
>   37.2: Test BPF prologue generation                           : Ok
>   37.3: Test BPF relocation checker                            : Ok
>   38: Test thread map synthesize                               : Ok
>   39: Test cpu map synthesize                                  : Ok
>   40: Test stat config synthesize                              : Ok
>   41: Test stat synthesize                                     : Ok
>   42: Test stat round synthesize                               : Ok
>   43: Test attr update synthesize                              : Ok
>   44: Test events times                                        : Ok
>   45: Test backward reading from ring buffer                   : Ok
>   46: Test cpu map print                                       : Ok
>   47: Test SDT event probing                                   : Ok
>   48: Test is_printable_array function                         : Ok
>   49: Test bitmap print                                        : Ok
>   50: x86 rdpmc test                                           : Ok
>   51: Test converting perf time to TSC                         : Ok
>   52: Test dwarf unwind                                        : Ok
>   53: Test x86 instruction decoder - new instructions          : Ok
>   54: Test intel cqm nmi context read                          : Skip
>   [root@jouet ~]# 
> 
> Build stats:
> 
>   # time dm
>    1 74.534 alpine:3.4: Ok
>    2 25.636 android-ndk:r12b-arm: Ok
>    3 78.066 archlinux:latest: Ok
>    4 41.189 centos:5: Ok
>    5 64.550 centos:6: Ok
>    6 74.689 centos:7: Ok
>    7 68.580 debian:7: Ok
>    8 75.115 debian:8: Ok
>    9 75.288 fedora:20: Ok
>   10 79.294 fedora:21: Ok
>   11 76.839 fedora:22: Ok
>   12 76.695 fedora:23: Ok
>   13 82.058 fedora:24: Ok
>   14 31.649 fedora:24-x-ARC-uClibc: Ok
>   15 85.826 fedora:rawhide: Ok
>   16 83.272 mageia:5: Ok
>   17 76.883 opensuse:13.2: Ok
>   18 78.530 opensuse:42.1: Ok
>   19 85.315 opensuse:tumbleweed: Ok
>   20 63.436 ubuntu:12.04.5: Ok
>   21 40.909 ubuntu:14.04: Ok
>   22 72.689 ubuntu:14.04.4: Ok
>   23 76.374 ubuntu:15.10: Ok
>   24 70.309 ubuntu:16.04: Ok
>   25 59.159 ubuntu:16.04-x-arm: Ok
>   26 56.011 ubuntu:16.04-x-arm64: Ok
>   27 56.913 ubuntu:16.04-x-powerpc64: Ok
>   28 57.442 ubuntu:16.04-x-powerpc64el: Ok
>   29 80.282 ubuntu:16.10: Ok
>   30 60.964 ubuntu:16.10-x-arm64: Ok
>   31 61.390 ubuntu:16.10-x-powerpc: Ok
>   32 63.167 ubuntu:16.10-x-s390: Ok
> 
>   real	35m54.027s
>   user	0m2.855s
>   sys	0m2.652s

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2016-09-20 20:03 Arnaldo Carvalho de Melo
  2016-09-20 21:34 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-20 20:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, Chris Riyder, David Ahern,
	Don Zickus, Hemant Kumar, Jiri Olsa, Joe Mario, Kim Phillips,
	Markus Trippelsdorf, Masami Hiramatsu, Mathieu Poirier,
	Michael Ellerman, Milian Wolff, Namhyung Kim, Naveen N . Rao,
	Pawel Moll, Peter Zijlstra, pi3orama, Ravi Bangoria,
	Russell King, Taeung Song, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit cd34cd97b7b4336aa2c623c37daffab264c7c6ce:

  perf/x86/intel/uncore: Add Skylake server uncore support (2016-09-10 11:18:52 +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-20160920

for you to fetch changes up to 3c028a0cb5b71f47d523bc8ad2c597cb257f41fb:

  perf symbols: Do not open device files (2016-09-20 16:20:21 -0300)

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

User visible:

- Support event group view with hierarchy mode in 'perf top' and 'perf report'
  (Namhyung Kim)

  e.g.:

  $ perf record -e '{cycles,instructions}' make
  $ perf report --hierarchy --stdio
  ...
  #               Overhead  Command / Shared Object / Symbol
  # ......................  ..................................
  ...
      25.74%  27.18%        sh
         19.96%  24.14%        libc-2.24.so
            9.55%  14.64%        [.] __strcmp_sse2
            1.54%   0.00%        [.] __tfind
            1.07%   1.13%        [.] _int_malloc
            0.95%   0.00%        [.] __strchr_sse2
            0.89%   1.39%        [.] __tsearch
            0.76%   0.00%        [.] strlen

- Fix the dwarf regs table for x86_64, adding a missing % to the "%di"
  register, noticed with a failing 'perf test bpf' (Arnaldo Carvalho de Melo)

- Fix handling of mmap parameters in the 'perf trace' beautifier in
  architectures that don't have the same mappings as x86_64 (Wang Nan)

- Handle hugetbl mappings in older systems running new kernels (Wang Nan)

- Resolve 'call' operands in 'annotate', that when using /proc/kcore
  were appearing just as hexadecimal addresses, to function names
  (Arnaldo Carvalho de Melo)

- Fix width computation for srcline sort entry (Jiri Olsa)

- Do not ignore call instruction with indirect target in 'annotate'
  (Ravi Bangoria)

- Handle MADV_FREE in the madvise 'trace' beautifier (Wang Nan)

- Fix build of 'perf trace' mman beautifier in !x86_64 (Wang Nan)

Infrastructure:

- Add infrastructure for PMU specific configuration, allowing to pass
  config variables directly to the kernel PMU driver, prefixing those
  variables with a '@', part of a larger series to support Coresight (Mathieu Poirier)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Build stats at the end of this message.

----------------------------------------------------------------
Arnaldo Carvalho de Melo (5):
      perf probe: Fix dwarf regs table for x86_64
      perf trace beauty mmap: Fix defines for non !x86_64
      perf tools: Do hugetlb handling in more systems
      perf annotate: Pass the symbol's map/dso to the instruction parsers
      perf annotate: Resolve 'call' operands to function names

Jiri Olsa (2):
      perf hists: Fix width computation for srcline sort entry
      perf symbols: Do not open device files

Mathieu Poirier (1):
      perf tools: Add infrastructure for PMU specific configuration

Namhyung Kim (9):
      perf hists browser: Fix event group display
      perf hists: Introduce hists__match_hierarchy()
      perf hists: Introduce hists__link_hierarchy()
      perf hist: Initialize hierarchy tree explicitly
      perf ui/stdio: Always reset output width for hierarchy
      perf ui/stdio: Rename print_hierarchy_header()
      perf report: Enable group view with hierarchy
      perf ui/tui: Reset output width for hierarchy
      perf hists: Factor out hists__reset_column_width()

Ravi Bangoria (1):
      perf annotate: Do not ignore call instruction with indirect target

Wang Nan (4):
      tools include: Add uapi mman.h for each architecture
      perf build: Compare mman.h related headers against kernel originals
      perf trace beauty mmap: Add missing MADV_FREE
      tools include: Add mman macros needed by perf for all arch

 tools/arch/alpha/include/uapi/asm/mman.h       |  47 ++++++++
 tools/arch/arc/include/uapi/asm/mman.h         |   6 +
 tools/arch/arm/include/uapi/asm/mman.h         |   6 +
 tools/arch/arm64/include/uapi/asm/mman.h       |   6 +
 tools/arch/frv/include/uapi/asm/mman.h         |   6 +
 tools/arch/h8300/include/uapi/asm/mman.h       |   6 +
 tools/arch/hexagon/include/uapi/asm/mman.h     |   6 +
 tools/arch/ia64/include/uapi/asm/mman.h        |   6 +
 tools/arch/m32r/include/uapi/asm/mman.h        |   6 +
 tools/arch/microblaze/include/uapi/asm/mman.h  |   6 +
 tools/arch/mips/include/uapi/asm/mman.h        |  46 ++++++++
 tools/arch/mn10300/include/uapi/asm/mman.h     |   6 +
 tools/arch/parisc/include/uapi/asm/mman.h      |  47 ++++++++
 tools/arch/powerpc/include/uapi/asm/mman.h     |  15 +++
 tools/arch/s390/include/uapi/asm/mman.h        |   6 +
 tools/arch/score/include/uapi/asm/mman.h       |   6 +
 tools/arch/sh/include/uapi/asm/mman.h          |   6 +
 tools/arch/sparc/include/uapi/asm/mman.h       |  15 +++
 tools/arch/tile/include/uapi/asm/mman.h        |  15 +++
 tools/arch/x86/include/uapi/asm/mman.h         |   5 +
 tools/arch/xtensa/include/uapi/asm/mman.h      |  47 ++++++++
 tools/include/uapi/asm-generic/mman-common.h   |  75 ++++++++++++
 tools/include/uapi/asm-generic/mman.h          |  22 ++++
 tools/include/uapi/linux/mman.h                |  13 +++
 tools/perf/Documentation/perf-record.txt       |  12 ++
 tools/perf/MANIFEST                            |   4 +
 tools/perf/Makefile.perf                       |   9 ++
 tools/perf/arch/x86/include/dwarf-regs-table.h |   2 +-
 tools/perf/builtin-report.c                    |   1 -
 tools/perf/trace/beauty/mmap.c                 |  72 +-----------
 tools/perf/ui/browsers/hists.c                 |   7 +-
 tools/perf/ui/hist.c                           |  15 +++
 tools/perf/ui/stdio/hist.c                     |  25 +---
 tools/perf/util/annotate.c                     |  37 +++---
 tools/perf/util/annotate.h                     |   2 +-
 tools/perf/util/dso.c                          |   3 +
 tools/perf/util/event.c                        |   7 +-
 tools/perf/util/evsel.h                        |   2 +
 tools/perf/util/hist.c                         | 154 ++++++++++++++++++++++++-
 tools/perf/util/hist.h                         |   1 +
 tools/perf/util/map.c                          |   9 +-
 tools/perf/util/parse-events.c                 |   7 +-
 tools/perf/util/parse-events.h                 |   1 +
 tools/perf/util/parse-events.l                 |  22 ++++
 tools/perf/util/parse-events.y                 |  11 ++
 tools/perf/util/sort.h                         |   1 +
 46 files changed, 698 insertions(+), 131 deletions(-)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h
 create mode 100644 tools/arch/arc/include/uapi/asm/mman.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman.h
 create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h
 create mode 100644 tools/include/uapi/asm-generic/mman-common.h
 create mode 100644 tools/include/uapi/asm-generic/mman.h
 create mode 100644 tools/include/uapi/linux/mman.h

  [root@jouet ~]# 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: parse events tests                                       : Ok
   6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
   7: Test perf pmu format parsing                             : Ok
   8: Test dso data read                                       : Ok
   9: Test dso data cache                                      : Ok
  10: Test dso data reopen                                     : Ok
  11: roundtrip evsel->name check                              : Ok
  12: Check parsing of sched tracepoints fields                : Ok
  13: Generate and check syscalls:sys_enter_openat event fields: Ok
  14: struct perf_event_attr setup                             : Ok
  15: Test matching and linking multiple hists                 : Ok
  16: Try 'import perf' in python, checking link problems      : Ok
  17: Test breakpoint overflow signal handler                  : Ok
  18: Test breakpoint overflow sampling                        : Ok
  19: Test number of exit event of a simple workload           : Ok
  20: Test software clock events have valid period values      : Ok
  21: Test object code reading                                 : Ok
  22: Test sample parsing                                      : Ok
  23: Test using a dummy software event to keep tracking       : Ok
  24: Test parsing with no sample_id_all bit set               : Ok
  25: Test filtering hist entries                              : Ok
  26: Test mmap thread lookup                                  : Ok
  27: Test thread mg sharing                                   : Ok
  28: Test output sorting of hist entries                      : Ok
  29: Test cumulation of child hist entries                    : Ok
  30: Test tracking with sched_switch                          : Ok
  31: Filter fds with revents mask in a fdarray                : Ok
  32: Add fd to a fdarray, making it autogrow                  : Ok
  33: Test kmod_path__parse function                           : Ok
  34: Test thread map                                          : Ok
  35: Test LLVM searching and compiling                        :
  35.1: Basic BPF llvm compiling test                          : Ok
  35.2: Test kbuild searching                                  : Ok
  35.3: Compile source for BPF prologue generation test        : Ok
  35.4: Compile source for BPF relocation test                 : Ok
  36: Test topology in session                                 : Ok
  37: Test BPF filter                                          :
  37.1: Test basic BPF filtering                               : Ok
  37.2: Test BPF prologue generation                           : Ok
  37.3: Test BPF relocation checker                            : Ok
  38: Test thread map synthesize                               : Ok
  39: Test cpu map synthesize                                  : Ok
  40: Test stat config synthesize                              : Ok
  41: Test stat synthesize                                     : Ok
  42: Test stat round synthesize                               : Ok
  43: Test attr update synthesize                              : Ok
  44: Test events times                                        : Ok
  45: Test backward reading from ring buffer                   : Ok
  46: Test cpu map print                                       : Ok
  47: Test SDT event probing                                   : Ok
  48: Test is_printable_array function                         : Ok
  49: Test bitmap print                                        : Ok
  50: x86 rdpmc test                                           : Ok
  51: Test converting perf time to TSC                         : Ok
  52: Test dwarf unwind                                        : Ok
  53: Test x86 instruction decoder - new instructions          : Ok
  54: Test intel cqm nmi context read                          : Skip
  [root@jouet ~]# 

Build stats:

  # time dm
   1 74.534 alpine:3.4: Ok
   2 25.636 android-ndk:r12b-arm: Ok
   3 78.066 archlinux:latest: Ok
   4 41.189 centos:5: Ok
   5 64.550 centos:6: Ok
   6 74.689 centos:7: Ok
   7 68.580 debian:7: Ok
   8 75.115 debian:8: Ok
   9 75.288 fedora:20: Ok
  10 79.294 fedora:21: Ok
  11 76.839 fedora:22: Ok
  12 76.695 fedora:23: Ok
  13 82.058 fedora:24: Ok
  14 31.649 fedora:24-x-ARC-uClibc: Ok
  15 85.826 fedora:rawhide: Ok
  16 83.272 mageia:5: Ok
  17 76.883 opensuse:13.2: Ok
  18 78.530 opensuse:42.1: Ok
  19 85.315 opensuse:tumbleweed: Ok
  20 63.436 ubuntu:12.04.5: Ok
  21 40.909 ubuntu:14.04: Ok
  22 72.689 ubuntu:14.04.4: Ok
  23 76.374 ubuntu:15.10: Ok
  24 70.309 ubuntu:16.04: Ok
  25 59.159 ubuntu:16.04-x-arm: Ok
  26 56.011 ubuntu:16.04-x-arm64: Ok
  27 56.913 ubuntu:16.04-x-powerpc64: Ok
  28 57.442 ubuntu:16.04-x-powerpc64el: Ok
  29 80.282 ubuntu:16.10: Ok
  30 60.964 ubuntu:16.10-x-arm64: Ok
  31 61.390 ubuntu:16.10-x-powerpc: Ok
  32 63.167 ubuntu:16.10-x-s390: Ok

  real	35m54.027s
  user	0m2.855s
  sys	0m2.652s

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2016-02-19 22:41 Arnaldo Carvalho de Melo
@ 2016-02-20 10:56 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2016-02-20 10:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexei Starovoitov, Andi Kleen,
	Brendan Gregg, Cody P Schafer, David Ahern, Frederic Weisbecker,
	He Kuang, Jeremie Galarneau, Jiri Olsa, Kirill Smelkov, Li Zefan,
	Masami Hiramatsu, Namhyung Kim, Peter Zijlstra, pi3orama,
	Stephane Eranian, Steven Noonan, Wang Nan,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 3b364d7b587db0f0eeafde0f271e0698187de776:
> 
>   perf/core: Remove unused arguments from a bunch of functions (2016-02-17 10:37:48 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to 5b2ea6f2f6ac81a230e6cc68e1473e796a583f00:
> 
>   perf report: Check error during report__collapse_hists() (2016-02-19 19:17:50 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Add 'perf record' --all-user/--all-kernel options, so that one can tell
>   that all the events in the command line should be restricted to the user
>   or kernel levels (Jiri Olsa), i.e.:
> 
> 	perf record -e cycles:u,instructions:u
> 
>   is equivalent to:
> 
>         perf record --all-user -e cycles,instructions
> 
> - Fix percentage update on key press, due to the buffering code
>   (that creates hist_entries that will later be consumed) touching
>   per hists state that is used by the display thread (Namhyung Kim)
> 
> - Bail out when event modifiers not supported by 'perf stat' are
>   specified, i.e.: (Wang Nan)
> 
>   # perf stat -e cycles/no-inherit/ usleep 1
>   event syntax error: 'cycles/no-inherit/'
>                        \___ 'no-inherit' is not usable in 'perf stat'
>   # perf stat -e cycles/foo/ usleep 1
>   event syntax error: 'cycles/foo/'
>                               \___ unknown term
> 
>   valid terms: config,config1,config2,name
>   #
> 
> - Enable setting names for legacy cache, raw and numeric events, e.g: (Wang Nan)
> 
>   # perf record -e cycles -e 4:0x6530160/name=evtx,call-graph=fp/ -a sleep 1
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 1.659 MB perf.data (844 samples) ]
>   # perf evlist
>   cycles
>   evtx
>   #
> 
> Miscelaneous/Infrastructure:
> 
> - Handled scaled == -1 case for counters in 'perf stat', fixing
>   recent, only in perf/core, regression (Andi Kleen)
> 
> - Reference count the cpu and thread maps at set_maps(), fixing the
>   'object code reading' 'perf test' entry when it was requesting a
>   perf_event_attr.sample_freq > /proc/sys/kernel/perf_event_max_sample_rate
>   (Arnaldo Carvalho de Melo)
> 
> - Improve perf_evlist__strerror_open() to provide hints for -EINVAL due
>   to perf_event_attr.sample_freq > /proc/sys/kernel/perf_event_max_sample_rate
>   (Arnaldo Carvalho de Melo)
> 
> - Add checks to various callchain and histogram routines (Namhyung Kim)
> 
> - Fix checking asprintf return value when parsing additional event config terms (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (1):
>       perf stat: Handled scaled == -1 case for counters
> 
> Arnaldo Carvalho de Melo (5):
>       perf evlist: Reference count the cpu and thread maps at set_maps()
>       perf evlist: Handle -EINVAL for sample_freq > max_sample_rate in strerror_open()
>       perf tests: Use perf_evlist__strerror_open() to provide hints about max_freq
>       perf test: Reduce the sample_freq for the 'object code reading' test
>       perf tools: Introduce opt_event_config nonterminal
> 
> Jiri Olsa (1):
>       perf record: Add --all-user/--all-kernel options
> 
> Namhyung Kim (8):
>       perf hists browser: Fix percentage update on key press
>       perf callchain: Check return value of add_child()
>       perf callchain: Check return value of fill_node()
>       perf callchain: Add enum match_result for match_chain()
>       perf callchain: Check return value of split_add_child()
>       perf callchain: Check return value of append_chain_children()
>       perf hists: Return error from hists__collapse_resort()
>       perf report: Check error during report__collapse_hists()
> 
> Wang Nan (7):
>       perf bpf: Rename bpf_prog_priv__clear() to clear_prog_priv()
>       perf tools: Fix checking asprintf return value
>       perf tools: Create config_term_names array
>       perf stat: Bail out on unsupported event config modifiers
>       perf tools: Rename and move pmu_event_name to get_config_name
>       perf tools: Enable config raw and numeric events
>       perf tools: Enable config and setting names for legacy cache events
> 
>  tools/perf/Documentation/perf-record.txt |   6 ++
>  tools/perf/builtin-record.c              |   6 ++
>  tools/perf/builtin-report.c              |  14 ++-
>  tools/perf/builtin-stat.c                |   3 +-
>  tools/perf/perf.h                        |   2 +
>  tools/perf/tests/code-reading.c          |  10 +-
>  tools/perf/tests/parse-events.c          |  52 ++++++++++
>  tools/perf/util/bpf-loader.c             |   6 +-
>  tools/perf/util/callchain.c              | 102 +++++++++++++-----
>  tools/perf/util/evlist.c                 |  24 ++++-
>  tools/perf/util/evsel.c                  |  10 ++
>  tools/perf/util/hist.c                   |  55 +++++++---
>  tools/perf/util/hist.h                   |   6 +-
>  tools/perf/util/parse-events.c           | 173 ++++++++++++++++++++++++++-----
>  tools/perf/util/parse-events.h           |   8 +-
>  tools/perf/util/parse-events.l           |   3 +-
>  tools/perf/util/parse-events.y           |  75 +++++++-------
>  17 files changed, 426 insertions(+), 129 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2016-02-19 22:41 Arnaldo Carvalho de Melo
  2016-02-20 10:56 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-02-19 22:41 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexei Starovoitov, Andi Kleen, Brendan Gregg, Cody P Schafer,
	David Ahern, Frederic Weisbecker, He Kuang, Jeremie Galarneau,
	Jiri Olsa, Kirill Smelkov, Li Zefan, Masami Hiramatsu,
	Namhyung Kim, Peter Zijlstra, pi3orama, Stephane Eranian,
	Steven Noonan, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 3b364d7b587db0f0eeafde0f271e0698187de776:

  perf/core: Remove unused arguments from a bunch of functions (2016-02-17 10:37:48 +0100)

are available in the git repository at:

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

for you to fetch changes up to 5b2ea6f2f6ac81a230e6cc68e1473e796a583f00:

  perf report: Check error during report__collapse_hists() (2016-02-19 19:17:50 -0300)

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

User visible:

- Add 'perf record' --all-user/--all-kernel options, so that one can tell
  that all the events in the command line should be restricted to the user
  or kernel levels (Jiri Olsa), i.e.:

	perf record -e cycles:u,instructions:u

  is equivalent to:

        perf record --all-user -e cycles,instructions

- Fix percentage update on key press, due to the buffering code
  (that creates hist_entries that will later be consumed) touching
  per hists state that is used by the display thread (Namhyung Kim)

- Bail out when event modifiers not supported by 'perf stat' are
  specified, i.e.: (Wang Nan)

  # perf stat -e cycles/no-inherit/ usleep 1
  event syntax error: 'cycles/no-inherit/'
                       \___ 'no-inherit' is not usable in 'perf stat'
  # perf stat -e cycles/foo/ usleep 1
  event syntax error: 'cycles/foo/'
                              \___ unknown term

  valid terms: config,config1,config2,name
  #

- Enable setting names for legacy cache, raw and numeric events, e.g: (Wang Nan)

  # perf record -e cycles -e 4:0x6530160/name=evtx,call-graph=fp/ -a sleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 1.659 MB perf.data (844 samples) ]
  # perf evlist
  cycles
  evtx
  #

Miscelaneous/Infrastructure:

- Handled scaled == -1 case for counters in 'perf stat', fixing
  recent, only in perf/core, regression (Andi Kleen)

- Reference count the cpu and thread maps at set_maps(), fixing the
  'object code reading' 'perf test' entry when it was requesting a
  perf_event_attr.sample_freq > /proc/sys/kernel/perf_event_max_sample_rate
  (Arnaldo Carvalho de Melo)

- Improve perf_evlist__strerror_open() to provide hints for -EINVAL due
  to perf_event_attr.sample_freq > /proc/sys/kernel/perf_event_max_sample_rate
  (Arnaldo Carvalho de Melo)

- Add checks to various callchain and histogram routines (Namhyung Kim)

- Fix checking asprintf return value when parsing additional event config terms (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (1):
      perf stat: Handled scaled == -1 case for counters

Arnaldo Carvalho de Melo (5):
      perf evlist: Reference count the cpu and thread maps at set_maps()
      perf evlist: Handle -EINVAL for sample_freq > max_sample_rate in strerror_open()
      perf tests: Use perf_evlist__strerror_open() to provide hints about max_freq
      perf test: Reduce the sample_freq for the 'object code reading' test
      perf tools: Introduce opt_event_config nonterminal

Jiri Olsa (1):
      perf record: Add --all-user/--all-kernel options

Namhyung Kim (8):
      perf hists browser: Fix percentage update on key press
      perf callchain: Check return value of add_child()
      perf callchain: Check return value of fill_node()
      perf callchain: Add enum match_result for match_chain()
      perf callchain: Check return value of split_add_child()
      perf callchain: Check return value of append_chain_children()
      perf hists: Return error from hists__collapse_resort()
      perf report: Check error during report__collapse_hists()

Wang Nan (7):
      perf bpf: Rename bpf_prog_priv__clear() to clear_prog_priv()
      perf tools: Fix checking asprintf return value
      perf tools: Create config_term_names array
      perf stat: Bail out on unsupported event config modifiers
      perf tools: Rename and move pmu_event_name to get_config_name
      perf tools: Enable config raw and numeric events
      perf tools: Enable config and setting names for legacy cache events

 tools/perf/Documentation/perf-record.txt |   6 ++
 tools/perf/builtin-record.c              |   6 ++
 tools/perf/builtin-report.c              |  14 ++-
 tools/perf/builtin-stat.c                |   3 +-
 tools/perf/perf.h                        |   2 +
 tools/perf/tests/code-reading.c          |  10 +-
 tools/perf/tests/parse-events.c          |  52 ++++++++++
 tools/perf/util/bpf-loader.c             |   6 +-
 tools/perf/util/callchain.c              | 102 +++++++++++++-----
 tools/perf/util/evlist.c                 |  24 ++++-
 tools/perf/util/evsel.c                  |  10 ++
 tools/perf/util/hist.c                   |  55 +++++++---
 tools/perf/util/hist.h                   |   6 +-
 tools/perf/util/parse-events.c           | 173 ++++++++++++++++++++++++++-----
 tools/perf/util/parse-events.h           |   8 +-
 tools/perf/util/parse-events.l           |   3 +-
 tools/perf/util/parse-events.y           |  75 +++++++-------
 17 files changed, 426 insertions(+), 129 deletions(-)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2015-08-26 15:57 Arnaldo Carvalho de Melo
@ 2015-08-28  6:24 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2015-08-28  6:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Masami Hiramatsu, Namhyung Kim,
	pi3orama, Stephane Eranian, Steven Rostedt, Sukadev Bhattiprolu,
	Wang Nan, Zefan Li, Arnaldo Carvalho de Melo, Peter Zijlstra


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, this replaces the previous perf-core-for-mingo
> pull req, replacing the last patch in that series and adding a few more fixes from
> Jiri and Wang,
> 
> Thanks,
> 
> - Arnaldo
> 
> The following changes since commit 0e53909a1cf0153736fb52c216558a65530d8c40:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-08-22 08:45:46 +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
> 
> for you to fetch changes up to a2fb3382edbea83c6f2bf6ac15e3673b2e254aad:
> 
>   tracing/uprobes: Do not print '0x (null)' when offset is 0 (2015-08-26 10:43:01 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Add support for using several Intel PT features (CYC, MTC packets), the
>   relevant documentation was updated: tools/perf/Documentation/intel-pt.txt,
>   briefly describing those packets, its purposes, how to configure them in
>   the event config terms and relevant external documentation for further
>   reading. (Adrian Hunter)
> 
> - Introduce support for probing at an absolute address, for user and kernel
>   'perf probe's, useful when one have the symbol maps on a developer machine
>   but not on an embedded system (Wang Nan)
> 
> - Fix 'perf probe' list results when a symbol can't be found or the
>   address is zero and when an offset is provided without a function (Wang Nan)
> 
> - Do not print '0x (null)' in uprobes when offset is zero (Wang Nan)
> 
> - Clear the progress bar at the end of a ordered_events flush, fixing
>   an UI artifact when, after ordering the events the screen doesn't get
>   completely redraw, for instance, when an error window covers just the
>   center of the screen and waits for user input. (Arnaldo Carvalho de Melo)
> 
> - Fix 'annotate' segfault by resetting the dso find_symbol cache when removing
>   symbols (Arnaldo Carvalho de Melo)
> 
> Infrastructure:
> 
> - Allow duplicate objects in the object list, just like it is possible to have
>   things like this, in the kernel: (Jiri Olsa)
> 
>   drivers/Makefile:obj-$(CONFIG_PCI)        += usb/
>   drivers/Makefile:obj-$(CONFIG_USB_GADGET) += usb/
> 
> - Fix Intel PT 'instructions' sample period (Adrian Hunter)
> 
> - Prevent segfault when reading probe point with absolute address (Wang Nan)
> 
> Build fixes:
> 
> - Fix tarball build broken by pt/bts (Adrian Hunter)
> 
> - Remove export.h from MANIFEST, fixing the perf tarball make target (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (11):
>       perf tools: Fix tarball build broken by pt/bts
>       perf tools: Fix Intel PT 'instructions' sample period
>       perf tools: Add Intel PT support for PSB periods
>       perf tools: Add new Intel PT packet definitions
>       perf tools: Pass Intel PT information for decoding MTC and CYC
>       perf tools: Add Intel PT support for decoding MTC packets
>       perf tools: Add Intel PT support for using MTC packets
>       perf tools: Add Intel PT support for decoding CYC packets
>       perf tools: Add Intel PT support for using CYC packets
>       perf tools: Add Intel PT support for decoding TRACESTOP packets
>       perf tools: Update Intel PT documentation
> 
> Arnaldo Carvalho de Melo (3):
>       perf annotate: Reset the dso find_symbol cache when removing symbols
>       perf ui tui progress: Implement the ui_progress_ops->finish() method
>       perf ordered_events: Clear the progress bar at the end of a flush
> 
> Jiri Olsa (2):
>       perf tools: Remove export.h from MANIFEST
>       tools build: Allow duplicate objects in the object list
> 
> Wang Nan (6):
>       perf probe: Prevent segfault when reading probe point with absolute address
>       perf probe: Fix list result when symbol can't be found
>       perf probe: Fix list result when address is zero
>       perf probe: Fix error reported when offset without function
>       perf probe: Support probing at absolute address
>       tracing/uprobes: Do not print '0x (null)' when offset is 0
> 
>  kernel/trace/trace_uprobe.c                        |  17 +-
>  tools/build/Documentation/Build.txt                |   1 +
>  tools/build/Makefile.build                         |   2 +-
>  tools/build/tests/ex/Build                         |   1 +
>  tools/perf/Documentation/intel-pt.txt              | 194 ++++++-
>  tools/perf/MANIFEST                                |   1 -
>  tools/perf/arch/x86/util/intel-pt.c                | 271 +++++++++-
>  tools/perf/builtin-annotate.c                      |   1 +
>  tools/perf/ui/tui/progress.c                       |  19 +-
>  tools/perf/util/dso.h                              |   2 +
>  tools/perf/util/intel-pt-decoder/inat.c            |   2 +-
>  tools/perf/util/intel-pt-decoder/inat.h            |   2 +-
>  tools/perf/util/intel-pt-decoder/inat_types.h      |  29 ++
>  tools/perf/util/intel-pt-decoder/insn.c            |   4 +-
>  tools/perf/util/intel-pt-decoder/insn.h            |   2 +-
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 555 ++++++++++++++++++++-
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |   5 +
>  .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |   2 +-
>  .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   | 142 +++++-
>  .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   6 +
>  tools/perf/util/intel-pt.c                         |  67 ++-
>  tools/perf/util/intel-pt.h                         |   5 +
>  tools/perf/util/ordered-events.c                   |   3 +
>  tools/perf/util/probe-event.c                      | 210 +++++++-
>  tools/perf/util/probe-event.h                      |   4 +
>  tools/perf/util/probe-finder.c                     |  21 +-
>  tools/perf/util/symbol.c                           |  10 +
>  27 files changed, 1481 insertions(+), 97 deletions(-)
>  create mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2015-08-26 15:57 Arnaldo Carvalho de Melo
  2015-08-28  6:24 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-08-26 15:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Masami Hiramatsu, Namhyung Kim, pi3orama, Stephane Eranian,
	Steven Rostedt, Sukadev Bhattiprolu, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this replaces the previous perf-core-for-mingo
pull req, replacing the last patch in that series and adding a few more fixes from
Jiri and Wang,

Thanks,

- Arnaldo

The following changes since commit 0e53909a1cf0153736fb52c216558a65530d8c40:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-08-22 08:45:46 +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

for you to fetch changes up to a2fb3382edbea83c6f2bf6ac15e3673b2e254aad:

  tracing/uprobes: Do not print '0x (null)' when offset is 0 (2015-08-26 10:43:01 -0300)

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

User visible:

- Add support for using several Intel PT features (CYC, MTC packets), the
  relevant documentation was updated: tools/perf/Documentation/intel-pt.txt,
  briefly describing those packets, its purposes, how to configure them in
  the event config terms and relevant external documentation for further
  reading. (Adrian Hunter)

- Introduce support for probing at an absolute address, for user and kernel
  'perf probe's, useful when one have the symbol maps on a developer machine
  but not on an embedded system (Wang Nan)

- Fix 'perf probe' list results when a symbol can't be found or the
  address is zero and when an offset is provided without a function (Wang Nan)

- Do not print '0x (null)' in uprobes when offset is zero (Wang Nan)

- Clear the progress bar at the end of a ordered_events flush, fixing
  an UI artifact when, after ordering the events the screen doesn't get
  completely redraw, for instance, when an error window covers just the
  center of the screen and waits for user input. (Arnaldo Carvalho de Melo)

- Fix 'annotate' segfault by resetting the dso find_symbol cache when removing
  symbols (Arnaldo Carvalho de Melo)

Infrastructure:

- Allow duplicate objects in the object list, just like it is possible to have
  things like this, in the kernel: (Jiri Olsa)

  drivers/Makefile:obj-$(CONFIG_PCI)        += usb/
  drivers/Makefile:obj-$(CONFIG_USB_GADGET) += usb/

- Fix Intel PT 'instructions' sample period (Adrian Hunter)

- Prevent segfault when reading probe point with absolute address (Wang Nan)

Build fixes:

- Fix tarball build broken by pt/bts (Adrian Hunter)

- Remove export.h from MANIFEST, fixing the perf tarball make target (Jiri Olsa)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (11):
      perf tools: Fix tarball build broken by pt/bts
      perf tools: Fix Intel PT 'instructions' sample period
      perf tools: Add Intel PT support for PSB periods
      perf tools: Add new Intel PT packet definitions
      perf tools: Pass Intel PT information for decoding MTC and CYC
      perf tools: Add Intel PT support for decoding MTC packets
      perf tools: Add Intel PT support for using MTC packets
      perf tools: Add Intel PT support for decoding CYC packets
      perf tools: Add Intel PT support for using CYC packets
      perf tools: Add Intel PT support for decoding TRACESTOP packets
      perf tools: Update Intel PT documentation

Arnaldo Carvalho de Melo (3):
      perf annotate: Reset the dso find_symbol cache when removing symbols
      perf ui tui progress: Implement the ui_progress_ops->finish() method
      perf ordered_events: Clear the progress bar at the end of a flush

Jiri Olsa (2):
      perf tools: Remove export.h from MANIFEST
      tools build: Allow duplicate objects in the object list

Wang Nan (6):
      perf probe: Prevent segfault when reading probe point with absolute address
      perf probe: Fix list result when symbol can't be found
      perf probe: Fix list result when address is zero
      perf probe: Fix error reported when offset without function
      perf probe: Support probing at absolute address
      tracing/uprobes: Do not print '0x (null)' when offset is 0

 kernel/trace/trace_uprobe.c                        |  17 +-
 tools/build/Documentation/Build.txt                |   1 +
 tools/build/Makefile.build                         |   2 +-
 tools/build/tests/ex/Build                         |   1 +
 tools/perf/Documentation/intel-pt.txt              | 194 ++++++-
 tools/perf/MANIFEST                                |   1 -
 tools/perf/arch/x86/util/intel-pt.c                | 271 +++++++++-
 tools/perf/builtin-annotate.c                      |   1 +
 tools/perf/ui/tui/progress.c                       |  19 +-
 tools/perf/util/dso.h                              |   2 +
 tools/perf/util/intel-pt-decoder/inat.c            |   2 +-
 tools/perf/util/intel-pt-decoder/inat.h            |   2 +-
 tools/perf/util/intel-pt-decoder/inat_types.h      |  29 ++
 tools/perf/util/intel-pt-decoder/insn.c            |   4 +-
 tools/perf/util/intel-pt-decoder/insn.h            |   2 +-
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 555 ++++++++++++++++++++-
 .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |   5 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |   2 +-
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   | 142 +++++-
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   6 +
 tools/perf/util/intel-pt.c                         |  67 ++-
 tools/perf/util/intel-pt.h                         |   5 +
 tools/perf/util/ordered-events.c                   |   3 +
 tools/perf/util/probe-event.c                      | 210 +++++++-
 tools/perf/util/probe-event.h                      |   4 +
 tools/perf/util/probe-finder.c                     |  21 +-
 tools/perf/util/symbol.c                           |  10 +
 27 files changed, 1481 insertions(+), 97 deletions(-)
 create mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [GIT PULL 00/22] perf/core improvements and fixes
  2014-05-21 13:12 Jiri Olsa
@ 2014-05-22  9:38 ` Ingo Molnar
  0 siblings, 0 replies; 36+ messages in thread
From: Ingo Molnar @ 2014-05-22  9:38 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
	David Ahern, Frederic Weisbecker, Michael Lentine, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian


* Jiri Olsa <jolsa@kernel.org> wrote:

> hi Ingo,
> please consider pulling
> 
> thanks,
> jirka
> 
> 
> The following changes since commit 6480c56130ba073df84d57d61062ec4118b10bbe:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core (2014-05-20 08:36:09 +0200)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to eca8183699964579ca8a0b8d116bd1f4da0136f7:
> 
>   perf tools: Add automatic remapping of Android libraries (2014-05-21 15:03:25 +0200)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> . Android related fixes for pager and map dso resolving (Michael Lentine)
> 
> . Add -F option for specifying output fields (Namhyung Kim)
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> 
> ----------------------------------------------------------------
> Michael Lentine (2):
>       perf tools: Add cat as fallback pager
>       perf tools: Add automatic remapping of Android libraries
> 
> Namhyung Kim (20):
>       perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt
>       perf tools: Convert sort entries to hpp formats
>       perf tools: Use hpp formats to sort hist entries
>       perf tools: Support event grouping in hpp ->sort()
>       perf tools: Use hpp formats to sort final output
>       perf tools: Consolidate output field handling to hpp format routines
>       perf ui: Get rid of callback from __hpp__fmt()
>       perf tools: Allow hpp fields to be sort keys
>       perf tools: Consolidate management of default sort orders
>       perf tools: Call perf_hpp__init() before setting up GUI browsers
>       perf report: Add -F option to specify output fields
>       perf tools: Add ->sort() member to struct sort_entry
>       perf report/tui: Fix a bug when --fields/sort is given
>       perf top: Add --fields option to specify output fields
>       perf tools: Skip elided sort entries
>       perf hists: Reset width of output fields with header length
>       perf tools: Get rid of obsolete hist_entry__sort_list
>       perf tools: Introduce reset_output_field()
>       perf tests: Factor out print_hists_*()
>       perf tests: Add a testcase for histogram output sorting
> 
>  tools/perf/Documentation/perf-diff.txt   |   5 +-
>  tools/perf/Documentation/perf-report.txt |  19 +
>  tools/perf/Documentation/perf-top.txt    |  14 +-
>  tools/perf/Makefile.perf                 |   1 +
>  tools/perf/builtin-diff.c                |   7 +-
>  tools/perf/builtin-report.c              |  41 +-
>  tools/perf/builtin-top.c                 |  20 +-
>  tools/perf/tests/builtin-test.c          |   4 +
>  tools/perf/tests/hists_common.c          |  57 +++
>  tools/perf/tests/hists_common.h          |   3 +
>  tools/perf/tests/hists_filter.c          |  38 +-
>  tools/perf/tests/hists_link.c            |  30 +-
>  tools/perf/tests/hists_output.c          | 618 +++++++++++++++++++++++++++++++
>  tools/perf/tests/tests.h                 |   1 +
>  tools/perf/ui/browsers/hists.c           | 104 +++---
>  tools/perf/ui/gtk/hists.c                |  41 +-
>  tools/perf/ui/hist.c                     | 244 +++++++++---
>  tools/perf/ui/setup.c                    |   2 -
>  tools/perf/ui/stdio/hist.c               |  79 ++--
>  tools/perf/util/hist.c                   |  83 ++---
>  tools/perf/util/hist.h                   |  27 +-
>  tools/perf/util/map.c                    |  95 ++++-
>  tools/perf/util/pager.c                  |  12 +-
>  tools/perf/util/sort.c                   | 436 ++++++++++++++++++++--
>  tools/perf/util/sort.h                   |   6 +
>  25 files changed, 1601 insertions(+), 386 deletions(-)
>  create mode 100644 tools/perf/tests/hists_output.c

Pulled, thanks a lot Jiri!

	Ingo

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 00/22] perf/core improvements and fixes
@ 2014-05-21 13:12 Jiri Olsa
  2014-05-22  9:38 ` Ingo Molnar
  0 siblings, 1 reply; 36+ messages in thread
From: Jiri Olsa @ 2014-05-21 13:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Corey Ashford,
	David Ahern, Frederic Weisbecker, Michael Lentine, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian, Jiri Olsa

hi Ingo,
please consider pulling

thanks,
jirka


The following changes since commit 6480c56130ba073df84d57d61062ec4118b10bbe:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core (2014-05-20 08:36:09 +0200)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo

for you to fetch changes up to eca8183699964579ca8a0b8d116bd1f4da0136f7:

  perf tools: Add automatic remapping of Android libraries (2014-05-21 15:03:25 +0200)

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

. Android related fixes for pager and map dso resolving (Michael Lentine)

. Add -F option for specifying output fields (Namhyung Kim)

Signed-off-by: Jiri Olsa <jolsa@kernel.org>

----------------------------------------------------------------
Michael Lentine (2):
      perf tools: Add cat as fallback pager
      perf tools: Add automatic remapping of Android libraries

Namhyung Kim (20):
      perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt
      perf tools: Convert sort entries to hpp formats
      perf tools: Use hpp formats to sort hist entries
      perf tools: Support event grouping in hpp ->sort()
      perf tools: Use hpp formats to sort final output
      perf tools: Consolidate output field handling to hpp format routines
      perf ui: Get rid of callback from __hpp__fmt()
      perf tools: Allow hpp fields to be sort keys
      perf tools: Consolidate management of default sort orders
      perf tools: Call perf_hpp__init() before setting up GUI browsers
      perf report: Add -F option to specify output fields
      perf tools: Add ->sort() member to struct sort_entry
      perf report/tui: Fix a bug when --fields/sort is given
      perf top: Add --fields option to specify output fields
      perf tools: Skip elided sort entries
      perf hists: Reset width of output fields with header length
      perf tools: Get rid of obsolete hist_entry__sort_list
      perf tools: Introduce reset_output_field()
      perf tests: Factor out print_hists_*()
      perf tests: Add a testcase for histogram output sorting

 tools/perf/Documentation/perf-diff.txt   |   5 +-
 tools/perf/Documentation/perf-report.txt |  19 +
 tools/perf/Documentation/perf-top.txt    |  14 +-
 tools/perf/Makefile.perf                 |   1 +
 tools/perf/builtin-diff.c                |   7 +-
 tools/perf/builtin-report.c              |  41 +-
 tools/perf/builtin-top.c                 |  20 +-
 tools/perf/tests/builtin-test.c          |   4 +
 tools/perf/tests/hists_common.c          |  57 +++
 tools/perf/tests/hists_common.h          |   3 +
 tools/perf/tests/hists_filter.c          |  38 +-
 tools/perf/tests/hists_link.c            |  30 +-
 tools/perf/tests/hists_output.c          | 618 +++++++++++++++++++++++++++++++
 tools/perf/tests/tests.h                 |   1 +
 tools/perf/ui/browsers/hists.c           | 104 +++---
 tools/perf/ui/gtk/hists.c                |  41 +-
 tools/perf/ui/hist.c                     | 244 +++++++++---
 tools/perf/ui/setup.c                    |   2 -
 tools/perf/ui/stdio/hist.c               |  79 ++--
 tools/perf/util/hist.c                   |  83 ++---
 tools/perf/util/hist.h                   |  27 +-
 tools/perf/util/map.c                    |  95 ++++-
 tools/perf/util/pager.c                  |  12 +-
 tools/perf/util/sort.c                   | 436 ++++++++++++++++++++--
 tools/perf/util/sort.h                   |   6 +
 25 files changed, 1601 insertions(+), 386 deletions(-)
 create mode 100644 tools/perf/tests/hists_output.c

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2018-11-30 18:27 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 01/22] perf tools: Move headers check into bash script Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 02/22] perf sched timehist: Split is_idle_sample() Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 03/22] perf sched timehist: Introduce struct idle_time_data Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 04/22] perf sched timehist: Save callchain when entering idle Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 05/22] perf sched timehist: Skip non-idle events when necessary Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 06/22] perf sched timehist: Add -I/--idle-hist option Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 07/22] perf sched timehist: Show callchains for idle stat Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 08/22] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 09/22] tools lib bpf: use __u32 from linux/types.h Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 10/22] tools lib bpf: Add flags to bpf_create_map() Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 11/22] samples/bpf: Make samples more libbpf-centric Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 12/22] samples/bpf: Switch over to libbpf Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 13/22] samples/bpf: Remove perf_event_open() declaration Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 14/22] samples/bpf: Move open_raw_sock to separate header Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 15/22] perf sdt: Add scanning of sdt probles arguments Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 16/22] perf tools: Remove some needless __maybe_unused Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 17/22] perf mem: Fix --all-user/--all-kernel options Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 18/22] perf evsel: Use variable instead of repeating lengthy FD macro Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 19/22] perf thread_map: Add thread_map__remove function Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 20/22] perf evsel: Allow to ignore missing pid Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 21/22] perf record: Force ignore_missing_thread for uid option Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 22/22] samples/bpf: Drop unnecessary build targets Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2018-11-30 18:26 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-04-24 19:54 Arnaldo Carvalho de Melo
2017-04-24 20:40 ` Ingo Molnar
2016-10-04  2:36 Arnaldo Carvalho de Melo
2016-10-04  8:07 ` Ingo Molnar
2016-09-20 20:03 Arnaldo Carvalho de Melo
2016-09-20 21:34 ` Ingo Molnar
2016-02-19 22:41 Arnaldo Carvalho de Melo
2016-02-20 10:56 ` Ingo Molnar
2015-08-26 15:57 Arnaldo Carvalho de Melo
2015-08-28  6:24 ` Ingo Molnar
2014-05-21 13:12 Jiri Olsa
2014-05-22  9:38 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).