linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86: Fix exclusion of BTS and LBR for Goldmont
@ 2016-12-09  0:14 Andi Kleen
  2016-12-09 15:49 ` Peter Zijlstra
  2016-12-12  6:49 ` [tip:perf/core] " tip-bot for Andi Kleen
  0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2016-12-09  0:14 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, Andi Kleen, alexander.shishkin, kan.liang, stable

From: Andi Kleen <ak@linux.intel.com>

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.

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

Fixes: ccbebba4c6bf ("erf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
Cc: alexander.shishkin@intel.com
Cc: kan.liang@intel.com
Cc: <stable@vger.kernel.org>
v2: Paint bike shed differently.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d0efb5cb1b00..baa1eed55e88 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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]);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] perf/x86: Fix exclusion of BTS and LBR for Goldmont
@ 2016-12-02 23:17 Andi Kleen
  2016-12-06 12:38 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Andi Kleen @ 2016-12-02 23:17 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, Andi Kleen, alexander.shishkin, kan.liang, stable

From: Andi Kleen <ak@linux.intel.com>

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")
Cc: alexander.shishkin@intel.com
Cc: kan.liang@intel.com
Cc: stable@vger.kernel.org # 4.6+
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d0efb5cb1b00..baa1eed55e88 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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]);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-12  6:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09  0:14 [PATCH] perf/x86: Fix exclusion of BTS and LBR for Goldmont Andi Kleen
2016-12-09 15:49 ` Peter Zijlstra
2016-12-12  6:49 ` [tip:perf/core] " tip-bot for Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2016-12-02 23:17 [PATCH] " Andi Kleen
2016-12-06 12:38 ` Peter Zijlstra
2016-12-06 14:53   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).