20 Apr, 2017

25 commits


13 Apr, 2017

6 commits

  • In https://lkml.org/lkml/2017/2/2/16 I reported a build error that I
    believed was caused by wrong uapi includes. The synthom was fixed by
    Arnaldo in:

    commit 2f7db5557994 ("perf tools: Fix include of linux/mman.h")

    but I was wrong attributing the problem to the uapi include.

    The root cause was that I was using ARCH=x86_64, hence using the wrong
    uapi include path. This explains why no one else ran into this build
    problem.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412064919.92449-8-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • Besides memory allocation failure, tips.txt may fail to load because the
    file is not found (a more likely cause).

    Communicate that to the user in tips failure warning.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412064919.92449-5-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • This change is a follow up of https://lkml.org/lkml/2017/2/2/16

    The patch above avoided redefining CC, CXX and PKG_CONFIG in feature
    detection. The patch was not merged due to a unsolved concern with the
    -MD flag.

    Later, commit c8c188679ccf ("tools build: Use the same CC for feature
    detection and actual build") did the change for CC and CXX but not
    PKG_CONFIG.

    This patch makes PKG_CONFIG consistent with CC and CXX and moves the -MD
    to CFLAGS, as suggested by Jiri in the thread above.

    Signed-off-by: David Carrillo-Cisneros
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412064919.92449-3-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf
    check this dependendancy and notify user when not present.

    v2: Comma nitpicking.

    Signed-off-by: David Carrillo-Cisneros
    Tested-by: Kim Phillips
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412170745.26620-1-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • perf trace supports --no-syscalls option but it's not listed in the man
    page. (Though, I see an example using --no-syscalls in EXAMPLES
    section.)

    Committer note:

    The --no-syscalls option tells 'perf trace' not to automagically ask for
    raw_syscalls:sys_{enter,exit} to then format it in a strace like way.

    This become more used as 'perf trace' got support for arbitrary events,
    such as tracepoints, so more and more we use:

    # perf trace --no-syscalls -e nmi:*
    0.000 nmi:nmi_handler:perf_event_nmi_handler() delta_ns: 36649 handled: 1)
    0.019 nmi:nmi_handler:nmi_cpu_backtrace_handler() delta_ns: 2907 handled: 0)
    0.676 nmi:nmi_handler:perf_event_nmi_handler() delta_ns: 9401 handled: 1)
    0.680 nmi:nmi_handler:nmi_cpu_backtrace_handler() delta_ns: 288 handled: 0)
    0.701 nmi:nmi_handler:perf_event_nmi_handler() delta_ns: 4977 handled: 1)
    0.703 nmi:nmi_handler:nmi_cpu_backtrace_handler() delta_ns: 67 handled: 0)
    0.736 nmi:nmi_handler:perf_event_nmi_handler() delta_ns: 8549 handled: 1)
    ^C#

    Signed-off-by: Ravi Bangoria
    Cc: Alexander Shishkin
    Cc: Alexis Berlemont
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1492063332-5745-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • (This is a patch has been sitting in the Intel CQM/CMT driver series for
    a while, despite not depend on it. Sending it now independently since
    the series is being discarded.)

    When an event is in error state, read() returns 0 instead of sizeof()
    buffer. In certain modes, such as interval printing, ignoring the 0
    return value may cause bogus count deltas to be computed and thus
    invalid results printed.

    This patch fixes this problem by modifying read_counters() to mark the
    event as not scaled (scaled = -1) to force the printout routine to show
    .

    Signed-off-by: Stephane Eranian
    Reviewed-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Mathieu Poirier
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412182301.44406-1-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     

12 Apr, 2017

9 commits

  • ( This is a rebased version of https://lkml.org/lkml/2017/2/7/662 )

    Python's CC and link Makefile variables were not passed to feature
    detection, causing feature detection to use system's Python rather than
    PYTHON_CONFIG's one. This created a mismatch between the detected Python
    support and the one actually used by perf when PYTHON_CONFIG is
    specified.

    Fix it by moving Python's variable initialization to before feature
    detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
    build target.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170412064919.92449-2-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • When parsing disassemble lines for source line number, use a stripped
    line instead of raw line.

    Signed-off-by: Taeung Song
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1491612748-1605-3-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     
  • When parsing disassemble lines, use ltrim() and rtrim() to strip them,
    not using just while loop and isspace().

    Signed-off-by: Taeung Song
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1491612748-1605-2-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     
  • Pipe-mode has no perf.data header, hence no upfront knowledge of presend
    and missing features, hence, do not print missing features in pipe-mode.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170410201432.24807-8-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • Session sets a number parameters that rely on evlist. These parameters
    are not used in pipe-mode and should not be set, since evlist is
    unavailable. Fix that.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170410201432.24807-6-davidcc@google.com
    [ Check if file != NULL in perf_session__new(), like when used by builtin-top.c ]
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • perf annotate did not get some love for pipe-mode, and did not have
    .attr and .buil_id setup (while record and inject did. Fix that.

    It can easily be reproduced by:

    perf record -o - noploop | perf annotate

    that in my system shows:
    0xd8 [0x28]: failed to process type: 9

    Committer Testing:

    Before:

    $ perf record -o - stress -t 2 -c 2 | perf annotate --stdio
    stress: info: [11060] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
    0x4470 [0x28]: failed to process type: 9
    $ stress: info: [11060] successful run completed in 2s

    $

    After:

    $ perf record -o - stress -t 2 -c 2 | perf annotate --stdio
    stress: info: [11871] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
    stress: info: [11871] successful run completed in 2s
    [ perf record: Woken up 2 times to write data ]
    [ perf record: Captured and wrote 0.000 MB - ]
    no symbols found in /usr/bin/stress, maybe install a debug package?
    Percent | Source code & Disassembly of libc-2.24.so for cycles:uhH (6117 samples)
    ---------------------------------------------------------------------------------------
    :
    : Disassembly of section .text:
    :
    : 000000000003b050 :
    : __random_r():
    10.56 : 3b050: test %rdi,%rdi
    0.00 : 3b053: je 3b0d0
    0.34 : 3b055: test %rsi,%rsi
    0.00 : 3b058: je 3b0d0
    0.46 : 3b05a: mov 0x18(%rdi),%eax
    12.44 : 3b05d: mov 0x10(%rdi),%r8
    0.18 : 3b061: test %eax,%eax
    0.00 : 3b063: je 3b0b0

    Signed-off-by: David Carrillo-Cisneros
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170410201432.24807-5-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • Add a minimal description of pipe's data format.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170410201432.24807-4-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • __perf_session__process_pipe_events reuses the same memory buffer to
    process all events in the pipe.

    When reordering is needed (e.g. -b option), events are not immediately
    flushed, but kept around until reordering is possible, causing
    memory corruption.

    The problem is usually observed by a "Unknown sample error" output. It
    can easily be reproduced by:

    perf record -o - noploop | perf inject -b > output

    Committer testing:

    Before:

    $ perf record -o - stress -t 2 -c 2 | perf inject -b > /dev/null
    stress: info: [8297] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
    stress: info: [8297] successful run completed in 2s
    [ perf record: Woken up 3 times to write data ]
    [ perf record: Captured and wrote 0.000 MB - ]
    Warning:
    Found 1 unknown events!

    Is this an older tool processing a perf.data file generated by a more recent tool?

    If that is not the case, consider reporting to linux-kernel@vger.kernel.org.

    $

    After:

    $ perf record -o - stress -t 2 -c 2 | perf inject -b > /dev/null
    stress: info: [9027] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
    stress: info: [9027] successful run completed in 2s
    [ perf record: Woken up 3 times to write data ]
    [ perf record: Captured and wrote 0.000 MB - ]
    no symbols found in /usr/bin/stress, maybe install a debug package?
    no symbols found in /usr/bin/stress, maybe install a debug package?
    $

    Signed-off-by: David Carrillo-Cisneros
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20170410201432.24807-3-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros
     
  • All paths following perf_session__process_event() in __cmd_inject() are
    useless if __cmd_inject() is to fail, some depend on a correct
    session->evlist.

    First commit to add code that depends on session->evlist without checking
    error was commmit e558a5bd8b ("perf inject: Work with files"). It has
    grown since then.

    Change __cmd_inject() to fail immediately after
    perf_session__process_event() fails.

    Signed-off-by: David Carrillo-Cisneros
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Andrew Vagin
    Cc: He Kuang
    Cc: Masami Hiramatsu
    Cc: Paul Turner
    Cc: Peter Zijlstra
    Cc: Simon Que
    Cc: Stephane Eranian
    Cc: Wang Nan
    Fixes: e558a5bd8b74 ("perf inject: Work with files")
    Link: http://lkml.kernel.org/r/20170410201432.24807-2-davidcc@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Carrillo-Cisneros