1. 24 Oct, 2017 10 commits
    • Milian Wolff's avatar
      perf callchain: Compare symbol name for inlined frames when matching · 9856240a
      Milian Wolff authored
      The fake symbols we create for inlined frames will represent different
      functions but can use the symbol start address. This leads to issues
      when different inline branches all lead to the same function.
      
      Before:
      ~~~~~
      $ perf report -s sym -i perf.inlining.data --inline --stdio -g function
      ...
                   --38.86%--_start
                             __libc_start_main
                             main
                             |
                              --37.57%--std::norm<double> (inlined)
                                        std::_Norm_helper<true>::_S_do_it<double> (inlined)
                                        |
                                         --36.36%--std::abs<double> (inlined)
                                                   std::__complex_abs (inlined)
                                                   |
                                                    --12.24%--std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>::operator() (inlined)
                                                              std::__detail::__mod<unsigned long, 2147483647ul, 16807ul, 0ul> (inlined)
                                                              std::__detail::_Mod<unsigned long, 2147483647ul, 16807ul, 0ul, true, true>::__calc (inlined)
      ~~~~~
      
      Note that this backtrace representation is completely bogus.
      Complex abs does not call the linear congruential engine! It
      is just a side-effect of a longer inlined stack being appended
      to a shorter, different inlined stack, both of which originate
      in the same function (main).
      
      This patch fixes the issue:
      
      ~~~~~
      $ perf report -s sym -i perf.inlining.data --inline --stdio -g function
      ...
                   --38.86%--_start
                             __libc_start_main
                             main
                             |
                             |--35.59%--std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                             |          std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                             |          |
                             |           --34.37%--std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator() (inlined)
                             |                     std::generate_canonical<double, 53ul, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > (inlined)
                             |                     |
                             |                      --12.24%--std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>::operator() (inlined)
                             |                                std::__detail::__mod<unsigned long, 2147483647ul, 16807ul, 0ul> (inlined)
                             |                                std::__detail::_Mod<unsigned long, 2147483647ul, 16807ul, 0ul, true, true>::__calc (inlined)
                             |
                              --1.99%--std::norm<double> (inlined)
                                        std::_Norm_helper<true>::_S_do_it<double> (inlined)
                                        std::abs<double> (inlined)
                                        std::__complex_abs (inlined)
      ~~~~~
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-10-milian.wolff@kdab.com
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      [ Fix up conflict with c1fbc0cf ("perf callchain: Compare dsos (as well) for CCKEY_FUNCTION"), remove unneeded hunk ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9856240a
    • Milian Wolff's avatar
      perf script: Mark inlined frames and do not print DSO for them · 9628b56d
      Milian Wolff authored
      Instead of showing the (repeated) DSO name of the non-inlined frame, we
      now show the "(inlined)" suffix instead.
      
      Before:
                         214f7 __hypot_finite (/usr/lib/libm-2.25.so)
                          ace3 hypot (/usr/lib/libm-2.25.so)
                           a4a std::__complex_abs (/home/milian/projects/src/perf-tests/inlining)
                           a4a std::abs<double> (/home/milian/projects/src/perf-tests/inlining)
                           a4a std::_Norm_helper<true>::_S_do_it<double> (/home/milian/projects/src/perf-tests/inlining)
                           a4a std::norm<double> (/home/milian/projects/src/perf-tests/inlining)
                           a4a main (/home/milian/projects/src/perf-tests/inlining)
                         20510 __libc_start_main (/usr/lib/libc-2.25.so)
                           bd9 _start (/home/milian/projects/src/perf-tests/inlining)
      
      After:
                         214f7 __hypot_finite (/usr/lib/libm-2.25.so)
                          ace3 hypot (/usr/lib/libm-2.25.so)
                           a4a std::__complex_abs (inlined)
                           a4a std::abs<double> (inlined)
                           a4a std::_Norm_helper<true>::_S_do_it<double> (inlined)
                           a4a std::norm<double> (inlined)
                           a4a main (/home/milian/projects/src/perf-tests/inlining)
                         20510 __libc_start_main (/usr/lib/libc-2.25.so)
                           bd9 _start (/home/milian/projects/src/perf-tests/inlining)
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-9-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9628b56d
    • Milian Wolff's avatar
      perf callchain: Mark inlined frames in output by " (inlined)" suffix · 8932f807
      Milian Wolff authored
      The original patch that introduced inline frame output in the various
      browsers used this suffix already. The new centralized approach that
      uses fake symbols for inlined frames was missing this approach so far.
      
      Instead of changing the symbol name itself, we only print the suffix
      where needed. This allows us to efficiently lookup the symbol for a
      given name without first having to append the suffix before the lookup.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-8-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8932f807
    • Milian Wolff's avatar
      perf report: Fall-back to function name comparison for -g srcline · cbe50f61
      Milian Wolff authored
      When a callchain entry has no srcline available, we ended up comparing
      the instruction pointer. I consider this to be not too useful. Rather, I
      think we should group the entries by function name, which this patch
      adds. For people who want to split the data on the IP boundary, using
      `-g address` is the correct choice.
      
      Before:
      
      ~~~~~
         100.00%    38.86%  [.] main
                  |
                  |--61.14%--main inlining.cpp:14
                  |          std::norm<double> complex:664
                  |          std::_Norm_helper<true>::_S_do_it<double> complex:654
                  |          std::abs<double> complex:597
                  |          std::__complex_abs complex:589
                  |          |
                  |          |--56.03%--hypot
                  |          |          |
                  |          |          |--8.45%--__hypot_finite
                  |          |          |
                  |          |          |--7.62%--__hypot_finite
                  |          |          |
                  |          |          |--2.29%--__hypot_finite
                  |          |          |
                  |          |          |--2.24%--__hypot_finite
                  |          |          |
                  |          |          |--2.06%--__hypot_finite
                  |          |          |
                  |          |          |--1.81%--__hypot_finite
      ...
      ~~~~~
      
      After:
      
      ~~~~~
         100.00%    38.86%  [.] main
                  |
                  |--61.14%--main inlining.cpp:14
                  |          std::norm<double> complex:664
                  |          std::_Norm_helper<true>::_S_do_it<double> complex:654
                  |          std::abs<double> complex:597
                  |          std::__complex_abs complex:589
                  |          |
                  |          |--60.29%--hypot
                  |          |          |
                  |          |           --56.03%--__hypot_finite
                  |          |
                  |           --0.85%--cabs
      ~~~~~
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-7-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cbe50f61
    • Milian Wolff's avatar
      perf callchain: Create real callchain entries for inlined frames · 11ea2515
      Milian Wolff authored
      The inline_node structs are maintained by the new dso->inlines tree.
      This in turn keeps ownership of the fake symbols and srcline string
      representing an inline frame.
      
      This tree is sorted by address to allow quick lookups. All other entries
      of the symbol beside the function name are unused for inline frames. The
      advantage of this approach is that all existing users of the callchain
      API can now transparently display inlined frames without having to patch
      their code.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-6-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      11ea2515
    • Milian Wolff's avatar
      perf callchain: Refactor inline_list to store srcline string directly · 2be8832f
      Milian Wolff authored
      This is a preparation for the creation of real callchain entries for
      inlined frames. The rest of the perf code uses the srcline string. As
      such, using that also for the srcline API allows us to simplify some of
      the upcoming code. Most notably, it will allow us to cache the srcline
      for a given inline node and reuse it for different callchain entries.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-5-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2be8832f
    • Milian Wolff's avatar
      perf callchain: Refactor inline_list to operate on symbols · fea0cf84
      Milian Wolff authored
      This is a requirement to create real callchain entries for inlined
      frames.
      
      Since the list of inlines usually contains the target symbol too, i.e.
      the location where the frames get inlined to, we alias that symbol and
      reuse it as-is is. This ensures that other dependent functionality keeps
      working, most notably annotation of the target frames.
      
      For all other entries in the inline_list, a fake symbol is created.
      These are marked by new 'inlined' member which is set to true. Only
      those symbols are managed by the inline_list and get freed when the
      inline_list is deleted from within inline_node__delete.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-4-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fea0cf84
    • Milian Wolff's avatar
      perf callchain: Store srcline in callchain_cursor_node · 40a342cd
      Milian Wolff authored
      This is mostly a preparation to enable the creation of full callchain
      nodes for inline frames. Such frames will reference the IP of the
      non-inlined frame, but hold the symbol and srcline for an inlined
      location. As such, we won't be able to query the srcline on-demand based
      on the IP alone. Instead, we will leverage the functionality provided by
      this patch here, and store the srcline for the inlined nodes in the new
      srcline member of callchain_cursor_node.
      
      Note that this patch on its own leaks the srcline, as there is no
      free_callchain_cursor_node or similar. A future patch will add caching
      of the srcline and handle deletion properly.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-3-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      40a342cd
    • Milian Wolff's avatar
      perf report: Remove code to handle inline frames from browsers · 2a704fc8
      Milian Wolff authored
      The follow-up commits will make inline frames first-class citizens in
      the callchain, thereby obsoleting all of this special code.
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20171009203310.17362-2-milian.wolff@kdab.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a704fc8
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.15-20171023' of... · 9b7c8547
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.15-20171023' 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:
      
       - Update vendor events JSON metrics for Intel's Broadwell, Broadwell
         Server, Haswell, Haswell Server, IvyBridge, IvyTown, JakeTown, Sandy
         Bridge, Skylake and SkyLake Server (Andi Kleen)
      
       - Add vendor event file for Intel's Goldmont Plus V1 (Kan Liang)
      
       - Move perf_mmap methods from 'perf record' and evlist.c to a separate
         mmap.[ch] pair, to better separate things and pave the way for further
         work on multithreading tools (Arnaldo Carvalho de Melo)
      
       - Do not check ABI headers in a detached tarball build, as it the kernel
         headers from where we copied tools/include/ are by definition not
         available (Arnaldo Carvalho de Melo)
      
       - Make 'perf script' use fprintf() like printing, i.e. receiving a FILE
         pointer so that it gets consistent with other tools/ code and allows
         for printing to per-event files (Arnaldo Carvalho de Melo)
      
       - Error handling fixes (resource release on exit) for 'perf script'
         and 'perf kmem' (Christophe JAILLET)
      
       - Make some 'perf event attr' tests optional on virtual machines, where
         tested counters are not available (Jiri Olsa)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9b7c8547
  2. 23 Oct, 2017 25 commits
  3. 20 Oct, 2017 5 commits
    • Masami Hiramatsu's avatar
      kprobes/docs: Remove jprobes related documents · 9b17374e
      Masami Hiramatsu authored
      Remove jprobes related documentation from kprobes.txt.
      
      Also add some migration advice for the people who are
      still using jprobes.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Ian McDonald <ian.mcdonald@jandi.co.nz>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Link: http://lkml.kernel.org/r/150724539698.5014.7300022363980503141.stgit@devbox
      [ Fixes to the new documentation. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9b17374e
    • Masami Hiramatsu's avatar
      kprobes: Remove the jprobes sample code · 9be95bdc
      Masami Hiramatsu authored
      Remove the jprobes sample module because jprobes are deprecated.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Ian McDonald <ian.mcdonald@jandi.co.nz>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Link: http://lkml.kernel.org/r/150724535709.5014.7261513316230565780.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9be95bdc
    • Masami Hiramatsu's avatar
      kprobes: Disable the jprobes test code · 2c7d662e
      Masami Hiramatsu authored
      Disable jprobes test code because jprobes are deprecated.
      This code will be completely removed when the jprobe code
      is removed.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Ian McDonald <ian.mcdonald@jandi.co.nz>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Link: http://lkml.kernel.org/r/150724531730.5014.6377596890962355763.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2c7d662e
    • Masami Hiramatsu's avatar
      kprobes: Disable the jprobes APIs · 590c8459
      Masami Hiramatsu authored
      Disable the jprobes APIs and comment out the jprobes API function
      code. This is in preparation of removing all jprobes related
      code (including kprobe's break_handler).
      
      Nowadays ftrace and other tracing features are mature enough
      to replace jprobes use-cases. Users can safely use ftrace and
      perf probe etc. for their use cases.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S . Miller <davem@davemloft.net>
      Cc: Ian McDonald <ian.mcdonald@jandi.co.nz>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Link: http://lkml.kernel.org/r/150724527741.5014.15465541485637899227.stgit@devboxSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      590c8459
    • Ingo Molnar's avatar
      ca4b9c3b