perf/x86: Fix exclusion of BTS and LBR for Goldmont
authorAndi Kleen <[email protected]>
Fri, 9 Dec 2016 00:14:17 +0000 (16:14 -0800)
committerIngo Molnar <[email protected]>
Sun, 11 Dec 2016 12:06:09 +0000 (13:06 +0100)
An earlier patch allowed enabling PT and LBR at the same
time on Goldmont. However it also allowed enabling BTS and LBR
at the same time, which is still not supported. Fix this by
bypassing the check only for PT.

Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: <[email protected]>
Fixes: ccbebba4c6bf ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/events/core.c
arch/x86/events/perf_event.h

index 6e395c9969002839fc0fd1e94f95fe0ba77abe0b..7fe88bb57e366cbae38a68307e094b3c48ed2e65 100644 (file)
@@ -365,7 +365,11 @@ int x86_add_exclusive(unsigned int what)
 {
        int i;
 
-       if (x86_pmu.lbr_pt_coexist)
+       /*
+        * When lbr_pt_coexist we allow PT to coexist with either LBR or BTS.
+        * LBR and BTS are still mutually exclusive.
+        */
+       if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt)
                return 0;
 
        if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
@@ -388,7 +392,7 @@ fail_unlock:
 
 void x86_del_exclusive(unsigned int what)
 {
-       if (x86_pmu.lbr_pt_coexist)
+       if (x86_pmu.lbr_pt_coexist && what == x86_lbr_exclusive_pt)
                return;
 
        atomic_dec(&x86_pmu.lbr_exclusive[what]);
index a77ee026643d23fac4808a1f1c32ca42e4999769..bcbb1d2ae10b21c2346c725d0f2ea74b0b641326 100644 (file)
@@ -604,7 +604,7 @@ struct x86_pmu {
        u64             lbr_sel_mask;              /* LBR_SELECT valid bits */
        const int       *lbr_sel_map;              /* lbr_select mappings */
        bool            lbr_double_abort;          /* duplicated lbr aborts */
-       bool            lbr_pt_coexist;            /* LBR may coexist with PT */
+       bool            lbr_pt_coexist;            /* (LBR|BTS) may coexist with PT */
 
        /*
         * Intel PT/LBR/BTS are exclusive