1. 01 Aug, 2017 4 commits
    • Arnaldo Carvalho de Melo's avatar
      perf trace beauty ioctl: Improve 'cmd' beautifier · 1cc47f2d
      Arnaldo Carvalho de Melo authored
      By using the _IOC_(DIR,NR,TYPE,SIZE) macros to lookup a 'type' keyed
      table that then gets indexed by 'nr', falling back to a notation similar
      to the one used by 'strace', only more compact, i.e.:
      
         474.356 ( 0.007 ms): gnome-shell/22401 ioctl(fd: 8</dev/dri/card0>, cmd: (READ|WRITE, 0x64, 0xae, 0x1c), arg: 0x7ffc934f7880) = 0
         474.369 ( 0.053 ms): gnome-shell/22401 ioctl(fd: 8</dev/dri/card0>, cmd: (READ|WRITE, 0x64, 0xb0, 0x18), arg: 0x7ffc934f77d0) = 0
         505.055 ( 0.014 ms): gnome-shell/22401 ioctl(fd: 8</dev/dri/card0>, cmd: (READ|WRITE, 0x64, 0xaf, 0x4), arg: 0x7ffc934f741c) = 0
      
      This also moves it out of builtin-trace.c and into trace/beauty/ioctl.c
      to better compartimentalize all these formatters.
      
      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-s3enursdxsvnhdomh6qlte4g@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1cc47f2d
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Fixup tools/include/uapi/linux/bpf.h copy of kernel ABI header · f1d6cb2d
      Arnaldo Carvalho de Melo authored
      In 04df41e3 ("bpf: update tools/include/uapi/linux/bpf.h") the files
      added in 40304b2a ("bpf: BPF support for sock_ops") were added to
      tools/include, but not in a verbatim way, missing the comments, which
      ends up triggering this warning when build tools/perf/:
      
        make: Entering directory '/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j4' parallel build
        Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
      
      Make sure the the lines are equal, to fix the simple header copy
      drift detector in tools/perf/.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Lawrence Brakmo <brakmo@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 04df41e3 ("bpf: update tools/include/uapi/linux/bpf.h")
      Link: http://lkml.kernel.org/n/tip-z9qyyqht9qq3yyxu76sfy0dh@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1d6cb2d
    • Arnaldo Carvalho de Melo's avatar
      tools perf: Do not check spaces/blank lines when checking header file copy drift · 470de0f3
      Arnaldo Carvalho de Melo authored
      We copy headers from include/, arch/ to allow tools/ use defines,
      structs from newer kernels and still be able to build on older systems.
      
      We then, as part of a build, check if those copies got out of sync, when
      we emit a warning, so that we can check if something needs to be
      reflected on the tools, e.g. a 'perf trace' syscall argument beautifier
      needs tweaking.
      
      But we don't have to be super strict with that, for instance, extra
      spaces, tabs or blank lines aren't problematic, so change
      check-headers.sh to have "--ignore-blank-lines --ignore-space-change" as
      default "diff" arguments.
      
      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-d8emqpdc3m2qtzt1ei8ra2tf@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      470de0f3
    • Arnaldo Carvalho de Melo's avatar
      tools include uapi: Grab a copy of asm-generic/ioctls.h · 6375f0ab
      Arnaldo Carvalho de Melo authored
      So that we can build on older systems where otherwise we would end up
      with:
      
          CC       /tmp/build/perf/trace/beauty/ioctl.o
        trace/beauty/ioctl.c: In function 'ioctl__scnprintf_tty_cmd':
        trace/beauty/ioctl.c:25:17: error: 'TIOCGEXCL' undeclared (first use in this function)
        trace/beauty/ioctl.c:25:17: note: each undeclared identifier is reported only once for each function it appears in
        trace/beauty/ioctl.c:25:2: error: array index in initializer not of integer type
        trace/beauty/ioctl.c:25:2: error: (near initialization for 'ioctl_tty_cmd')
      
      This way we can build a tool on an older system and it will still be
      capable of processing perf.data files generated on newer systems.
      
      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-8qvkv6txwuzua6d0yvt65wl3@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6375f0ab
  2. 31 Jul, 2017 4 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Fixup tools/include/uapi/linux/bpf.h copy of kernel ABI header · d62c1d72
      Arnaldo Carvalho de Melo authored
      In 2be7e212 ("bpf: add bpf_skb_adjust_room helper") BPF_ADJ_ROOM_NET was
      added to include/uapi/linux/bpf.h but BPF_ADJ_ROOM_NET_OPS was added to
      tools/include/uapi/linux/bpf.h, making these files differ, fix it by using the
      same name in both, BPF_ADJ_ROOM_NET, the one in the kernel headers copy.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 2be7e212 ("bpf: add bpf_skb_adjust_room helper")
      Link: http://lkml.kernel.org/n/tip-2bmwovi9lymplyz6wsszppyf@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d62c1d72
    • Ingo Molnar's avatar
      tools headers: Sync kernel ABI headers with tooling headers · a40f6177
      Ingo Molnar authored
      Sync up (copy) the following v4.13 kernel headers to the tooling headers:
      
        arch/arm/include/uapi/asm/kvm.h:
        arch/arm64/include/uapi/asm/kvm.h:
        arch/powerpc/include/uapi/asm/kvm.h:
        arch/s390/include/uapi/asm/kvm.h:
      
         - KVM ABI extensions, which do not affect perf tooling
      
        arch/x86/include/asm/cpufeatures.h:
        arch/x86/include/asm/disabled-features.h:
      
         - New PCID CPU feature on Intel CPUs - does not affect tooling.
      
      I.e. no real changes were needed to resolve the build warnings, just a plain copy
      of the latest kernel header version.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
      Cc: Geneviève Bastien <gbastien@versatic.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Julien Desfossez <jdesfossez@efficios.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170730095232.4j4xigsoqwufl5hu@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a40f6177
    • Ingo Molnar's avatar
      perf build: Clarify open-coded header version warning message · 8255e1ef
      Ingo Molnar authored
      In this patch we changed the header checks:
      
        perf build: Clarify header version warning message
      
      Unfortunately the header checks were copied to various places and thus the message got
      out of sync. Fix some of them here.
      
      Note that there's still old, misleading messages remaining in:
      
        tools/objtool/Makefile: || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
        tools/objtool/Makefile: || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
      
      here objtool copied the perf message, plus:
      
       tools/perf/util/intel-pt-decoder/Build: || echo "Warning: Intel PT: x86 instruction decoder differs from kernel" >&2 )) || true
      
      here the PT code regressed over the original message and only emits a vague warning
      instead of specific file names...
      
      All of this should be consolidated into tools/Build/ and used in a consistent
      manner.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
      Cc: Geneviève Bastien <gbastien@versatic.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Julien Desfossez <jdesfossez@efficios.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170730095130.bblldwxjz5hamybb@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8255e1ef
    • Ingo Molnar's avatar
      perf build: Clarify header version warning message · c59796d5
      Ingo Molnar authored
      Change this:
      
        Warning: arch/x86/include/asm/disabled-features.h differs from kernel
        Warning: arch/x86/include/asm/cpufeatures.h differs from kernel
        Warning: arch/powerpc/include/uapi/asm/kvm.h differs from kernel
        Warning: arch/s390/include/uapi/asm/kvm.h differs from kernel
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h'
        Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'
      
      ... to make it clearer what the warning is about, and to make it easier
      to diff the two versions when syncing up the files.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
      Cc: Geneviève Bastien <gbastien@versatic.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Julien Desfossez <jdesfossez@efficios.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170730093747.qogjn3lp7ntwcgwg@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c59796d5
  3. 30 Jul, 2017 2 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.14-20170728' of... · c3a3800f
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.14-20170728' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes for 4.14 from Arnaldo Carvalho de Melo:
      
      New features:
      
       - Add PERF_SAMPLE_CALLCHAIN and PERF_RECORD_MMAP[2] to 'perf data' CTF
         conversion, allowing CTF trace visualization tools to show callchains
         and to resolve symbols (Geneviève Bastien)
      
      Improvements:
      
       - Use group read for event groups in 'perf stat', reducing overhead when
         groups are defined in the event specification, i.e. when using {} to
         enclose a list of events, asking them to be read at the same time,
         e.g.: "perf stat -e '{cycles,instructions}'" (Jiri Olsa)
      
      Fixes:
      
       - Do not overwrite perf_sample->weight in 'perf annotate' when
         processing samples, use whatever came from the kernel when
         perf_event_attr.sample_type has PERF_SAMPLE_WEIGHT set or just handle
         its default value, 0, when that is not set and "weight" is one of the
         sort orders chosen (Arnaldo Carvalho de Melo)
      
       - 'perf annotate --show-total-period' fixes:
          - TUI should show period, not nr_samples
          - Set appropriate column width for period/percent
          - Fix the column header to show "Period" when when that is what
            is being asked for
         (Taeung Song, Arnaldo Carvalho de Melo)
      
       - Use default sort if evlist is empty, fixing pipe mode (David Carrillo-Cisneros)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c3a3800f
    • Ingo Molnar's avatar
  4. 28 Jul, 2017 9 commits
  5. 26 Jul, 2017 19 commits
  6. 25 Jul, 2017 2 commits
    • Jiri Olsa's avatar
      perf evsel: Add verbose output for sys_perf_event_open fallback · 2b04e0f8
      Jiri Olsa authored
      Adding info about what is being switched off in the sys_perf_event_open
      fallback.
      
      New output (notice the 'switching off' lines):
      
        $ perf stat -e '{cycles,instructions}' -vvv ls
        Using CPUID GenuineIntel-6-3D
        intel_pt default config: tsc
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
          disabled                         1
          inherit                          1
          enable_on_exec                   1
          exclude_guest                    1
        ------------------------------------------------------------
        sys_perf_event_open: pid 3591  cpu -1  group_fd -1  flags 0x8
        sys_perf_event_open failed, error -22
        switching off cloexec flag
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
          disabled                         1
          inherit                          1
          enable_on_exec                   1
          exclude_guest                    1
        ------------------------------------------------------------
        sys_perf_event_open: pid 3591  cpu -1  group_fd -1  flags 0
        sys_perf_event_open failed, error -22
        switching off exclude_guest, exclude_host
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
          disabled                         1
          inherit                          1
          enable_on_exec                   1
        ------------------------------------------------------------
        sys_perf_event_open: pid 3591  cpu -1  group_fd -1  flags 0
        sys_perf_event_open failed, error -22
        switching off sample_id_all
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          sample_type                      IDENTIFIER
          read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID|GROUP
          disabled                         1
          inherit                          1
          enable_on_exec                   1
        ...
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.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/20170721121212.21414-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2b04e0f8
    • Sudeep Holla's avatar
      perf jvmti: Fix linker error when libelf config is disabled · 5d90faf4
      Sudeep Holla authored
      When libelf is disabled in the configuration, we get the following
      linker error:
      
        LINK     libperf-jvmti.so
        ld: cannot find -lelf
        Makefile.perf:515: recipe for target 'libperf-jvmti.so' failed
      
      Jiri pointed out that both librt and libelf are not really required. So
      this patch fixes the linker error by getting rid of unwanted libraries
      in the linker stage.
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Acked-by: default avatarDavid Carrillo-Cisneros <davidcc@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 209045ad ("perf tools: add JVMTI agent library")
      Link: http://lkml.kernel.org/r/20170719011839.99399-5-davidcc@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d90faf4