1. 26 3月, 2015 2 次提交
    • A
      perf evlist: Return the first evsel with an invalid filter in apply_filters() · 23d4aad4
      Arnaldo Carvalho de Melo 提交于
      Use of a bad filter currently generates the message:
       Error: failed to set filter with 22 (Invalid argument)
      
      Add the event name to make it clear to which event the filter
      failed to apply:
        Error: Failed to set filter "foo" on event sched:sg_lb_stats: 22: Invalid argument
      
      To test it use something like:
      
       # perf record -e sched:sched_switch -e sched:*fork --filter parent_pid==1 -e sched:*wait* --filter bla usleep 1
        Error: failed to set filter "bla" on event sched:sched_stat_iowait with 22 (Invalid argument)
       #
      Based-on-a-patch-by: NDavid Ahern <dsahern@gmail.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-d7gq2fjvaecozp9o2i0siifu@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23d4aad4
    • D
      perf timechart: Fix SIBGUS error on sparc64 · e94eedab
      David Ahern 提交于
      perf timechart -T on sparc64 is terminating due to SIGBUS. Backtrace:
      
      Program received signal SIGBUS, Bus error.
      0x0000000000173d7c in perf_evsel__intval (evsel=<value optimized out>, sample=0x7feffffda28, name=0x289b28 "prev_state")
          at util/evsel.c:1918
      1918	util/evsel.c: No such file or directory.
      	in util/evsel.c
      Missing separate debuginfos, use: debuginfo-install audit-libs-2.3.7-1.0.1.el6.sparc64 bzip2-libs-1.0.5-7.el6_0.sparc64 elfutils-libelf-0.155-2.0.3.el6.sparc64 elfutils-libs-0.155-2.0.3.el6.sparc64 glibc-2.12-1.132.0.8.el6_5.sparc64 numactl-2.0.7-8.el6.sparc64 python-libs-2.6.6-52.0.2.el6.sparc64 slang-2.2.1-1.el6.sparc64 xz-libs-4.999.9-0.3.beta.20091007git.el6.sparc64 zlib-1.2.3-29.el6.sparc64
      (gdb) bt
      0  0x0000000000173d7c in perf_evsel__intval (evsel=<value optimized out>, sample=0x7feffffda28,
          name=0x289b28 "prev_state") at util/evsel.c:1918
      1  0x0000000000123b94 in process_sample_sched_switch (tchart=0x7feffffe040, evsel=0x4ca850, sample=0x7feffffda28,
          backtrace=0xc39010 "") at builtin-timechart.c:627
      2  0x0000000000122828 in process_sample_event (tool=0x7feffffe040, event=<value optimized out>, sample=0x7feffffda28,
          evsel=0x4ca850, machine=0x4c9c88) at builtin-timechart.c:569
      
      Another extended load on unaligned pointer. As before fix by copying to
      a temporary variable using memcpy.
      Signed-off-by: NDavid Ahern <david.ahern@oracle.com>
      Link: http://lkml.kernel.org/r/1427228049-51893-1-git-send-email-david.ahern@oracle.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e94eedab
  2. 25 3月, 2015 2 次提交
  3. 24 3月, 2015 7 次提交
  4. 23 3月, 2015 7 次提交
  5. 22 3月, 2015 13 次提交
  6. 21 3月, 2015 4 次提交
  7. 20 3月, 2015 5 次提交
    • W
      perf report: Don't allow empty argument for '-t'. · 0c8c2077
      Wang Nan 提交于
      Without this patch, perf report cause segfault if pass "" as '-t':
      
        $ perf report -t ""
      
         # To display the perf.data header info, please use --header/--header-only options.
         #
         # Samples: 37  of event 'syscalls:sys_enter_write'
         # Event count (approx.): 37
         #
         # Children    SelfCommand   Shared Object         Symbol
         Segmentation fault
      
      Since -t is used to add field-separator for generate table, -t "" is
      actually meanless. This patch defines a new OPT_STRING_NOEMPTY() option
      generator to ensure user never pass empty string to that option.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: pi3orama@163.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1426251114-198991-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0c8c2077
    • W
      perf callchain: Separate eh/debug frame offset cache. · 303cb89a
      Wang Nan 提交于
      Commit f1f13af9 ("perf callchain: Cache eh/debug frame offset for
      dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr.
      Unfortunately, it makes them share a same cache (dso->frame_offset).
      Which causes unwind failure on ARM:
      
         $ perf test unwind
        Test dwarf unwind: FAILED!
      
      The reason is that, if a dso has '.debug_frame' but doesn't have
      '.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset
      of '.debug_frame' during the first time calling of find_proc_info() ->
      read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when
      the second time calling of find_proc_info() ->
      read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to
      '.debug_frame'.
      
      This patch solves the problem by creating two cache fields for
      '.eh_frame_hdr' and '.debug_frame'.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/55028BA0.1030701@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      303cb89a
    • Y
      perf tools: Avoid confusion with preloaded bash function for perf bash completion · 1312c8a8
      Yunlong Song 提交于
      Since some functions (e.g. '_get_comp_words_by_ref()') in perf bash
      completion script are originally taken from git bash completion script,
      these functions may be preloaded before perf bash completion script
      runs.
      
      In order to avoid repeating loading the same function twice, some test
      constraints are used before these function definitions in the perf bash
      completion script (e.g. 'type _get_comp_words_by_ref &>/dev/null ||').
      
      The problem is that, if these functions in perf bash completion script
      are changed for some reason, perf will still use the preloaded bash
      functions rather than the customized functions of its own.
      
      As a result, the perf bash completion will behave incorrectly. To get
      rid of this problem, a flag can be defined to determine the proper
      situation.
      
      And to avoid overwriting the preloaded functions, the names of these
      functions in perf bash completion script should be renamed to the
      perf-customized ones.
      
      Example:
      
      Before this patch:
      
       $ type _get_comp_words_by_ref
       _get_comp_words_by_ref is a function
       _get_comp_words_by_ref ()
       {
           local exclude flag i OPTIND=1;
           local cur cword words=();
           local upargs=() upvars=() vcur vcword vprev vwords;
           while getopts "c:i:n:p:w:" flag "$@"; do
               case $flag in
                   c)
                       vcur=$OPTARG
                   ;;
                   i)
                       vcword=$OPTARG
                   ;;
                   n)
                       exclude=$OPTARG
                   ;;
                   p)
                       vprev=$OPTARG
                   ;;
                   w)
                       vwords=$OPTARG
                   ;;
               esac;
           done;
           while [[ $# -ge $OPTIND ]]; do
               case ${!OPTIND} in
                   cur)
                       vcur=cur
                   ;;
                   prev)
                       vprev=prev
                   ;;
                   cword)
                       vcword=cword
                   ;;
                   words)
                       vwords=words
                   ;;
                   *)
                       echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" 1>&2;
                       return 1
                   ;;
               esac;
               let "OPTIND += 1";
           done;
           __get_cword_at_cursor_by_ref "$exclude" words cword cur;
           [[ -n $vcur ]] && {
               upvars+=("$vcur");
               upargs+=(-v $vcur "$cur")
           };
           [[ -n $vcword ]] && {
               upvars+=("$vcword");
               upargs+=(-v $vcword "$cword")
           };
           [[ -n $vprev && $cword -ge 1 ]] && {
               upvars+=("$vprev");
               upargs+=(-v $vprev "${words[cword - 1]}")
           };
           [[ -n $vwords ]] && {
               upvars+=("$vwords");
               upargs+=(-a${#words[@]} $vwords "${words[@]}")
           };
           (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}"
       }
      
      As shown above, the _get_comp_words_by_ref is the preloaded function in
      fact, rather than the function defined in perf-completion.sh. So if we
      happen to change the function for some reason, the result will behave in
      a wrong state.
      
      After this patch:
      
      We can set preload_get_comp_words_by_ref="false" to not use the preloaded
      function. Instead, it will use the function defined in perf-completion.sh,
      which is renamed as __perf_get_comp_words_by_ref to avoid overwriting
      the preloaded function _get_comp_words_by_ref.
      
       $ type __perf_get_comp_words_by_ref
       __perf_get_comp_words_by_ref is a function
       __perf_get_comp_words_by_ref ()
       {
           local exclude cur_ words_ cword_;
           if [ "$1" = "-n" ]; then
               exclude=$2;
               shift 2;
           fi;
           __my_reassemble_comp_words_by_ref "$exclude";
           cur_=${words_[cword_]};
           while [ $# -gt 0 ]; do
               case "$1" in
                   cur)
                       cur=$cur_
                   ;;
                   prev)
                       prev=${words_[$cword_-1]}
                   ;;
                   words)
                       words=("${words_[@]}")
                   ;;
                   cword)
                       cword=$cword_
                   ;;
               esac;
               shift;
           done
       }
      
      As shown above, the function __perf_get_comp_words_by_ref is loaded and
      can work this time.
      
      Note that we do not change the original behavior when those functions are
      not preloaded before perf bash completion script runs. In this case,
      although the flag is set to "true", the code will still change it to
      "false" to use the function defined in perf-completion.sh.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1426685758-25488-14-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1312c8a8
    • Y
      perf tools: Add the bash completion for listing subsubcommands of perf trace · 6fdd9cb7
      Yunlong Song 提交于
      The bash completion does not support listing subsubcommands for 'perf
      trace <TAB>', so fix it.
      
      Example:
      
      Before this patch:
      
       $ perf trace <TAB>
       $
      
      As shown above, the subsubcommands of perf trace does not come out.
      
      After this patch:
      
       $ perf trace <TAB>
       record
      
      As shown above, the subsubcommands of perf trace can come out now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1426685758-25488-13-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6fdd9cb7
    • Y
      perf tools: Add the bash completion for listing subsubcommands of perf timechart · 33ec0caf
      Yunlong Song 提交于
      The bash completion does not support listing subsubcommands for 'perf
      timechart <TAB>', so fix it.
      
      Example:
      
      Before this patch:
      
       $ perf timechart <TAB>
       $
      
      As shown above, the subsubcommands of perf timechart does not come out.
      
      After this patch:
      
       $ perf timechart <TAB>
       record
      
      As shown above, the subsubcommands of perf timechart can come out now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1426685758-25488-12-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      33ec0caf