public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Alexander Shishkin <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	eranian@google.com, mathieu.poirier@linaro.org, bp@alien8.de,
	vincent.weaver@maine.edu, acme@redhat.com,
	alexander.shishkin@linux.intel.com,
	torvalds@linux-foundation.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@kernel.org, acme@infradead.org, jolsa@redhat.com
Subject: [tip:perf/core] perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it
Date: Thu, 5 May 2016 02:48:24 -0700	[thread overview]
Message-ID: <tip-ccbebba4c6bfda8e3ef9e431ce2c3d91c5fc5a63@git.kernel.org> (raw)
In-Reply-To: <1461857746-31346-4-git-send-email-alexander.shishkin@linux.intel.com>

Commit-ID:  ccbebba4c6bfda8e3ef9e431ce2c3d91c5fc5a63
Gitweb:     http://git.kernel.org/tip/ccbebba4c6bfda8e3ef9e431ce2c3d91c5fc5a63
Author:     Alexander Shishkin <alexander.shishkin@linux.intel.com>
AuthorDate: Thu, 28 Apr 2016 18:35:46 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 5 May 2016 10:16:28 +0200

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 <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: vince@deater.net
Link: http://lkml.kernel.org/r/1461857746-31346-4-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/events/core.c       | 6 ++++++
 arch/x86/events/intel/core.c | 1 +
 arch/x86/events/perf_event.h | 1 +
 3 files changed, 8 insertions(+)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 41d93d0..5e5e76a 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -360,6 +360,9 @@ int x86_add_exclusive(unsigned int what)
 {
 	int i;
 
+	if (x86_pmu.lbr_pt_coexist)
+		return 0;
+
 	if (!atomic_inc_not_zero(&x86_pmu.lbr_exclusive[what])) {
 		mutex_lock(&pmc_reserve_mutex);
 		for (i = 0; i < ARRAY_SIZE(x86_pmu.lbr_exclusive); i++) {
@@ -380,6 +383,9 @@ fail_unlock:
 
 void x86_del_exclusive(unsigned int what)
 {
+	if (x86_pmu.lbr_pt_coexist)
+		return;
+
 	atomic_dec(&x86_pmu.lbr_exclusive[what]);
 	atomic_dec(&active_events);
 }
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 90ba3ae..cd31940 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3609,6 +3609,7 @@ __init int intel_pmu_init(void)
 		 */
 		x86_pmu.pebs_aliases = NULL;
 		x86_pmu.pebs_prec_dist = true;
+		x86_pmu.lbr_pt_coexist = true;
 		x86_pmu.flags |= PMU_FL_HAS_RSP_1;
 		pr_cont("Goldmont events, ");
 		break;
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 7d62a02..8bd764d 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -601,6 +601,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 */
 
 	/*
 	 * Intel PT/LBR/BTS are exclusive

      reply	other threads:[~2016-05-05  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 15:35 [PATCH v0 0/3] perf, pt: Intel PT updates Alexander Shishkin
2016-04-28 15:35 ` [PATCH v0 1/3] perf/x86/intel/pt: Convert ACCESS_ONCE()s Alexander Shishkin
2016-05-05  9:49   ` [tip:perf/core] " tip-bot for Alexander Shishkin
2016-04-28 15:35 ` [PATCH v0 2/3] perf/x86/intel/pt: Export cpu frequency ratios needed by PT decoders Alexander Shishkin
2016-04-28 15:55   ` Alexander Shishkin
2016-05-05  9:48     ` [tip:perf/core] perf/x86/intel/pt: Export CPU " tip-bot for Alexander Shishkin
2016-05-03 13:53   ` [PATCH v0 2/3] perf/x86/intel/pt: Export cpu " Borislav Petkov
2016-04-28 15:35 ` [PATCH v0 3/3] perf, x86: Bypass PT vs LBR exclusivity if the core supports it Alexander Shishkin
2016-05-05  9:48   ` tip-bot for Alexander Shishkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-ccbebba4c6bfda8e3ef9e431ce2c3d91c5fc5a63@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.weaver@maine.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox