1. 13 Jan, 2014 23 commits
  2. 12 Jan, 2014 4 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 1341f3e4
      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 updates from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
      Improvements:
      
       * Support showing source code, asking for variables to be collected
         at probe time and other 'perf probe' operations that use DWARF information.
      
         This supports only binaries with debugging information at this time, detached
         debuginfo (aka debuginfo packages) support should come in later patches.
         (Masami Hiramatsu)
      
       * Add a perf.data file header window in the 'perf report' TUI, associated
         with the 'i' hotkey, providing a counterpart to the --header option in the
         stdio UI. (Namhyung Kim)
      
       * Guest related improvements to 'perf kvm', including allowing to
         specify a directory with guest specific /proc information. (Dongsheng Yang)
      
       * Print session information only if --stdio is given (Namhyung Kim)
      
      Developer stuff:
      
      Fixes:
      
       * Get rid of a duplicate va_end() in error reporting (Namhyung Kim)
      
       * If a hist entry doesn't have symbol information, compare it with its
         address. Affects upcoming new feature (--cumulate) (Namhyung Kim)
      
      Improvements:
      
       * Make libtraceevent install target quieter (Jiri Olsa)
      
       * Make tests/make output more compact (Jiri Olsa)
      
       * Ignore generated files in feature-checks (Chunwei Chen)
      
      New APIs:
      
       * Introduce pevent_filter_strerror() in libtraceevent, similar in
         purpose to libc's strerror() function. (Namhyung Kim)
      
      Refactorings:
      
       * Use perf_data_file methods to write output file in 'record' and
         'inject' (Jiri Olsa)
      
       * Use pr_*() functions where applicable in 'report' (Namhyumg Kim)
      
       * Add 'machine' 'addr_location' struct to have full picture (machine,
         thread, map, symbol, addr) for a (partially) resolved address, reducing
         function signatures (Arnaldo Carvalho de Melo)
      
       * Reduce code duplication in the histogram entry creation/insertion. (Arnaldo Carvalho de Melo)
      
       * Auto allocate annotation histogram data structures, (Arnaldo Carvalho de Melo)
      
       * No need to test against NULL before calling free, also set
         freed memory in struct pointers to NULL, to help fixing use after
         free bugs. (Arnaldo Carvalho de Melo>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1341f3e4
    • Yann Droneaud's avatar
      perf: Introduce a flag to enable close-on-exec in perf_event_open() · a21b0b35
      Yann Droneaud authored
      Unlike recent modern userspace API such as:
      
        epoll_create1 (EPOLL_CLOEXEC), eventfd (EFD_CLOEXEC),
        fanotify_init (FAN_CLOEXEC), inotify_init1 (IN_CLOEXEC),
        signalfd (SFD_CLOEXEC), timerfd_create (TFD_CLOEXEC),
        or the venerable general purpose open (O_CLOEXEC),
      
      perf_event_open() syscall lack a flag to atomically set FD_CLOEXEC
      (eg. close-on-exec) flag on file descriptor it returns to userspace.
      
      The present patch adds a PERF_FLAG_FD_CLOEXEC flag to allow
      perf_event_open() syscall to atomically set close-on-exec.
      
      Having this flag will enable userspace to remove the file descriptor
      from the list of file descriptors being inherited across exec,
      without the need to call fcntl(fd, F_SETFD, FD_CLOEXEC) and the
      associated race condition between the current thread and another
      thread calling fork(2) then execve(2).
      
      Links:
      
       - Secure File Descriptor Handling (Ulrich Drepper, 2008)
         http://udrepper.livejournal.com/20407.html
      
       - Excuse me son, but your code is leaking !!! (Dan Walsh, March 2012)
         http://danwalsh.livejournal.com/53603.html
      
       - Notes in DMA buffer sharing: leak and security hole
         http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/dma-buf-sharing.txt?id=v3.13-rc3#n428Signed-off-by: default avatarYann Droneaud <ydroneaud@opteya.com>
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/8c03f54e1598b1727c19706f3af03f98685d9fe6.1388952061.git.ydroneaud@opteya.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a21b0b35
    • Stephane Eranian's avatar
      perf/x86/intel: Add Intel RAPL PP1 energy counter support · f228c5b8
      Stephane Eranian authored
      This patch adds support for the Intel RAPL energy counter
      PP1 (Power Plane 1).
      
      On client processors, it usually corresponds to the
      energy consumption of the builtin graphic card. That
      is why the sysfs event is called energy-gpu.
      
      New event:
       - name: power/energy-gpu/
       - code: event=0x4
       - unit: 2^-32 Joules
      
      On processors without graphics, this should count 0.
      The patch only enables this event on client processors.
      Reviewed-by: default avatarMaria Dimakopoulou <maria.n.dimakopoulou@gmail.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: ak@linux.intel.com
      Cc: acme@redhat.com
      Cc: jolsa@redhat.com
      Cc: zheng.z.yan@intel.com
      Cc: bp@alien8.de
      Cc: vincent.weaver@maine.edu
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1389176153-3128-3-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f228c5b8
    • Stephane Eranian's avatar
      perf/x86: Fix active_entry initialization · f3ae75de
      Stephane Eranian authored
      This patch fixes a problem with the initialization of the
      struct perf_event active_entry field. It is defined inside
      an anonymous union and was initialized in perf_event_alloc()
      using INIT_LIST_HEAD(). However at that time, we do not know
      whether the event is going to use active_entry or hlist_entry (SW).
      Or at last, we don't want to make that determination there.
      The problem is that hlist and list_head are not initialized
      the same way. One is okay with NULL (from kzmalloc), the other
      needs to pointers to point to self.
      
      This patch resolves this problem by dropping the union.
      This will avoid problems later on, if someone starts using
      active_entry or hlist_entry without verifying that they
      actually overlap. This also solves the initialization
      problem.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: ak@linux.intel.com
      Cc: acme@redhat.com
      Cc: jolsa@redhat.com
      Cc: zheng.z.yan@intel.com
      Cc: bp@alien8.de
      Cc: vincent.weaver@maine.edu
      Cc: maria.n.dimakopoulou@gmail.com
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1389176153-3128-2-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f3ae75de
  3. 27 Dec, 2013 2 commits
  4. 26 Dec, 2013 6 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: No need to test against NULL before calling free() · f5385650
      Arnaldo Carvalho de Melo authored
      Its perfectly fine to call free(NULL), so no need to clutter the source
      code with all those superfluous testing.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-uux5wpvevlerd42gqer13e7n@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f5385650
    • Namhyung Kim's avatar
      perf ui/tui: Implement header window · 6dd60135
      Namhyung Kim authored
      Implement a simple, full-screen header window which shows session header
      (metadata) information.  Press 'i' key to display the header window.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1388036284-32342-4-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6dd60135
    • Namhyung Kim's avatar
      perf ui/tui: Split help message for perf top and report · e8e684a5
      Namhyung Kim authored
      Some hotkeys don't work for perf top so split help messages for them.
      
      It'll be helpful to a future modification.  Also sort the message by
      alphabetical order of the hotkey.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1388036284-32342-3-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e8e684a5
    • Namhyung Kim's avatar
      perf ui/tui: Protect windows by ui__lock · 5c743cf5
      Namhyung Kim authored
      Sometimes perf top TUI breaks display with concurrent help/input window
      and pr_* messages since they're not protected by ui__lock.
      
      You can check it by pressing (and not releasing) 'h' key on a "perf top
      -vvv" TUI session.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1388036284-32342-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5c743cf5
    • Masami Hiramatsu's avatar
      perf probe: Support basic dwarf-based operations on uprobe events · fb7345bb
      Masami Hiramatsu authored
      Support basic dwarf(debuginfo) based operations for uprobe events.  With
      this change, perf probe can analyze debuginfo of user application binary
      to set up new uprobe event.
      
      This allows perf-probe --add(with local variables, line numbers) and
      --line works with -x option.  (Actually, --vars has already accepted -x
      option)
      
      For example, the following command shows the probe-able lines of a given
      user space function. Something that so far was only available in the
      'perf probe' tool for kernel space functions:
      
        # ./perf probe -x perf --line map__load
        <map__load@/home/fedora/ksrc/linux-2.6/tools/perf/util/map.c:0>
              0  int map__load(struct map *map, symbol_filter_t filter)
              1  {
              2         const char *name = map->dso->long_name;
                        int nr;
      
              5         if (dso__loaded(map->dso, map->type))
              6                 return 0;
      
              8         nr = dso__load(map->dso, map, filter);
              9         if (nr < 0) {
             10                 if (map->dso->has_build_id) {
      
      And this shows the available variables at the given line of the
      function.
      
        # ./perf probe -x perf --vars map__load:8
        Available variables at map__load:8
                @<map__load+96>
                        char*   name
                        struct map*     map
                        symbol_filter_t filter
                @<map__find_symbol+112>
                        char*   name
                        symbol_filter_t filter
                @<map__find_symbol_by_name+136>
                        char*   name
                        symbol_filter_t filter
                @<map_groups__find_symbol_by_name+176>
                        char*   name
                        struct map*     map
                        symbol_filter_t filter
      
      And lastly, we can now define probe(s) with all available
      variables on the given line:
      
        # ./perf probe -x perf --add 'map__load:8 $vars'
      
        Added new events:
          probe_perf:map__load (on map__load:8 with $vars)
          probe_perf:map__load_1 (on map__load:8 with $vars)
          probe_perf:map__load_2 (on map__load:8 with $vars)
          probe_perf:map__load_3 (on map__load:8 with $vars)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe_perf:map__load_3 -aR sleep 1
      
        Changes from previous version:
         - Add examples in the patch description.
         - Use .text section start address and dwarf symbol address
           for calculating the offset of given symbol, instead of
           searching the symbol in symtab again.
           With this change, we can safely handle multiple local
           function instances (e.g. scnprintf in perf).
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David A. Long <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: systemtap@sourceware.org
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20131226054152.22364.47021.stgit@kbuild-fedora.novalocalSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fb7345bb
    • Masami Hiramatsu's avatar
      perf probe: Expand given path to absolute path · 8a613d40
      Masami Hiramatsu authored
      Expand given path to absolute path in the option parser, except for a
      module name.
      
      Since realpath at later stage in processing several probe point, can be
      called several times (even if currently doesn't, it can happen when we
      expands the feature), it is waste of the performance.
      
      Processing it once at the early stage can avoid that.
      
      Changes from previous one:
       - Fix not to print null string.
       - Allocate memory for given path/module name everytime.
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: systemtap@sourceware.org
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20131226054150.22364.12187.stgit@kbuild-fedora.novalocal
      [ Clarified the pr_warning message as per David Ahern's suggestion ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a613d40
  5. 23 Dec, 2013 5 commits