1. 08 Mar, 2018 11 commits
  2. 07 Mar, 2018 20 commits
  3. 06 Mar, 2018 5 commits
    • Adrian Hunter's avatar
      perf tools: Fix trigger class trigger_on() · de19e5c3
      Adrian Hunter authored
      trigger_on() means that the trigger is available but not ready, however
      trigger_on() was making it ready. That can segfault if the signal comes
      before trigger_ready(). e.g. (USR2 signal delivery not shown)
      
        $ perf record -e intel_pt//u -S sleep 1
        perf: Segmentation fault
        Obtained 16 stack frames.
        /home/ahunter/bin/perf(sighandler_dump_stack+0x40) [0x4ec550]
        /lib/x86_64-linux-gnu/libc.so.6(+0x36caf) [0x7fa76411acaf]
        /home/ahunter/bin/perf(perf_evsel__disable+0x26) [0x4b9dd6]
        /home/ahunter/bin/perf() [0x43a45b]
        /lib/x86_64-linux-gnu/libc.so.6(+0x36caf) [0x7fa76411acaf]
        /lib/x86_64-linux-gnu/libc.so.6(__xstat64+0x15) [0x7fa7641d2cc5]
        /home/ahunter/bin/perf() [0x4ec6c9]
        /home/ahunter/bin/perf() [0x4ec73b]
        /home/ahunter/bin/perf() [0x4ec73b]
        /home/ahunter/bin/perf() [0x4ec73b]
        /home/ahunter/bin/perf() [0x4eca15]
        /home/ahunter/bin/perf(machine__create_kernel_maps+0x257) [0x4f0b77]
        /home/ahunter/bin/perf(perf_session__new+0xc0) [0x4f86f0]
        /home/ahunter/bin/perf(cmd_record+0x722) [0x43c132]
        /home/ahunter/bin/perf() [0x4a11ae]
        /home/ahunter/bin/perf(main+0x5d4) [0x427fb4]
      
      Note, for testing purposes, this is hard to hit unless you add some sleep()
      in builtin-record.c before record__open().
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: stable@vger.kernel.org
      Fixes: 3dcc4436 ("perf tools: Introduce trigger class")
      Link: http://lkml.kernel.org/r/1519807144-30694-1-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      de19e5c3
    • Adrian Hunter's avatar
      perf auxtrace: Prevent decoding when --no-itrace · 2e2967f4
      Adrian Hunter authored
      Prevent auxtrace_queues__process_index() from queuing AUX area data for
      decoding when the --no-itrace option has been used.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1520327598-1317-3-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2e2967f4
    • Ilya Pronin's avatar
      perf stat: Fix CVS output format for non-supported counters · 40c21898
      Ilya Pronin authored
      When printing stats in CSV mode, 'perf stat' appends extra separators
      when a counter is not supported:
      
      <not supported>,,L1-dcache-store-misses,mesos/bd442f34-2b4a-47df-b966-9b281f9f56fc,0,100.00,,,,
      
      Which causes a failure when parsing fields. The numbers of separators
      should be the same for each line, no matter if the counter is or not
      supported.
      Signed-off-by: default avatarIlya Pronin <ipronin@twitter.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/20180306064353.31930-1-xiyou.wangcong@gmail.com
      Fixes: 92a61f64 ("perf stat: Implement CSV metrics output")
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      40c21898
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.17-20180305' of... · 55b4ce61
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.17-20180305' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      - Be more robust when drawing arrows in the annotation TUI, avoiding a
        segfault when jump instructions have as a target addresses in functions
        other that the one currently being annotated. The full fix will come in
        the following days, when jumping to other functions will work as call
        instructions (Arnaldo Carvalho de Melo)
      
      - Allow asking for the maximum allowed sample rate in 'top' and
        'record', i.e. 'perf record -F max' will read the
        kernel.perf_event_max_sample_rate sysctl and use it (Arnaldo Carvalho de Melo)
      
      - When the user specifies a freq above kernel.perf_event_max_sample_rate,
        Throttle it down to that max freq, and warn the user about it, add as
        well --strict-freq so that the previous behaviour of not starting the
        session when the desired freq can't be used can be selected (Arnaldo Carvalho de Melo)
      
      - Find 'call' instruction target symbol at parsing time, used so far in
        the TUI, part of the infrastructure changes that will end up allowing
        for jumps to navigate to other functions, just like 'call'
        instructions. (Arnaldo Carvalho de Melo)
      
      - Use xyarray dimensions to iterate fds in 'perf stat' (Andi Kleen)
      
      - Ignore threads for which the current user hasn't permissions when
        enabling system-wide --per-thread (Jin Yao)
      
      - Fix some backtrace perf test cases to use 'perf record' + 'perf script'
        instead, till 'perf trace' starts using ordered_events or equivalent
        to avoid symbol resolving artifacts due to reordering of
        PERF_RECORD_MMAP events (Jiri Olsa)
      
      - Fix crash in 'perf record' pipe mode, it needs to allocate the ID
        array even for a single event, unlike non-pipe mode (Jiri Olsa)
      
      - Make annoying fallback message on older kernels with newer 'perf top'
        binaries trying to use overwrite mode and that not being present
        in the older kernels (Kan Liang)
      
      - Switch last users of old APIs to the newer perf_mmap__read_event()
        one, then discard those old mmap read forward APIs (Kan Liang)
      
      - Fix the usage on the 'perf kallsyms' man page (Sangwon Hong)
      
      - Simplify cgroup arguments when tracking multiple events (weiping zhang)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      55b4ce61
    • Ingo Molnar's avatar
      8af31363
  4. 05 Mar, 2018 4 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Sync x86's cpufeatures.h · 4caea057
      Arnaldo Carvalho de Melo authored
      The changes in dd84441a ("x86/speculation: Use IBRS if available
      before calling into firmware") don't need any kind of special treatment
      in the current tools/perf/ codebase, so just update the copy to get rid
      of the perf build warning:
      
        BUILD:   Doing 'make -j4' parallel build
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David Woodhouse <dwmw@amazon.co.uk>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-mzmuxocrf96v922xkerey3ns@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4caea057
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Sync copy of kvm UAPI headers · d976a6e9
      Arnaldo Carvalho de Melo authored
      In 801e459a ("KVM: x86: Add a framework for supporting MSR-based
      features") a new ioctl was introduced, which with this sync of the kvm
      UAPI headers, makes 'perf trace' know about it:
      
        $ cd /tmp/build/perf/trace/beauty/generated/ioctl/
        $ diff -u kvm_ioctl_array.c.old kvm_ioctl_array.c
        --- /tmp/kvm_ioctl_array.c	2018-03-05 11:55:38.409145056 -0300
        +++ /tmp/build/perf/trace/beauty/generated/ioctl/kvm_ioctl_array.c	2018-03-05 11:56:17.456153501 -0300
        @@ -6,6 +6,7 @@
       	[0x04] = "GET_VCPU_MMAP_SIZE",
       	[0x05] = "GET_SUPPORTED_CPUID",
       	[0x09] = "GET_EMULATED_CPUID",
        +	[0x0a] = "GET_MSR_FEATURE_INDEX_LIST",
       	[0x40] = "SET_MEMORY_REGION",
       	[0x41] = "CREATE_VCPU",
       	[0x42] = "GET_DIRTY_LOG",
      
      So when using 'perf trace -e ioctl' that will appear along with the
      others, like in this excerpt of a system wide session:
      
        14.556 ( 0.006 ms): CPU 0/KVM/16077 ioctl(fd: 19<anon_inode:kvm-vcpu:0>, cmd: KVM_RUN) = 0
        14.565 ( 0.006 ms): CPU 0/KVM/16077 ioctl(fd: 19<anon_inode:kvm-vcpu:0>, cmd: KVM_RUN) = 0
        14.573 (         ): CPU 0/KVM/16077 ioctl(fd: 19<anon_inode:kvm-vcpu:0>, cmd: KVM_RUN) ...
        34.075 ( 0.016 ms): gnome-shell/2192 ioctl(fd: 8</dev/dri/card0>, cmd: DRM_I915_GEM_BUSY, arg: 0x7ffe4e73e850) = 0
        40.549 ( 0.012 ms): gnome-shell/2192 ioctl(fd: 8</dev/dri/card0>, cmd: DRM_I915_GEM_BUSY, arg: 0x7ffe4e73ece0) = 0
        40.625 ( 0.005 ms): gnome-shell/2192 ioctl(fd: 8</dev/dri/card0>, cmd: DRM_I915_GEM_BUSY, arg: 0x7ffe4e73e940) = 0
        40.632 ( 0.003 ms): gnome-shell/2192 ioctl(fd: 8</dev/dri/card0>, cmd: DRM_I915_GEM_MADVISE, arg: 0x7ffe4e73e9b0) = 0
      
      This also silences the perf build header copy drift verifier:
      
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j4' parallel build
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
      
      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: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-h31oz5g0mt1dh2s2ajq6o6no@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d976a6e9
    • Jiri Olsa's avatar
      perf record: Fix crash in pipe mode · cfacbabd
      Jiri Olsa authored
      Currently we can crash perf record when running in pipe mode, like:
      
        $ perf record ls | perf report
        # To display the perf.data header info, please use --header/--header-only options.
        #
        perf: Segmentation fault
        Error:
        The - file has no samples!
      
      The callstack of the crash is:
      
          0x0000000000515242 in perf_event__synthesize_event_update_name
        3513            ev = event_update_event__new(len + 1, PERF_EVENT_UPDATE__NAME, evsel->id[0]);
        (gdb) bt
        #0  0x0000000000515242 in perf_event__synthesize_event_update_name
        #1  0x00000000005158a4 in perf_event__synthesize_extra_attr
        #2  0x0000000000443347 in record__synthesize
        #3  0x00000000004438e3 in __cmd_record
        #4  0x000000000044514e in cmd_record
        #5  0x00000000004cbc95 in run_builtin
        #6  0x00000000004cbf02 in handle_internal_command
        #7  0x00000000004cc054 in run_argv
        #8  0x00000000004cc422 in main
      
      The reason of the crash is that the evsel does not have ids array
      allocated and the pipe's synthesize code tries to access it.
      
      We don't force evsel ids allocation when we have single event, because
      it's not needed. However we need it when we are in pipe mode even for
      single event as a key for evsel update event.
      
      Fixing this by forcing evsel ids allocation event for single event, when
      we are in pipe mode.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180302161354.30192-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cfacbabd
    • Arnaldo Carvalho de Melo's avatar
      perf annotate browser: Be more robust when drawing jump arrows · 9cf195f8
      Arnaldo Carvalho de Melo authored
      This first happened with a gcc function, _cpp_lex_token, that has the
      usual jumps:
      
       │1159e6c: ↓ jne    115aa32 <_cpp_lex_token@@Base+0xf92>
      
      I.e. jumps to a label inside that function (_cpp_lex_token), and those
      works, but also this kind:
      
       │1159e8b: ↓ jne    c469be <cpp_named_operator2name@@Base+0xa72>
      
      I.e. jumps to another function, outside _cpp_lex_token, which are not
      being correctly handled generating as a side effect references to
      ab->offset[] entries that are set to NULL, so to make this code more
      robust, check that here.
      
      A proper fix for will be put in place, looking at the function name
      right after the '<' token and probably treating this like a 'call'
      instruction.
      
      For now just don't draw the arrow.
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Tested-by: default avatarIngo Molnar <mingo@kernel.org>
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      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>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Link: https://lkml.kernel.org/n/tip-5tzvb875ep2sel03aeefgmud@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9cf195f8