• Andi Kleen's avatar
    perf script: Fix LBR skid dump problems in brstackinsn · 61f61159
    Andi Kleen authored
    This is a fix for another instance of the skid problem Milian recently
    found [1]
    
    The LBRs don't freeze at the exact same time as the PMI is triggered.
    The perf script brstackinsn code that dumps LBR assembler assumes that
    the last branch in the LBR leads to the sample point.  But with skid
    it's possible that the CPU executes one or more branches before the
    sample, but which do not appear in the LBR.
    
    What happens then is either that the sample point is before the last LBR
    branch. In this case the dumper sees a negative length and ignores it.
    Or it the sample point is long after the last branch. Then the dumper
    sees a very long block and dumps it upto its block limit (16k bytes),
    which is noise in the output.
    
    On typical sample session this can happen regularly.
    
    This patch tries to detect and handle the situation. On the last block
    that is dumped by the LBR dumper we always stop on the first branch. If
    the block length is negative just scan forward to the first branch.
    Otherwise scan until a branch is found.
    
    The PT decoder already has a function that uses the instruction decoder
    to detect branches, so we can just reuse it here.
    
    Then when a terminating branch is found print an indication and stop
    dumping. This might miss a few instructions, but at least shows no
    runaway blocks.
    Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
    Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Milian Wolff <milian.wolff@kdab.com>
    Link: http://lkml.kernel.org/r/20181120050617.4119-1-andi@firstfloor.org
    [ Resolved conflict with dd2e18e9 ("perf tools: Support 'srccode' output") ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    61f61159
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.clang-format Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...