Skip to content

fix MSR_LAST_BRANCH_FROM Haswell support

David Carrillo-Cisneros lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 2 repliesIn review
  2. v13 patches 13 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5perf/x86/intel: output LBR support statement after validationarch/x86/events/intel/core.c arch/x86/events/intel/lbr.c+2 -90 replies
2/5perf/x86/intel: fix for MSR_LAST_BRANCH_FROM_x bug when no TSXarch/x86/events/intel/core.c arch/x86/events/intel/lbr.c arch/x86/events/perf_event.h+69 -01 reply
3/5perf/x86/intel: trivial format and style fixarch/x86/events/intel/lbr.c+3 -30 replies
4/5perf/x86/intel: MSR_LAST_BRANCH_FROM_x quirk for ctx switcharch/x86/events/intel/lbr.c+22 -31 reply
5/5not required, used to test ctxsw, do not mergearch/x86/events/intel/lbr.c tools/perf/util/evsel.c+16 -40 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchStephane EranianAndi Kleen
1/5R-b
2/5R-b R-b
3/5R-b
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v02 0/5] fix MSR_LAST_BRANCH_FROM Haswell support

commit 338b522ca43c ("perf/x86/intel: Protect LBR and extra_regs against KVM lying")
introduced an extra test for LBR support but did not move the dmesg accordingly. This problem is fixed in first patch in this series.

When a machine that used LBR is rebooted using kexec, the extra test for LBR support may fail due to a hw bug/quirk in Haswell that generates a #GPF when restoring a value of MSR_LAST_BRANCH_FROM_* msrs that has sign extension (e.g. kernel addresses). This hw bug/quirk currently does not manifest in the context switch of LBR callstack mode because of a workaround for another LBR bug (bug in FREEZE_LBRS_ON_PMI, more details in second patch of this series). The workaround deactivates LBR callstack in kernel mode.

The second and fourth patches in this series contain workarounds for the MSR_LAST_BRANCH_FROM_* hw bug/quirk.

The third patch contains a trivial format fix for aesthetic uniformity.

The last patch is not to be committed, but to test the fourth patch. It removes the effect of the FREEZE_LBRS_ON_PMI work-around by allowing LBR callstack for kernel addresses.

This series is rebased at torvalds/linux/master .

Changes in 2nd version:
- Remove branch from quirk (as pointed by Peter Z.).
- Format fixes.

David Carrillo-Cisneros (5):
perf/x86/intel: output LBR support statement after validation perf/x86/intel: fix for MSR_LAST_BRANCH_FROM_x bug when no TSX perf/x86/intel: trivial format and style fix perf/x86/intel: MSR_LAST_BRANCH_FROM_x quirk for ctx switch not required, used to test ctxsw, do not merge

 arch/x86/events/intel/core.c | 20 ++++++++++
 arch/x86/events/intel/lbr.c  | 90 ++++++++++++++++++++++++++++++++++++--------
 arch/x86/events/perf_event.h |  2 +
 tools/perf/util/evsel.c      | 17 +++++++--
 4 files changed, 111 insertions(+), 18 deletions(-)
Signature · 1 line
2.8.0.rc3.226.g39d4020