1. 22 Feb, 2016 3 commits
    • Namhyung Kim's avatar
      perf tools: Fix segfault on dynamic entries · 665aa757
      Namhyung Kim authored
      A dynamic entry is created for each tracepoint event.  When it sets up
      the sort key, it checks with existing keys using ->equal() callback.
      But it missed to set the ->equal for dynamic entries.  The following
      segfault was due to the missing ->equal() callback.
      
        (gdb) bt
        #0  0x0000000000140003 in ?? ()
        #1  0x0000000000537769 in fmt_equal (b=0x2106980, a=0x21067a0) at ui/hist.c:548
        #2  perf_hpp__setup_output_field (list=0x8c6d80 <perf_hpp_list>) at ui/hist.c:560
        #3  0x00000000004e927e in setup_sorting (evlist=<optimized out>) at util/sort.c:2642
        #4  0x000000000043cf50 in cmd_report (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>)
            at builtin-report.c:932
        #5  0x00000000004865a1 in run_builtin (p=p@entry=0x8bbce0 <commands+192>, argc=argc@entry=7,
            argv=argv@entry=0x7ffd24d56ce0) at perf.c:390
        #6  0x000000000042dc1f in handle_internal_command (argv=0x7ffd24d56ce0, argc=7) at perf.c:451
        #7  run_argv (argv=0x7ffd24d56a70, argcp=0x7ffd24d56a7c) at perf.c:495
        #8  main (argc=7, argv=0x7ffd24d56ce0) at perf.c:620
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1456064558-13086-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      665aa757
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Remove duplicate typedef config_term_func_t definition · 58de6ed0
      Arnaldo Carvalho de Melo authored
      Older compilers don't like this, for instance, on RHEL6.7:
      
          CC       /tmp/build/perf/util/parse-events.o
        util/parse-events.c:844: error: redefinition of typedef ‘config_term_func_t’
        util/parse-events.c:353: note: previous declaration of ‘config_term_func_t’ was here
      
      So remove the second definition, that should've been just moved in 43d0b978
      ("perf tools: Enable config and setting names for legacy cache events"), not copied.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 43d0b978 ("perf tools: Enable config and setting names for legacy cache events")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      58de6ed0
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix build on older systems · 2c97b0d4
      Arnaldo Carvalho de Melo authored
      In RHEL 6.7:
      
        CC       /tmp/build/perf/util/parse-events.o
        cc1: warnings being treated as errors
        util/parse-events.c: In function ‘parse_events_add_cache’:
        util/parse-events.c:366: error: declaration of ‘error’ shadows a global declaration
        util/util.h:136: error: shadowed declaration is here
      
      Rename it to 'err'.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 43d0b978 ("perf tools: Enable config and setting names for legacy cache events")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2c97b0d4
  2. 20 Feb, 2016 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 91e48b7d
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo' 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:
      
      User visible changes:
      
       - 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 changes:
      
       - 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      91e48b7d
  3. 19 Feb, 2016 20 commits
  4. 18 Feb, 2016 2 commits
    • Jiri Olsa's avatar
      perf record: Add --all-user/--all-kernel options · 85723885
      Jiri Olsa authored
      Allow user to easily switch all events to user or kernel space with simple
      --all-user or --all-kernel options.
      
      This will be handy within perf mem/c2c wrappers to switch easily monitoring
      modes.
      
      Committer note:
      
      Testing it:
      
        # perf record --all-kernel --all-user -a sleep 2
         Error: option `all-user' cannot be used with all-kernel
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
              --all-user        Configure all used events to run in user space.
              --all-kernel      Configure all used events to run in kernel space.
        # perf record --all-user --all-kernel -a sleep 2
         Error: option `all-kernel' cannot be used with all-user
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
              --all-kernel      Configure all used events to run in kernel space.
              --all-user        Configure all used events to run in user space.
        # perf record --all-user -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.416 MB perf.data (162 samples) ]
        # perf report | grep '\[k\]'
        # perf record --all-kernel -a sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.423 MB perf.data (296 samples) ]
        # perf report | grep '\[\.\]'
        #
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1455525293-8671-2-git-send-email-jolsa@kernel.org
      [ Made those options to be mutually exclusive ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      85723885
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Reference count the cpu and thread maps at set_maps() · a55e5663
      Arnaldo Carvalho de Melo authored
      We were dropping the reference we possibly held but not obtaining one
      for the new maps, which we will drop at perf_evlist__delete(), fix it.
      
      This was caught by Steven Noonan in some of the machines which would
      produce this output when caught by glibc debug mechanisms:
      
        $ sudo perf test 21
        21: Test object code reading                                 :***
        Error in `perf': corrupted double-linked list: 0x00000000023ffcd0 ***
        ======= Backtrace: =========
        /usr/lib/libc.so.6(+0x72055)[0x7f25be0f3055]
        /usr/lib/libc.so.6(+0x779b6)[0x7f25be0f89b6]
        /usr/lib/libc.so.6(+0x7a0ed)[0x7f25be0fb0ed]
        /usr/lib/libc.so.6(__libc_calloc+0xba)[0x7f25be0fceda]
        perf(parse_events_lex_init_extra+0x38)[0x4cfff8]
        perf(parse_events+0x55)[0x4a0615]
        perf(perf_evlist__config+0xcf)[0x4eeb2f]
        perf[0x479f82]
        perf(test__code_reading+0x1e)[0x47ad4e]
        perf(cmd_test+0x5dd)[0x46452d]
        perf[0x47f4e3]
        perf(main+0x603)[0x42c723]
        /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7f25be0a1610]
        perf(_start+0x29)[0x42c859]
      
      Further investigation using valgrind led to the reference count imbalance fixed
      in this patch.
      Reported-and-Tested-by: default avatarSteven Noonan <steven@uplinklabs.net>
      Report-Link: http://lkml.kernel.org/r/CAKbGBLjC2Dx5vshxyGmQkcD+VwiAQLbHoXA9i7kvRB2-2opHZQ@mail.gmail.com
      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>
      Fixes: f30a79b0 ("perf tools: Add reference counting for cpu_map object")
      Link: http://lkml.kernel.org/n/tip-j0u1bdhr47sa511sgg76kb8h@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a55e5663
  5. 17 Feb, 2016 14 commits