20 Apr, 2017

28 commits


17 Apr, 2017

1 commit

  • …nux/kernel/git/acme/linux into perf/core

    Pull perf/core improvements and fixes Arnaldo Carvalho de Melo:

    User visible changes:

    - Fix 'perf stat' bug in handling events in error state (Stephane Eranian)

    Documentation changes:

    - Add usage of --no-syscalls in 'perf trace' man page (Ravi Bangoria)

    Infrastructure changes:

    - Pass PYTHON config to feature detection (David Carrillo-Cisneros)

    - Disable JVMTI if no ELF support available (David Carrillo-Cisneros)

    - Fix feature detection redefinion of build flags (David Carrillo-Cisneros)

    - Hint missing file when tool tips fail to load (David Carrillo-Cisneros)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

14 Apr, 2017

3 commits

  • Spurious NMIs will be observed with the following command:

    while :; do
    perf record -bae "cpu/umask=0x01,event=0xcd,ldlat=0x80/pp"
    -e "cpu/umask=0x03,event=0x0/"
    -e "cpu/umask=0x02,event=0x0/"
    -e cycles,branches,cache-misses
    -e cache-references -- sleep 10
    done

    The bug was introduced by commit:

    8077eca079a2 ("perf/x86/pebs: Add workaround for broken OVFL status on HSW+")

    That commit clears the status bits for the counters used for PEBS
    events, by masking the whole 64 bits pebs_enabled. However, only the
    low 32 bits of both status and pebs_enabled are reserved for PEBS-able
    counters.

    For status bits 32-34 are fixed counter overflow bits. For
    pebs_enabled bits 32-34 are for PEBS Load Latency.

    In the test case, the PEBS Load Latency event and fixed counter event
    could overflow at the same time. The fixed counter overflow bit will
    be cleared by mistake. Once it is cleared, the fixed counter overflow
    never be processed, which finally trigger spurious NMI.

    Correct the PEBS enabled mask by ignoring the non-PEBS bits.

    Signed-off-by: Kan Liang
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Cc: Vince Weaver
    Fixes: 8077eca079a2 ("perf/x86/pebs: Add workaround for broken OVFL status on HSW+")
    Link: http://lkml.kernel.org/r/1491333246-3965-1-git-send-email-kan.liang@intel.com
    Signed-off-by: Ingo Molnar

    Kan Liang
     
  • Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • When the perf_branch_entry::{in_tx,abort,cycles} fields were added,
    intel_pmu_lbr_read_32() wasn't updated to initialize them.

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Cc:
    Fixes: 135c5612c460 ("perf/x86/intel: Support Haswell/v4 LBR format")
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

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

2 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
     
  • Consolidate x86 instruction decoder users on the path of
    copying original code for kprobes.

    Kprobes decodes the same instruction a maximum of 3 times when
    preparing the instruction buffer:

    - The first time for getting the length of the instruction,
    - the 2nd for adjusting displacement,
    - and the 3rd for checking whether the instruction is boostable or not.

    For each time, the actual decoding target address is slightly
    different (1st is original address or recovered instruction buffer,
    2nd and 3rd are pointing to the copied buffer), but all have
    the same instruction.

    Thus, this patch also changes the target address to the copied
    buffer at first and reuses the decoded "insn" for displacement
    adjusting and checking boostability.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Andrey Ryabinin
    Cc: Anil S Keshavamurthy
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: David S . Miller
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Ye Xiaolong
    Link: http://lkml.kernel.org/r/149076389643.22469.13151892839998777373.stgit@devbox
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu