perf/x86/intel: Output LBR TOS information correctly
authorKan Liang <kan.liang@linux.intel.com>
Mon, 27 Jan 2020 16:53:55 +0000 (08:53 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Feb 2020 12:23:49 +0000 (13:23 +0100)
commitdb278b90c326ce5895be09b6171f5ff3df1e3cca
treebcba3effee570cd0ae27a25a0e66f288bd4bae89
parentbbfd5e4fab63703375eafaf241a0c696024a59e1
perf/x86/intel: Output LBR TOS information correctly

For Intel LBR, the LBR Top-of-Stack (TOS) information is the HW index of
raw branch record for the most recent branch.

For non-adaptive PEBS and non-PEBS, the TOS information can be directly
retrieved from TOS MSR read in intel_pmu_lbr_read().

For adaptive PEBS, the LBR information stored in PEBS record doesn't
include the TOS information. For single PEBS, TOS can be directly read
from MSR, because the PMI is triggered immediately after PEBS is
written. TOS MSR is still unchanged.
For large PEBS, TOS MSR has stale value. Set -1ULL to indicate that the
TOS information is not available.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20200127165355.27495-3-kan.liang@linux.intel.com
arch/x86/events/intel/lbr.c