Skip to content

Commit ccbebba

Browse files
virtuosoIngo Molnar
authored andcommitted
perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it
Not all cores prevent using Intel PT and LBRs simultaneously, although most of them still do as of today. This patch adds an opt-in flag for such cores to disable mutual exclusivity between PT and LBR; also flip it on for Goldmont. Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/1461857746-31346-4-git-send-email-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar <[email protected]>
1 parent 5101ef2 commit ccbebba

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

arch/x86/events/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ int x86_add_exclusive(unsigned int what)
360360
{
361361
int i;
362362

363+
if (x86_pmu.lbr_pt_coexist)
364+
return 0;
365+
363366
if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
364367
mutex_lock(&pmc_reserve_mutex);
365368
for (i = 0; i < ARRAY_SIZE(x86_pmu.lbr_exclusive); i++) {
@@ -380,6 +383,9 @@ int x86_add_exclusive(unsigned int what)
380383

381384
void x86_del_exclusive(unsigned int what)
382385
{
386+
if (x86_pmu.lbr_pt_coexist)
387+
return;
388+
383389
atomic_dec(&x86_pmu.lbr_exclusive[what]);
384390
atomic_dec(&active_events);
385391
}

arch/x86/events/intel/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,6 +3609,7 @@ __init int intel_pmu_init(void)
36093609
*/
36103610
x86_pmu.pebs_aliases = NULL;
36113611
x86_pmu.pebs_prec_dist = true;
3612+
x86_pmu.lbr_pt_coexist = true;
36123613
x86_pmu.flags |= PMU_FL_HAS_RSP_1;
36133614
pr_cont("Goldmont events, ");
36143615
break;

arch/x86/events/perf_event.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ struct x86_pmu {
601601
u64 lbr_sel_mask; /* LBR_SELECT valid bits */
602602
const int *lbr_sel_map; /* lbr_select mappings */
603603
bool lbr_double_abort; /* duplicated lbr aborts */
604+
bool lbr_pt_coexist; /* LBR may coexist with PT */
604605

605606
/*
606607
* Intel PT/LBR/BTS are exclusive

0 commit comments

Comments
 (0)