05 May, 2015

2 commits

  • Currently 'perf kmem stat --page' shows total (page) allocation stat by
    default, but sometimes one might want to see live (total alloc-only)
    requests/pages only. The new --live option does this by subtracting freed
    allocation from the stat.

    E.g.:

    # perf kmem stat --page

    SUMMARY (page allocator)
    ========================
    Total allocation requests : 988,858 [ 4,045,368 KB ]
    Total free requests : 886,484 [ 3,624,996 KB ]

    Total alloc+freed requests : 885,969 [ 3,622,628 KB ]
    Total alloc-only requests : 102,889 [ 422,740 KB ]
    Total free-only requests : 515 [ 2,368 KB ]

    Total allocation failures : 0 [ 0 KB ]

    Order Unmovable Reclaimable Movable Reserved CMA/Isolated
    ----- ------------ ------------ ------------ ------------ ------------
    0 172,173 3,083 806,686 . .
    1 284 . . . .
    2 6,124 58 . . .
    3 114 335 . . .
    4 . . . . .
    5 . . . . .
    6 . . . . .
    7 . . . . .
    8 . . . . .
    9 . . 1 . .
    10 . . . . .
    # perf kmem stat --page --live

    SUMMARY (page allocator)
    ========================
    Total allocation requests : 988,858 [ 4,045,368 KB ]
    Total free requests : 886,484 [ 3,624,996 KB ]

    Total alloc+freed requests : 885,969 [ 3,622,628 KB ]
    Total alloc-only requests : 102,889 [ 422,740 KB ]
    Total free-only requests : 515 [ 2,368 KB ]

    Total allocation failures : 0 [ 0 KB ]

    Order Unmovable Reclaimable Movable Reserved CMA/Isolated
    ----- ------------ ------------ ------------ ------------ ------------
    0 2,214 3,025 97,156 . .
    1 59 . . . .
    2 19 58 . . .
    3 23 335 . . .
    4 . . . . .
    5 . . . . .
    6 . . . . .
    7 . . . . .
    8 . . . . .
    9 . . . . .
    10 . . . . .
    #

    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1429592107-1807-4-git-send-email-namhyung@kernel.org
    [ Added examples to the changeset log ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Add new sort keys for page: page, order, migtype, gfp - existing
    'bytes', 'hit' and 'callsite' sort keys also work for page. Note that
    -s/--sort option should be preceded by either of --slab or --page option
    to determine where the sort keys applies.

    Now it properly groups and sorts allocation stats - so same
    page/caller with different order/migtype/gfp will be printed on a
    different line.

    # perf kmem stat --page --caller -l 10 -s order,hit

    -----------------------------------------------------------------------------
    Total alloc (KB) | Hits | Order | Mig.type | GFP flags | Callsite
    -----------------------------------------------------------------------------
    64 | 4 | 2 | RECLAIM | 00285250 | new_slab
    50,144 | 12,536 | 0 | MOVABLE | 0102005a | __page_cache_alloc
    52 | 13 | 0 | UNMOVABL | 002084d0 | pte_alloc_one
    40 | 10 | 0 | MOVABLE | 000280da | handle_mm_fault
    28 | 7 | 0 | UNMOVABL | 000000d0 | __pollwait
    20 | 5 | 0 | MOVABLE | 000200da | do_wp_page
    20 | 5 | 0 | MOVABLE | 000200da | do_cow_fault
    16 | 4 | 0 | UNMOVABL | 00000200 | __tlb_remove_page
    16 | 4 | 0 | UNMOVABL | 000084d0 | __pmd_alloc
    8 | 2 | 0 | UNMOVABL | 000084d0 | __pud_alloc
    ... | ... | ... | ... | ... | ...
    -----------------------------------------------------------------------------

    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1429592107-1807-3-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

04 May, 2015

19 commits

  • It is 'perf kmem' support caller statistics for page. Unlike slab case,
    the tracepoints in page allocator don't provide callsite info. So it
    records with callchain and extracts callsite info.

    Note that the callchain contains several memory allocation functions
    which has no meaning for users. So skip those functions to get proper
    callsites. I used following regex pattern to skip the allocator
    functions:

    ^_?_?(alloc|get_free|get_zeroed)_pages?

    This gave me a following list of functions:

    # perf kmem record --page sleep 3
    # perf kmem stat --page -v
    ...
    alloc func: __get_free_pages
    alloc func: get_zeroed_page
    alloc func: alloc_pages_exact
    alloc func: __alloc_pages_direct_compact
    alloc func: __alloc_pages_nodemask
    alloc func: alloc_page_interleave
    alloc func: alloc_pages_current
    alloc func: alloc_pages_vma
    alloc func: alloc_page_buffers
    alloc func: alloc_pages_exact_nid
    ...

    The output looks mostly same as --alloc (I also added callsite column
    to that) but groups entries by callsite. Currently, the order,
    migrate type and GFP flag info is for the last allocation and not
    guaranteed to be same for all allocations from the callsite.

    ---------------------------------------------------------------------------------------------
    Total_alloc (KB) | Hits | Order | Mig.type | GFP flags | Callsite
    ---------------------------------------------------------------------------------------------
    1,064 | 266 | 0 | UNMOVABL | 000000d0 | __pollwait
    52 | 13 | 0 | UNMOVABL | 002084d0 | pte_alloc_one
    44 | 11 | 0 | MOVABLE | 000280da | handle_mm_fault
    20 | 5 | 0 | MOVABLE | 000200da | do_cow_fault
    20 | 5 | 0 | MOVABLE | 000200da | do_wp_page
    16 | 4 | 0 | UNMOVABL | 000084d0 | __pmd_alloc
    16 | 4 | 0 | UNMOVABL | 00000200 | __tlb_remove_page
    12 | 3 | 0 | UNMOVABL | 000084d0 | __pud_alloc
    8 | 2 | 0 | UNMOVABL | 00000010 | bio_copy_user_iov
    4 | 1 | 0 | UNMOVABL | 000200d2 | pipe_write
    4 | 1 | 0 | MOVABLE | 000280da | do_wp_page
    4 | 1 | 0 | UNMOVABL | 002084d0 | pgd_alloc
    ---------------------------------------------------------------------------------------------

    Signed-off-by: Namhyung Kim
    Acked-by: Pekka Enberg
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Joonsoo Kim
    Cc: Minchan Kim
    Cc: Peter Zijlstra
    Cc: linux-mm@kvack.org
    Link: http://lkml.kernel.org/r/1429592107-1807-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Currently, perf-probe --list option ignores given event filter.
    ----
    # ./perf probe -l vfs\*
    probe:vfs_read (on vfs_read@ksrc/linux-3/fs/read_write.c)
    probe_libc:malloc (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
    ----

    This changes --list option to accept the event filter argument as below.
    ----
    # ./perf probe -l vfs\*
    probe:vfs_read (on vfs_read@ksrc/linux-3/fs/read_write.c)
    # ./perf probe -l \*libc:\*
    probe_libc:malloc (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094750.23967.53868.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Accept multiple filter options. Each filters are combined by logical-or.
    E.g. --filter abc* --filter *def is same as --filter abc*|*def

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Add strfilter__string to recover rules string from strfilter. This will
    be good for debugging.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094746.23967.52434.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Add strfilter__or/and to append additional rules to existing strfilter.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094744.23967.97614.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Currently, perf probe considers patterns including a '.' to be a file.
    However, this causes problems on powerpc ABIv1 where all functions have
    a leading '.':

    $ perf probe -F | grep schedule_timeout_interruptible
    .schedule_timeout_interruptible
    $ perf probe .schedule_timeout_interruptible
    Semantic error :File always requires line number or lazy pattern.
    Error: Command Parse Error.

    Fix this:
    - by checking the probe pattern in more detail, and
    - skipping leading dot if one exists when creating/deleting events.

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Acked-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Michael Ellerman
    Cc: Srikar Dronamraju
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/db680f7cb11c4452b632f908e67151f3aa0f4602.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • The YYLTYPE_IS_TRIVIAL is defined in the Build file, but unlike
    pmu-bison.c, gcc complained about it for parse-events-bison.c:

    CC util/parse-events-bison.o
    In file included from util/parse-events.y:16:
    util/parse-events-bison.h:101:1: error: "YYLTYPE_IS_TRIVIAL" redefined
    : error: this is the location of the previous definition
    make[3]: *** [util/parse-events-bison.o] Error 1

    Comments from Jiri Olsa:

    "Reason is the parse error handling that was added just recently: it
    adds YYLTYPE type (which is not present in pmu-bison.h), so
    YYLTYPE_IS_TRIVIAL gets redefined, which is ok in F20 that handle the
    error via '-w' option, but it's not ok for RHEL6 where the '-w' does not
    work for this kind of error."

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1430322871-18107-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Add a debug message to indicate that the build id didn't match.

    Signed-off-by: Naveen N. Rao
    Link: http://lkml.kernel.org/r/1429904686-16516-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • Add support for decoding an AUX area assuming it contains instruction
    tracing data.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1429903807-20559-4-git-send-email-adrian.hunter@intel.com
    [ Do not use -Z as an alternative to --itrace ]
    [ Fixed initialization of itrace_synth_opts struct fields on older gcc versions ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • If a file contains AUX area tracing data then always allow fields 'addr'
    and 'cpu' to be selected as options for perf script. This is necessary
    because AUX area decoding may synthesize events with that information.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1429903807-20559-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Reference counting of the mmap buffer does not work correctly when there
    is an AUX area mmap also.

    In snapshot mode it is not easy to know if the AUX area mmap buffer
    contains usefull information. Equally the evlist does not know if the
    recording is in sanpshot mode anyway.

    Consequently, for now just assume the AUX area mmap always has data,
    which will just cause the mmap buffer to remain mmapped for the duration
    of the recording.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1429903807-20559-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • On powerpc ABIv2, if no debug-info is found and we use kallsyms, we need
    to fixup the function entry to point to the local entry point. Use
    offset of 8 since current toolchains always generate 2 instructions (8
    bytes).

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/92253021e77a104b23b615c8c23bf9501dfe60bf.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • Use symbol table lookups by default if DWARF is not necessary, since
    powerpc ABIv2 encodes local entry points in the symbol table and the
    function entry address in DWARF may not be appropriate for kprobes, as
    described here:

    https://sourceware.org/bugzilla/show_bug.cgi?id=17638

    "The DWARF address ranges deliberately include the *whole* function,
    both global and local entry points."
    ...
    "If you want to set probes on a local entry point, you should look up
    the symbol in the main symbol table (not DWARF), and check the st_other
    bits; they will indicate whether the function has a local entry point,
    and what its offset from the global entry point is. Note that GDB does
    the same when setting a breakpoint on a function entry."

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/88a10e22f4aaba2aef812824ca4b10d7beeea012.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • ppc64 ELF ABIv2 has a Global Entry Point (GEP) and a Local Entry Point
    (LEP). For purposes of probing, we need the LEP - the offset to which is
    encoded in st_other.

    Signed-off-by: Ananth N Mavinakayanahalli
    Reviewed-by: Srikar Dronamraju
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/ab9cc5e2b9de4cbaaf50f6ef2346a6a81100bad1.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Naveen N. Rao
    Signed-off-by: Arnaldo Carvalho de Melo

    Ananth N Mavinakayanahalli
     
  • Allow perf probe to work on ppc ABIv1 without the need to specify the
    leading dot '.' for functions. 'perf probe do_fork' works with this
    patch.

    We do this by changing how symbol name comparison works on ppc ABIv1 -
    we simply ignore and skip over the initial dot, if one exists, during
    symbol name comparison.

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/652a8f3bfa919bd02a1836a128370eaed59b4a34.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • Use the proper prefix when ignoring SyS symbols on ppc ABIv1. While at
    it, generalize symbol selection so architectures can implement their own
    logic.

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/adf1f98b121ecaf292777fe5cc69fe1038feabce.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • If using the symbol table, symbol addresses are not being fixed up
    properly, resulting in probes being placed at wrong addresses:

    # perf probe do_fork
    Added new event:
    probe:do_fork (on do_fork)

    You can now use it in all perf tools, such as:

    perf record -e probe:do_fork -aR sleep 1

    # cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_fork _text+635952
    # printf "%x" 635952
    9b430
    # grep do_fork /boot/System.map
    c0000000000ab430 T .do_fork

    Fix by checking for ELF type ET_DYN used by ppc64 kernels.

    Signed-off-by: Naveen N. Rao
    Reviewed-by: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Michael Ellerman
    Cc: Sukadev Bhattiprolu
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/41392bb856ef62d929995e0b61967689b7915207.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naveen N. Rao
     
  • In verbose mode perf bench numa shows also GB/s speed, system and user cpu
    time for each particular thread. Using of getrusage() can provide much more
    per process or per thread stats in future.

    Signed-off-by: Petr Holasek
    Reviewed-by: Ingo Molnar
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1429198699-25039-3-git-send-email-pholasek@redhat.com
    [ Rename 'usage' variable to not shadow util.h's usage() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Petr Holasek
     
  • Parsing /proc/cpuinfo is a fiddly, arch-dependent business and a recent
    change to get it working for Sparc broke arm and arm64 platforms.

    Use sysconf to determine the number of online CPUs only parsing
    /proc/cpuinfo when sysconf is not available.

    Signed-off-by: Will Deacon
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20150423140454.GJ1652@arm.com
    [ Made it fall back to parsing /proc when getconf not found ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Will Deacon
     

29 Apr, 2015

19 commits

  • As the --children option changes the output of perf report (and perf
    top) it sometimes confuses users. Add more words and examples to help
    understanding of the option's behavior - and how to disable it ;-).

    Signed-off-by: Namhyung Kim
    Reviewed-by: Ingo Molnar
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Taeung Song
    Link: http://lkml.kernel.org/r/1429684425-14987-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Separating metrics values for exclude_idle bit.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1428441919-23099-7-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Separating metrics values for guest and host, so we get proper values.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1428441919-23099-6-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Separating metrics values for exclude_hv bit.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1428441919-23099-5-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Changing metrics context calculation to allow more than 2 types of
    context.

    Following patches will add support for the rest of the exclude_* bits so
    we need separate array element for all context combinations.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1428441919-23099-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Currently in perf IPC and other metrics cannot be directly shown
    separately for both user and kernel in a single run. The problem was
    that the metrics matching code did not check event qualifiers.

    With this patch the following case works correctly.

    % perf stat -e cycles:k,cycles:u,instructions:k,instructions:u true

    Performance counter stats for 'true':

    531,718 cycles:k
    203,895 cycles:u
    338,151 instructions:k # 0.64 insns per cycle
    105,961 instructions:u # 0.52 insns per cycle

    0.002989739 seconds time elapsed

    Previously it would misreport the ratios because they were matching the
    wrong value.

    The patch is fairly big, but quite mechanic as it just adds context
    indexes everywhere.

    Reported-by: William Cohen
    Signed-off-by: Andi Kleen
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: William Cohen
    Link: http://lkml.kernel.org/r/1428441919-23099-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Jiri Olsa
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • This comes from the desire of having -e/--expr to have the same meaning
    as for 'strace', while other perf tools use it for --event, which
    'trace' honours, i.e. all perf tools have --event in common, but trace
    uses -e for strace's --expr.

    Clarify it in the --help output.

    Reported-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-5j94bcsdmcbeu2xthnzsj60d@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Cut't'paste error, fix it.

    Reported-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-26abqh0wg9dci3fqcppyrpxy@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Fix perf-probe --del option to delete all matched probes in both
    of kprobes and uprobes at once.

    When we have 2 or more events on different binaries as below,

    ----
    # ./perf probe -l
    probe:vfs_read (on vfs_read@ksrc/linux-3/fs/read_write.c)
    probe_libc:malloc (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17
    ----

    Trying to remove all event with '*' just removes kprobe events at first.
    ----
    # ./perf probe -d \*
    Removed event: probe:vfs_read
    ----

    And in 2nd try, it removes all uprobe events.
    ----
    # ./perf probe -d \*
    Removed event: probe_libc:malloc
    ----

    This fixes to remove all event at once as below.
    ----
    # ./perf probe -d \*
    Removed event: probe:vfs_read
    Removed event: probe_libc:malloc
    ----

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150423134614.26128.18106.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • The --funcs option should be given exclusively. This adds
    PARSE_OPT_EXCUSIVE flag on --funcs (-F) option.

    Without this, 'perf probe --funcs -l' just shows the list of probes.

    With this, it shows error message correctly.

    This also fixes the help message and the documentation.

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150423134612.26128.58189.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Allowing symbolic events processing to report back error.

    $ perf record -e 'cycles/period=krava/' ls
    event syntax error: '../period=krava/'
    \___ expected numeric value

    $ perf record -e 'cycles/name=1/' ls
    event syntax error: '..es/name=1/'
    \___ expected string value

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-10-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Allowing tracepoint events processing to report back error.

    $ perf record -e 'sched:krava' ls
    event syntax error: 'sched:krava'
    \___ unknown tracepoint
    ...

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-9-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Allowing static terms like 'name,period,config,config1..' processing to
    report back error.

    $ perf record -e 'cpu/event=1,name=1/' ls
    event syntax error: '..=1,name=1/'
    \___ expected string value

    $ perf record -e 'cpu/event=1,period=krava/' ls
    event syntax error: '..,period=krava/'
    \___ expected numeric value

    $ perf record -e 'cpu/config=krava1/' ls
    event syntax error: '../config=krava1/'
    \___ expected numeric value

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-8-git-send-email-jolsa@kernel.org
    [ Renamed 'error' variables to 'err', not to clash with util.h error() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Allowing event's term processing to report back error, like:

    $ perf record -e 'cpu/even=0x1/' ls
    event syntax error: 'cpu/even=0x1/'
    \___ unknown term

    valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name,period,branch_type

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-7-git-send-email-jolsa@kernel.org
    [ Renamed 'error' variables to 'err', not to clash with util.h error() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Saving the terms location within term struct, so it could be used later
    for report.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-6-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Changing parse_events_add_pmu interface to allow propagating of the
    parse_events_error info.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-5-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Not sure why we allowed the fail state, but it's wrong. Wrong type for
    'name' term can cause segfault, and there's probably more fun hidden.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-4-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Allowing flex parser to report back event parsing error, like:

    $ perf record -e cycles,cache-mises ls
    event syntax error: '..es,cache-mises'
    \___ parser error
    ...

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding support to return error information from parse_events function.
    Following struct will be populated by parse_events function on return:

    struct parse_events_error {
    int idx;
    char *str;
    char *help;
    };

    where 'idx' is the position in the string where the parsing failed,
    'str' contains dynamically allocated error string describing the error
    and 'help' is optional help string.

    The change contains reporting function, which currently does not display
    anything. The code changes to supply error data for specific event types
    are coming in next patches. However this is what the expected output is:

    $ sudo perf record -e 'sched:krava' ls
    event syntax error: 'sched:krava'
    \___ unknown tracepoint
    ...

    $ perf record -e 'cpu/even=0x1/' ls
    event syntax error: 'cpu/even=0x1/'
    \___ unknown term

    valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name,period,branch_type
    ...

    $ perf record -e cycles,cache-mises ls
    event syntax error: '..es,cache-mises'
    \___ parser error
    ...

    The output functions cut the beginning of the event string so the error
    starts up to 10th character and cut the end of the string of it crosses
    the terminal width.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1429729824-13932-2-git-send-email-jolsa@kernel.org
    [ Renamed 'error' variables to 'err', not to clash with util.h error() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa