linux_dsm_epyc7002/tools/perf/util/intel-pt-decoder
Andi Kleen 61f611593f perf script: Fix LBR skid dump problems in brstackinsn
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: Andi Kleen <ak@linux.intel.com>
Acked-by: Adrian 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 dd2e18e9ac ("perf tools: Support 'srccode' output") ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-12-28 16:33:02 -03:00
..
Build perf intel-pt: Improve build messages for files that differ from the kernel 2017-11-29 18:18:02 -03:00
gen-insn-attr-x86.awk License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
inat_types.h perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
inat.c perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
inat.h perf intel-pt: Bring instruction decoder files into line with the kernel 2017-11-28 14:28:49 -03:00
insn.c perf tools: Add AVX-512 support to the instruction decoder used by Intel PT 2016-07-21 09:37:18 -03:00
insn.h perf tools intel-pt-decoder: Update insn.h from the kernel sources 2018-06-01 16:13:18 -03:00
intel-pt-decoder.c perf intel-pt: Add MTC and CYC timestamps to debug log 2018-11-05 14:53:54 -03:00
intel-pt-decoder.h perf intel-pt: Add decoder flags for trace begin / end 2018-09-20 15:19:51 -03:00
intel-pt-insn-decoder.c perf script: Fix LBR skid dump problems in brstackinsn 2018-12-28 16:33:02 -03:00
intel-pt-insn-decoder.h perf intel-pt/bts: Tidy instruction buffer size usage 2016-10-24 10:31:32 -03:00
intel-pt-log.c perf intel-pt: Add more event information to debug log 2018-11-05 14:53:37 -03:00
intel-pt-log.h perf intel-pt: Add more event information to debug log 2018-11-05 14:53:37 -03:00
intel-pt-pkt-decoder.c perf intel-pt: Fix packet decoding of CYC packets 2018-06-25 11:59:36 -03:00
intel-pt-pkt-decoder.h perf intel-pt: Add decoder support for ptwrite and power event packets 2017-06-21 11:35:50 -03:00
x86-opcode-map.txt x86/decoder: Fix and update the opcodes map 2017-12-15 13:45:20 +01:00