Skip to content
  1. Mar 11, 2016
    • Namhyung Kim's avatar
      perf tools: Add sort__has_comm variable · 078b8d4a
      Namhyung Kim authored
      
      
      The sort__has_comm variable is to check whether the comm sort key is
      given.  This is necessary to support thread filtering in the TUI hists
      browser later.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1457533253-21419-1-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      078b8d4a
    • Namhyung Kim's avatar
      perf tools: Recalc total periods using top-level entries in hierarchy · f7fb538a
      Namhyung Kim authored
      
      
      When hierarchy mode is enabled, each entry in a hierarchy level shares
      the period.  IOW an upper level entry's period is the sum of lower level
      entries.  Thus perf uses only one of them to calculate the total period
      of hists.  It was lowest-level (leaf) entries but it has a problem when
      it comes to filters.
      
      If a filter is applied, entries in the same level will be filtered or
      not.  But upper level entries still have period of their sum including
      filtered one.  So total sum of upper level entries will not be same as
      sum of lower level entries.
      
      This resulted in entries having more than 100% of overhead and it can be
      produced using perf top with filter(s).
      
      Reported-and-Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-8-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f7fb538a
    • Namhyung Kim's avatar
      perf tools: Remove nr_sort_keys field · 86e3ee52
      Namhyung Kim authored
      
      
      The nr_sort_keys field is to carry the number of sort entries in a
      hpp_list or hists to determine the depth of indentation of a hist entry.
      As it's only used in hierarchy mode and now we have used nr_hpp_node for
      this reason, there's no need to keep it anymore.  Let's get rid of it.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-7-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      86e3ee52
    • Namhyung Kim's avatar
      perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() · 325a6283
      Namhyung Kim authored
      
      
      The hist_browser__fprintf_hierarchy_entry() if to dump current output
      into a file so it needs to be sync-ed with the corresponding function
      hist_browser__show_hierarchy_entry().  So use hists->nr_hpp_node to
      indent width and use first fmt_node to print overhead columns instead of
      checking whether it's a sort entry (or dynamic entry).
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-6-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      325a6283
    • Namhyung Kim's avatar
      perf tools: Remove hist_entry->fmt field · a515d8ff
      Namhyung Kim authored
      
      
      It's not used anymore and the output format is accessed by the hpp_list
      pointer instead when hierarchy is enabled.  Let's get rid of it.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-5-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a515d8ff
    • Namhyung Kim's avatar
      perf tools: Fix command line filters in hierarchy mode · aec13a7e
      Namhyung Kim authored
      
      
      When a command-line filter is applied in hierarchy mode, output is
      broken especially when filtering on lower level.  The higher level
      entries doesn't show up so it's hard to see the results.
      
      Also it needs to handle multi sort keys in a single hierarchy level.
      
      Before:
      
        $ perf report --hierarchy -s 'cpu,{dso,comm}' --comms swapper --stdio
        ...
        #    Overhead  CPU / Shared Object+Command
        # ...........  ...........................
        #
               13.79%     [kernel.vmlinux]  swapper
            31.71%     000
               13.80%     [kernel.vmlinux]  swapper
                0.43%     [e1000e]          swapper
               11.89%     [kernel.vmlinux]  swapper
                9.18%     [kernel.vmlinux]  swapper
      
      After:
      
        #    Overhead  CPU / Shared Object+Command
        # ...........  ...............................
        #
            33.09%     003
               13.79%     [kernel.vmlinux]  swapper
            31.71%     000
               13.80%     [kernel.vmlinux]  swapper
                0.43%     [e1000e]          swapper
            21.90%     002
               11.89%     [kernel.vmlinux]  swapper
            13.30%     001
                9.18%     [kernel.vmlinux]  swapper
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-4-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aec13a7e
    • Namhyung Kim's avatar
      perf tools: Add more sort entry check functions · 4945cf2a
      Namhyung Kim authored
      
      
      Those functions are for checkinf if a given perf_hpp_fmt is a
      filter-related sort entry.  With hierarchy mode, it needs to check
      filters on the hist entries with its own hpp format list.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-3-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4945cf2a
    • Namhyung Kim's avatar
      perf tools: Fix hist_entry__filter() for hierarchy · f4954cfb
      Namhyung Kim authored
      
      
      When hierarchy mode is enabled each output format is in a separate hpp
      list.  So when applying a filter it should check all formats in the
      list.  Currently it only checks a single ->fmt field which was not set
      properly.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457531222-18130-2-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f4954cfb
    • Jiri Olsa's avatar
      perf jitdump: Build only on supported archs · e12b202f
      Jiri Olsa authored
      
      
      Build jitdump only on architectures defined in util/genelf.h file, to avoid
      breaking the build on such arches.
      
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Mel Gorman <mgorman@suse.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20160310164113.GA11357@krava.redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e12b202f
    • Steven Rostedt's avatar
      tools lib traceevent: Add '~' operation within arg_num_eval() · 9eb42dee
      Steven Rostedt authored
      
      
      When evaluating values for print flags, if the value included a '~'
      operator, the parsing would fail. This broke kmalloc's parsing of:
      
      __print_flags(REC->gfp_flags, "|", {(unsigned
      long)((((((( gfp_t)(0x400000u|0x2000000u)) | (( gfp_t)0x40u) |
      (( gfp_t)0x80u) | (( gfp_t)0x20000u)) | (( gfp_t)0x02u)) |
      (( gfp_t)0x08u)) | (( gfp_t)0x4000u) | (( gfp_t)0x10000u) |
      (( gfp_t)0x1000u) | (( gfp_t)0x200u)) & ~(( gfp_t)0x2000000u))
                                              ^
                                              |
                                            here
      
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20160226181328.22f47129@gandalf.local.home
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9eb42dee
  2. Mar 09, 2016
    • Jiri Olsa's avatar
      perf tools: Omit unnecessary cast in perf_pmu__parse_scale · ea8f75f9
      Jiri Olsa authored
      
      
      There's no need to use a const char pointer, we can used char pointer
      from the beginning and omit the unnecessary cast.
      
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20160308184230.GB7897@krava.redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ea8f75f9
    • Jiri Olsa's avatar
      perf tools: Pass perf_hpp_list all the way through setup_sort_list · d7b617f5
      Jiri Olsa authored
      
      
      Pass perf_hpp_list all the way through setup_sort_list so that the sort
      entry can be added on the arbitrary list.
      
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20160309100417.GA30910@krava.redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7b617f5
    • Chris Phlipot's avatar
      perf tools: Fix perf script python database export crash · 616df645
      Chris Phlipot authored
      Remove the union in evsel so that the database id and priv pointer can
      be used simultainously without conflicting and crashing.
      
      Detailed Description for the fixed bug follows:
      
      perf script crashes with a segmentation fault on user space tool version
      4.5.rc7.ge2857b when using the python database export API. It works
      properly in 4.4 and prior versions.
      
      the crash fist appeared in:
      
      cfc8874a
      
       ("perf script: Process cpu/threads maps")
      
      How to reproduce the bug:
      
      Remove any temporary files left over from a previous crash (if you have
      already attemped to reproduce the bug):
      
        $ rm -r test_db-perf-data
        $ dropdb test_db
      
        $ perf record timeout 1 yes >/dev/null
        $ perf script -s scripts/python/export-to-postgresql.py test_db
      
        Stack Trace:
        Program received signal SIGSEGV, Segmentation fault.
        __GI___libc_free (mem=0x1) at malloc.c:2929
        2929	malloc.c: No such file or directory.
        (gdb) bt
          at util/stat.c:122
          argv=<optimized out>, prefix=<optimized out>) at builtin-script.c:2231
          argc=argc@entry=4, argv=argv@entry=0x7fffffffdf70) at perf.c:390
          at perf.c:451
      
      Signed-off-by: default avatarChris Phlipot <cphlipot0@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: cfc8874a
      
       ("perf script: Process cpu/threads maps")
      Link: http://lkml.kernel.org/r/1457500314-8912-1-git-send-email-cphlipot0@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      616df645
    • Arnaldo Carvalho de Melo's avatar
      perf jitdump: DWARF is also needed · 46dad054
      Arnaldo Carvalho de Melo authored
      
      
      While building on a Docker container for ubuntu and installing package
      by package one ends up with:
      
          MKDIR    /tmp/build/util/
          CC       /tmp/build/util/genelf.o
        util/genelf.c:22:19: fatal error: dwarf.h: No such file or directory
         #include <dwarf.h>
                         ^
        compilation terminated.
        mv: cannot stat '/tmp/build/util/.genelf.o.tmp': No such file or directory
      
      Because the jitdump code needs the DWARF related development packages to
      be installed. So make it dependent on that so that the build can succeed
      without jitdump support.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-le498robnmxd40237wej3w62@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      46dad054
    • Ingo Molnar's avatar
      perf bench mem: Prepare the x86-64 build for upstream memcpy_mcsafe() changes · 3a99e6db
      Ingo Molnar authored
      The following upcoming upstream commit:
      
        92b0729c
      
       ("x86/mm, x86/mce: Add memcpy_mcsafe()")
      
      Adds _ASM_EXTABLE_FAULT(), which is not available in user-space
      and breaks the build.
      
      We don't really need _ASM_EXTABLE_FAULT() in user-space, so simply
      wrap it to nothing.
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3a99e6db
    • Borislav Petkov's avatar
      perf/x86/intel/rapl: Simplify quirk handling even more · 7a869805
      Borislav Petkov authored
      
      
      Drop the quirk() function pointer in favor of a simple boolean which
      says whether the quirk should be applied or not. Update comment while at
      it.
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi.kleen@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Harish Chegondi <harish.chegondi@intel.com>
      Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: linux-tip-commits@vger.kernel.org
      Link: http://lkml.kernel.org/r/20160308164041.GF16568@pd.tnic
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      7a869805
  3. Mar 08, 2016
    • Kostenzer Felix's avatar
      x86/nmi: Mark 'ignore_nmis' as __read_mostly · 8e2a7f5b
      Kostenzer Felix authored
      
      
      ignore_nmis is used in two distinct places:
      
       1. modified through {stop,restart}_nmi by alternative_instructions
       2. read by do_nmi to determine if default_do_nmi should be called or not
      
      thus the access pattern conforms to __read_mostly and do_nmi() is a fastpath.
      
      Signed-off-by: default avatarKostenzer Felix <fkostenzer@live.at>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8e2a7f5b
    • Andi Kleen's avatar
      perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere · e17dc653
      Andi Kleen authored
      
      
      Jiri reported some time ago that some entries in the PEBS data source table
      in perf do not agree with the SDM. We investigated and the bits
      changed for Sandy Bridge, but the SDM was not updated.
      
      perf already implements the bits correctly for Sandy Bridge
      and later. This patch patches it up for Nehalem and Westmere.
      
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: jolsa@kernel.org
      Link: http://lkml.kernel.org/r/1456871124-15985-1-git-send-email-andi@firstfloor.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e17dc653
    • Stephane Eranian's avatar
      perf/x86/pebs: Add proper PEBS constraints for Broadwell · b3e62463
      Stephane Eranian authored
      
      
      This patch adds a Broadwell specific PEBS event constraint table.
      
      Broadwell has a fix for the HT corruption bug erratum HSD29 on
      Haswell. Therefore, there is no need to mark events 0xd0, 0xd1, 0xd2,
      0xd3 has requiring the exclusive mode across both sibling HT threads.
      This holds true for regular counting and sampling (see core.c) and
      PEBS (ds.c) which we fix in this patch.
      
      In doing so, we relax evnt scheduling for these events, they can now
      be programmed on any 4 counters without impacting what is measured on
      the sibling thread.
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@redhat.com
      Cc: adrian.hunter@intel.com
      Cc: jolsa@redhat.com
      Cc: kan.liang@intel.com
      Cc: namhyung@kernel.org
      Link: http://lkml.kernel.org/r/1457034642-21837-4-git-send-email-eranian@google.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b3e62463
    • Stephane Eranian's avatar
      perf/x86/pebs: Add workaround for broken OVFL status on HSW+ · 8077eca0
      Stephane Eranian authored
      
      
      This patch fixes an issue with the GLOBAL_OVERFLOW_STATUS bits on
      Haswell, Broadwell and Skylake processors when using PEBS.
      
      The SDM stipulates that when the PEBS iterrupt threshold is crossed,
      an interrupt is posted and the kernel is interrupted. The kernel will
      find GLOBAL_OVF_SATUS bit 62 set indicating there are PEBS records to
      drain. But the bits corresponding to the actual counters should NOT be
      set. The kernel follows the SDM and assumes that all PEBS events are
      processed in the drain_pebs() callback. The kernel then checks for
      remaining overflows on any other (non-PEBS) events and processes these
      in the for_each_bit_set(&status) loop.
      
      As it turns out, under certain conditions on HSW and later processors,
      on PEBS buffer interrupt, bit 62 is set but the counter bits may be
      set as well. In that case, the kernel drains PEBS and generates
      SAMPLES with the EXACT tag, then it processes the counter bits, and
      generates normal (non-EXACT) SAMPLES.
      
      I ran into this problem by trying to understand why on HSW sampling on
      a PEBS event was sometimes returning SAMPLES without the EXACT tag.
      This should not happen on user level code because HSW has the
      eventing_ip which always point to the instruction that caused the
      event.
      
      The workaround in this patch simply ensures that the bits for the
      counters used for PEBS events are cleared after the PEBS buffer has
      been drained. With this fix 100% of the PEBS samples on my user code
      report the EXACT tag.
      
      Before:
        $ perf record -e cpu/event=0xd0,umask=0x81/upp ./multichase
        $ perf report -D | fgrep SAMPLES
        PERF_RECORD_SAMPLE(IP, 0x2): 11775/11775: 0x406de5 period: 73469 addr: 0 exact=Y
                                 \--- EXACT tag is missing
      
      After:
        $ perf record -e cpu/event=0xd0,umask=0x81/upp ./multichase
        $ perf report -D | fgrep SAMPLES
        PERF_RECORD_SAMPLE(IP, 0x4002): 11775/11775: 0x406de5 period: 73469 addr: 0 exact=Y
                                 \--- EXACT tag is set
      
      The problem tends to appear more often when multiple PEBS events are used.
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: adrian.hunter@intel.com
      Cc: kan.liang@intel.com
      Cc: namhyung@kernel.org
      Link: http://lkml.kernel.org/r/1457034642-21837-3-git-send-email-eranian@google.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8077eca0
    • Stephane Eranian's avatar
      perf/x86/intel: Add definition for PT PMI bit · 5690ae28
      Stephane Eranian authored
      
      
      This patch adds a definition for GLOBAL_OVFL_STATUS bit 55
      which is used with the Processor Trace (PT) feature.
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: adrian.hunter@intel.com
      Cc: kan.liang@intel.com
      Cc: namhyung@kernel.org
      Link: http://lkml.kernel.org/r/1457034642-21837-2-git-send-email-eranian@google.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5690ae28
    • Kan Liang's avatar
      perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi · c3d266c8
      Kan Liang authored
      
      
      This patch tries to fix a PEBS warning found in my stress test. The
      following perf command can easily trigger the pebs warning or spurious
      NMI error on Skylake/Broadwell/Haswell platforms:
      
        sudo perf record -e 'cpu/umask=0x04,event=0xc4/pp,cycles,branches,ref-cycles,cache-misses,cache-references' --call-graph fp -b -c1000 -a
      
      Also the NMI watchdog must be enabled.
      
      For this case, the events number is larger than counter number. So
      perf has to do multiplexing.
      
      In perf_mux_hrtimer_handler, it does perf_pmu_disable(), schedule out
      old events, rotate_ctx, schedule in new events and finally
      perf_pmu_enable().
      
      If the old events include precise event, the MSR_IA32_PEBS_ENABLE
      should be cleared when perf_pmu_disable().  The MSR_IA32_PEBS_ENABLE
      should keep 0 until the perf_pmu_enable() is called and the new event is
      precise event.
      
      However, there is a corner case which could restore PEBS_ENABLE to
      stale value during the above period. In perf_pmu_disable(), GLOBAL_CTRL
      will be set to 0 to stop overflow and followed PMI. But there may be
      pending PMI from an earlier overflow, which cannot be stopped. So even
      GLOBAL_CTRL is cleared, the kernel still be possible to get PMI. At
      the end of the PMI handler, __intel_pmu_enable_all() will be called,
      which will restore the stale values if old events haven't scheduled
      out.
      
      Once the stale pebs value is set, it's impossible to be corrected if
      the new events are non-precise. Because the pebs_enabled will be set
      to 0. x86_pmu.enable_all() will ignore the MSR_IA32_PEBS_ENABLE
      setting. As a result, the following NMI with stale PEBS_ENABLE
      trigger pebs warning.
      
      The pending PMI after enabled=0 will become harmless if the NMI handler
      does not change the state. This patch checks cpuc->enabled in pmi and
      only restore the state when PMU is active.
      
      Here is the dump:
      
        Call Trace:
         <NMI>  [<ffffffff813c3a2e>] dump_stack+0x63/0x85
         [<ffffffff810a46f2>] warn_slowpath_common+0x82/0xc0
         [<ffffffff810a483a>] warn_slowpath_null+0x1a/0x20
         [<ffffffff8100fe2e>] intel_pmu_drain_pebs_nhm+0x2be/0x320
         [<ffffffff8100caa9>] intel_pmu_handle_irq+0x279/0x460
         [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
         [<ffffffff811f290d>] ? vunmap_page_range+0x20d/0x330
         [<ffffffff811f2f11>] ?  unmap_kernel_range_noflush+0x11/0x20
         [<ffffffff8148379f>] ? ghes_copy_tofrom_phys+0x10f/0x2a0
         [<ffffffff814839c8>] ? ghes_read_estatus+0x98/0x170
         [<ffffffff81005a7d>] perf_event_nmi_handler+0x2d/0x50
         [<ffffffff810310b9>] nmi_handle+0x69/0x120
         [<ffffffff810316f6>] default_do_nmi+0xe6/0x100
         [<ffffffff810317f2>] do_nmi+0xe2/0x130
         [<ffffffff817aea71>] end_repeat_nmi+0x1a/0x1e
         [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
         [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
         [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
         <<EOE>>  <IRQ>  [<ffffffff81006df8>] ?  x86_perf_event_set_period+0xd8/0x180
         [<ffffffff81006eec>] x86_pmu_start+0x4c/0x100
         [<ffffffff8100722d>] x86_pmu_enable+0x28d/0x300
         [<ffffffff811994d7>] perf_pmu_enable.part.81+0x7/0x10
         [<ffffffff8119cb70>] perf_mux_hrtimer_handler+0x200/0x280
         [<ffffffff8119c970>] ?  __perf_install_in_context+0xc0/0xc0
         [<ffffffff8110f92d>] __hrtimer_run_queues+0xfd/0x280
         [<ffffffff811100d8>] hrtimer_interrupt+0xa8/0x190
         [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
         [<ffffffff81051bd8>] local_apic_timer_interrupt+0x38/0x60
         [<ffffffff817af01d>] smp_apic_timer_interrupt+0x3d/0x50
         [<ffffffff817ad15c>] apic_timer_interrupt+0x8c/0xa0
         <EOI>  [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
         [<ffffffff81123de5>] ?  smp_call_function_single+0xd5/0x130
         [<ffffffff81123ddb>] ?  smp_call_function_single+0xcb/0x130
         [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
         [<ffffffff8119765a>] event_function_call+0x10a/0x120
         [<ffffffff8119c660>] ? ctx_resched+0x90/0x90
         [<ffffffff811971e0>] ? cpu_clock_event_read+0x30/0x30
         [<ffffffff811976d0>] ? _perf_event_disable+0x60/0x60
         [<ffffffff8119772b>] _perf_event_enable+0x5b/0x70
         [<ffffffff81197388>] perf_event_for_each_child+0x38/0xa0
         [<ffffffff811976d0>] ? _perf_event_disable+0x60/0x60
         [<ffffffff811a0ffd>] perf_ioctl+0x12d/0x3c0
         [<ffffffff8134d855>] ? selinux_file_ioctl+0x95/0x1e0
         [<ffffffff8124a3a1>] do_vfs_ioctl+0xa1/0x5a0
         [<ffffffff81036d29>] ? sched_clock+0x9/0x10
         [<ffffffff8124a919>] SyS_ioctl+0x79/0x90
         [<ffffffff817ac4b2>] entry_SYSCALL_64_fastpath+0x1a/0xa4
        ---[ end trace aef202839fe9a71d ]---
        Uhhuh. NMI received for unknown reason 2d on CPU 2.
        Do you have a strange power saving mode enabled?
      
      Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Link: http://lkml.kernel.org/r/1457046448-6184-1-git-send-email-kan.liang@intel.com
      [ Fixed various typos and other small details. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c3d266c8
    • Jiri Olsa's avatar
      perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 · e72daf3f
      Jiri Olsa authored
      
      
      Using PAGE_SIZE buffers makes the WRMSR to PERF_GLOBAL_CTRL in
      intel_pmu_enable_all() mysteriously hang on Core2. As a workaround, we
      don't do this.
      
      The hard lockup is easily triggered by running 'perf test attr'
      repeatedly. Most of the time it gets stuck on sample session with
      small periods.
      
        # perf test attr -vv
        14: struct perf_event_attr setup                             :
        --- start ---
        ...
          'PERF_TEST_ATTR=/tmp/tmpuEKz3B /usr/bin/perf record -o /tmp/tmpuEKz3B/perf.data -c 123 kill >/dev/null 2>&1' ret 1
      
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20160301190352.GA8355@krava.redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e72daf3f
    • Alexander Shishkin's avatar
      perf/core: Fix perf_sched_count derailment · 927a5570
      Alexander Shishkin authored
      
      
      The error path in perf_event_open() is such that asking for a sampling
      event on a PMU that doesn't generate interrupts will end up in dropping
      the perf_sched_count even though it hasn't been incremented for this
      event yet.
      
      Given a sufficient amount of these calls, we'll end up disabling
      scheduler's jump label even though we'd still have active events in the
      system, thereby facilitating the arrival of the infernal regions upon us.
      
      I'm fixing this by moving account_event() inside perf_event_alloc().
      
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: vince@deater.net
      Link: http://lkml.kernel.org/r/1456917854-29427-1-git-send-email-alexander.shishkin@linux.intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      927a5570
    • Ingo Molnar's avatar
      Merge branch 'email/acme' into perf/core · b9461ba8
      Ingo Molnar authored
      
      
      Merge perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
          User visible changes:
      
       - Allow grouping multiple sort keys per 'perf report/top --hierarchy'
         level (Namhyung Kim)
      
       - Document 'perf stat --detailed' option (Borislav Petkov)
      
      Infrastructure changes:
      
       - jitdump prep work for supporting it with Intel PT (Adrian Hunter)
      
       - Use 64-bit shifts with (TSC) time conversion (Adrian Hunter)
      
      Fixes:
      
       - Explicitly declare inc_group_count as a void function (Colin Ian King)
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b9461ba8
    • Namhyung Kim's avatar
      perf report: Use hierarchy hpp list on gtk · 58ecd33b
      Namhyung Kim authored
      
      
      Now hpp formats are linked using perf_hpp_list_node when hierarchy is
      enabled.  Like in stdio, use this info to print entries with multiple
      sort keys in a single hierarchy properly.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-8-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      58ecd33b
    • Namhyung Kim's avatar
      perf hists browser: Use hierarchy hpp list · a61a22f6
      Namhyung Kim authored
      
      
      Now hpp formats are linked using perf_hpp_list_node when hierarchy is
      enabled.  Like in stdio, use this info to print entries with multiple
      sort keys in a single hierarchy properly.
      
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-7-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a61a22f6
    • Namhyung Kim's avatar
      perf report: Use hierarchy hpp list on stdio · f58c95e3
      Namhyung Kim authored
      
      
      Now hpp formats are linked using perf_hpp_list_node when hierarchy is
      enabled.  Use this info to print entries with multiple sort keys in a
      single hierarchy properly.
      
      For example, the below example shows using 4 sort keys with 2 levels.
      
        $ perf report --hierarchy -s '{prev_pid,prev_comm},{next_pid,next_comm}' \
         --percent-limit 1 -i perf.data.sched
        ...
        #    Overhead  prev_pid+prev_comm / next_pid+next_comm
        # ...........  .......................................
        #
            22.36%     0  swapper/0
                9.48%     17773  transmission-gt
                5.25%     109  kworker/0:1H
                1.53%     6524  Xephyr
            21.39%     17773  transmission-gt
                9.52%     0  swapper/0
                9.04%     0  swapper/2
                1.78%     0  swapper/3
      
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-6-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f58c95e3
    • Namhyung Kim's avatar
      perf hists: Fix indent for multiple hierarchy sort key · 2dbbe9f2
      Namhyung Kim authored
      
      
      When multiple sort keys are used in a single hierarchy, it should indent
      using number of hierarchy levels instead of number of sort keys.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-5-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2dbbe9f2
    • Namhyung Kim's avatar
      perf hists: Support multiple sort keys in a hierarchy level · a23f37e8
      Namhyung Kim authored
      
      
      This implements having multiple sort keys in a single hierarchy level.
      Originally only single sort key is supported for each level, but now
      using the group syntax with '{ }', it can set more than one sort key in
      one level.  Note that now it needs to quote in order to prevent shell
      interpretation.
      
      For example:
      
        $ perf report --hierarchy -s '{comm,dso},sym'
        ...
        #       Overhead  Command / Shared Object / Symbol
        # ..............  ..........................................
        #
            48.67%        swapper          [kernel.vmlinux]
               34.42%        [k] intel_idle
                1.30%        [k] __tick_nohz_idle_enter
                1.03%        [k] cpuidle_reflect
             8.87%        firefox          libpthread-2.22.so
                6.60%        [.] __GI___libc_recvmsg
                1.18%        [.] pthread_cond_signal@@GLIBC_2.3.2
                1.09%        [.] 0x000000000000ff4b
             6.11%        Xorg             libc-2.22.so
                5.27%        [.] __memcpy_sse2_unaligned
      
      In the above example, the command name and the shared object name are
      shown on the same line but the symbol name is on the different line.
      Since the first two are grouped by '{}', they are in the same level.
      
      Suggested-and-Tested=by: Arnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-4-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a23f37e8
    • Namhyung Kim's avatar
      perf hists: Use own hpp_list for hierarchy mode · 1b2dbbf4
      Namhyung Kim authored
      
      
      Now each hists has its own hpp lists in hierarchy.  So instead of having
      a pointer to a single perf_hpp_fmt in a hist entry, make it point the
      hpp_list for its level.  This will be used to support multiple sort keys
      in a single hierarchy level.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-3-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1b2dbbf4
    • Namhyung Kim's avatar
      perf hists: Introduce perf_hpp__setup_hists_formats() · c3bc0c43
      Namhyung Kim authored
      
      
      The perf_hpp__setup_hists_formats() is to build hists-specific output
      formats (and sort keys).  Currently it's only used in order to build the
      output format in a hierarchy with same sort keys, but it could be used
      with different sort keys in non-hierarchy mode later.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457361308-514-2-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c3bc0c43
    • Borislav Petkov's avatar
      perf stat: Document --detailed option · f594bae0
      Borislav Petkov authored
      I'm surprised this remained undocumented since at least 2011. And it is
      actually a very useful switch, as Steve and I came to realize recently.
      
      Add the text from
      
        2cba3ffb
      
       ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
      
      which added the incrementing aspect to -d.
      
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mel Gorman <mgorman@suse.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 2cba3ffb
      
       ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
      Link: http://lkml.kernel.org/r/1457347294-32546-1-git-send-email-bp@alien8.de
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f594bae0
    • Namhyung Kim's avatar
      perf hists: Add level field to struct perf_hpp_fmt · 4b633eba
      Namhyung Kim authored
      
      
      The level field is to distinguish levels in the hierarchy mode.
      Currently each column (perf_hpp_fmt) has a different level.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457103582-28396-2-git-send-email-namhyung@kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4b633eba
    • Adrian Hunter's avatar
      perf tools: Use 64-bit shifts with (TSC) time conversion · a23f96ee
      Adrian Hunter authored
      Commit b9511cd7
      
       ("perf/x86: Fix time_shift in perf_event_mmap_page")
      altered the time conversion algorithms documented in the perf_event.h
      header file, to use 64-bit shifts.  That was done to make the code more
      future-proof (i.e. some time in the future a 32-bit shift could be
      allowed).  Reflect those changes in perf tools.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1457005856-6143-9-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a23f96ee
    • Adrian Hunter's avatar
      perf jit: Move clockid validation · 4a018cc4
      Adrian Hunter authored
      
      
      Move clockid validation into jit_process() so it can later be made
      conditional.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1457005856-6143-6-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4a018cc4
    • Adrian Hunter's avatar
      perf jit: Let jit_process() return errors · 570735b3
      Adrian Hunter authored
      
      
      In preparation for moving clockid validation into jit_process().
      
      Previously a return value of zero meant the processing had been done and
      non-zero meant either the processing was not done (i.e. not the jitdump
      file mmap event) or an error occurred.
      
      Change it so that zero means the processing was not done, one means the
      processing was done and successful, and negative values are an error.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1457005856-6143-5-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      570735b3
    • Adrian Hunter's avatar
      perf session: Simplify tool stubs · 5fb0ac16
      Adrian Hunter authored
      
      
      Some of the stubs are identical so just have one function for them.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1457005856-6143-3-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5fb0ac16
    • Adrian Hunter's avatar
      perf inject: Hit all DSOs for AUX data in JIT and other cases · 640dad47
      Adrian Hunter authored
      
      
      Currently, when injecting build ids, if there is AUX data then 'perf
      inject' hits all DSOs because it is not known which DSOs the trace data
      would hit.
      
      That needs to be done for JIT injection also, and in fact there is no
      reason to distinguish what kind of injection is being done.  That is,
      any time there is AUX data and the HEADER_BUID_ID feature flag is set,
      and the AUX data is not being processed, then hit all DSOs.  This patch
      does that.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1457005856-6143-2-git-send-email-adrian.hunter@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      640dad47
    • Colin Ian King's avatar
      perf tools: Explicitly declare inc_group_count as a void function · 07ef7574
      Colin Ian King authored
      
      
      The return type is not defined, so it defaults to int, however, the
      function is not returning anything, so this is clearly not correct. Make
      it a void function.
      
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1457008214-14393-1-git-send-email-colin.king@canonical.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      07ef7574