Skip to contentSkip to conversation

perf/x86: Fix exclusion of BTS and LBR for Goldmont

PATCH In review Andi Kleen 2 participants 3 messages Dec 2, 2016 – Dec 6, 2016

Subsystems (3)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf/x86: Fix exclusion of BTS and LBR for Goldmont

From: Andi Kleen <[email protected]>

The earlier patch ccbebba4 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.

Marking for stable because this allows crashing kernels. Also should be merged for 4.9.

Fixes ccbebba4 ("erf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
---
 arch/x86/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/core.c +2 -2
index d0efb5cb1b00..baa1eed55e88 100644
@@ -364,7 +364,7 @@ int x86_add_exclusive(unsigned int what)
 {
 	int i;
 
-	if (x86_pmu.lbr_pt_coexist)
+	if (what == x86_lbr_exclusive_pt && x86_pmu.lbr_pt_coexist)
 		return 0;
 
 	if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
@@ -387,7 +387,7 @@ fail_unlock:
 
 void x86_del_exclusive(unsigned int what)
 {
-	if (x86_pmu.lbr_pt_coexist)
+	if (what == x86_lbr_exclusive_pt && x86_pmu.lbr_pt_coexist)
 		return;
 
 	atomic_dec(&x86_pmu.lbr_exclusive[what]);
Signature · 1 line
2.9.3
maintainer
#1 lore raw

For some reason this patch never hit my inbox, it could be because you're wrecked the Cc line and either infradead or my mta dropped the email because of that.

Quoted 3 lines · Andi Kleen

From: Andi Kleen <[email protected]>

The earlier patch ccbebba4 allowed enabling PT and LBR at the same

SHAs should be 12 chars.

Quoted 8 lines

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.

Marking for stable because this allows crashing kernels. Also should be merged for 4.9.

Fixes ccbebba4 ("erf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")

same

Quoted 13 lines
---
 arch/x86/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/core.c +0 -0
index d0efb5cb1b00..baa1eed55e88 100644

arch/x86/events/core.c int x86_add_exclusive(unsigned int what) · line 368

Quoted 6 lines
arch/x86/events/core.c +1 -1
@@ -364,7 +364,7 @@ int x86_add_exclusive(unsigned int what)
 {
 	int i;
 
-	if (x86_pmu.lbr_pt_coexist)
+	if (what == x86_lbr_exclusive_pt && x86_pmu.lbr_pt_coexist)
 		return 0;

This would also allow PT & BTS at the same time, is that a supported configuration?

Quoted 2 lines
arch/x86/events/core.c +0 -0
 	if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
author
#2 lore raw
Quoted 6 lines

arch/x86/events/core.c int x86_add_exclusive(unsigned int what) · line 368

Quoted 3 lines
arch/x86/events/core.c +1 -1
-	if (x86_pmu.lbr_pt_coexist)
+	if (what == x86_lbr_exclusive_pt && x86_pmu.lbr_pt_coexist)
 		return 0;

This would also allow PT & BTS at the same time, is that a supported configuration?

Yes it is on Goldmont.

-Andi