1. 22 2月, 2016 6 次提交
  2. 20 2月, 2016 20 次提交
  3. 18 2月, 2016 2 次提交
    • J
      perf record: Add --all-user/--all-kernel options · 85723885
      Jiri Olsa 提交于
      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: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      85723885
    • A
      perf evlist: Reference count the cpu and thread maps at set_maps() · a55e5663
      Arnaldo Carvalho de Melo 提交于
      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: NSteven 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: NArnaldo Carvalho de Melo <acme@redhat.com>
      a55e5663
  4. 17 2月, 2016 10 次提交
  5. 16 2月, 2016 1 次提交
    • A
      perf tests: Fix build on older systems where 'signal' is reserved · 1ad826ba
      Arnaldo Carvalho de Melo 提交于
      fixing the following problems, for instance, on RHEL6.7:
      
          CC       /tmp/build/perf/tests/bp_signal.o
        cc1: warnings being treated as errors
        tests/bp_signal.c: In function ‘__event’:
        tests/bp_signal.c:106: error: declaration of ‘signal’ shadows a global declaration
        /usr/include/signal.h:101: error: shadowed declaration is here
        tests/bp_signal.c: In function ‘bp_event’:
        tests/bp_signal.c:144: error: declaration of ‘signal’ shadows a global declaration
        /usr/include/signal.h:101: error: shadowed declaration is here
        tests/bp_signal.c: In function ‘wp_event’:
        tests/bp_signal.c:149: error: declaration of ‘signal’ shadows a global declaration
        /usr/include/signal.h:101: error: shadowed declaration is here
        mv: cannot stat `/tmp/build/perf/tests/.bp_signal.o.tmp': No such file or directory
        make[3]: *** [/tmp/build/perf/tests/bp_signal.o] Error 1
        make[2]: *** [tests] Error 2
        make[1]: *** [/tmp/build/perf/perf-in.o] Error 2
        make[1]: *** Waiting for unfinished jobs....
      Reported-by: NVinson Lee <vlee@freedesktop.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: pi3orama@163.com
      Fixes: 8fd34e1c ("perf test: Improve bp_signal")
      Link: http://lkml.kernel.org/n/tip-wlpx6tik1b0jirlkw64bv400@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1ad826ba
  6. 13 2月, 2016 1 次提交
    • W
      perf data: Fix releasing event_class · 5141d735
      Wang Nan 提交于
      A new patch in libbabeltrace [1] reveals a object leak problem in
      'perf data' CTF support: perf code never releases the event_class
      which is allocated in add_event() and stored in evsel's private field.
      
      If libbabeltrace has the above patch applied, leaking event_class
      prevents the writer from being destroyed and flushing metadata. For
      example:
      
        $ perf record ls
        perf.data
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.012 MB perf.data (12 samples) ]
        $ perf data convert --to-ctf ./out.ctf
        [ perf data convert: Converted 'perf.data' into CTF data './out.ctf' ]
        [ perf data convert: Converted and wrote 0.000 MB (12 samples) ]
        $ cat ./out.ctf/metadata
        $ ls -l  ./out.ctf/metadata
        -rw-r----- 1 w00229757 mm 0 Jan 27 10:49 ./out.ctf/metadata
      
      The correct result should be:
        ...
        $ cat ./out.ctf/metadata
        /* CTF 1.8 */
      
        trace {
        [SNIP]
      
        $ ls -l  ./out.ctf/metadata
        -rw-r----- 1 w00229757 mm 2446 Jan 27 10:52 ./out.ctf/metadata
      
      The full story is:
      
      Patch [1] of babeltrace redesigns its reference counting scheme. In that
      patch:
      
       * writer <- trace (bt_ctf_writer_create)
       * trace <- stream_class (bt_ctf_trace_add_stream_class)
       * stream_class <- event_class (bt_ctf_stream_class_add_event_class)
       ('<-' means 'is a parent of')
      
      Holding of event_class causes reference count of corresponding 'writer'
      to increase through parent chain. Perf expects that 'writer' is released
      (so metadata is flushed) through bt_ctf_writer_put() in
      ctf_writer__cleanup(). However, since it never releases event_class, the
      reference of 'writer' won't be dropped, so bt_ctf_writer_put() won't
      lead to the release of writer.
      
      Before this CTF patch, !(writer <- trace). Even with event_class leaking,
      the writer ends up being released.
      
      [1] https://github.com/efficios/babeltrace/commit/e6a8e8e4744633807083a077ff9f101eb97d9801Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
      Cc: Kirill Smelkov <kirr@nexedi.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1454680939-24963-6-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5141d735