mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Andi Kleen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, ak@linux.intel.com,
	linux-kernel@vger.kernel.org, hpa@zytor.com,
	peterz@infradead.org, tglx@linutronix.de
Subject: [tip:perf/core] perf/x86/intel: Reset more state in PMU reset
Date: Thu, 2 Apr 2015 11:45:06 -0700	[thread overview]
Message-ID: <tip-8882edf735738c949aba4b65d3ec3453066bab12@git.kernel.org> (raw)
In-Reply-To: <1425059312-18217-2-git-send-email-andi@firstfloor.org>

Commit-ID:  8882edf735738c949aba4b65d3ec3453066bab12
Gitweb:     http://git.kernel.org/tip/8882edf735738c949aba4b65d3ec3453066bab12
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Fri, 27 Feb 2015 09:48:30 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 2 Apr 2015 17:33:16 +0200

perf/x86/intel: Reset more state in PMU reset

The PMU reset code didn't quite keep up with newer PMU features.
Improve it a bit to really reset a modern PMU:

  - Clear all overflow status
  - Clear LBRs and freezing state
  - Disable fixed counters too

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: eranian@google.com
Link: http://lkml.kernel.org/r/1425059312-18217-2-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/perf_event_intel.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 6ea61a5..5999460 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1538,6 +1538,18 @@ static void intel_pmu_reset(void)
 	if (ds)
 		ds->bts_index = ds->bts_buffer_base;
 
+	/* Ack all overflows and disable fixed counters */
+	if (x86_pmu.version >= 2) {
+		intel_pmu_ack_status(intel_pmu_get_status());
+		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
+	}
+
+	/* Reset LBRs and LBR freezing */
+	if (x86_pmu.lbr_nr) {
+		update_debugctlmsr(get_debugctlmsr() &
+			~(DEBUGCTLMSR_FREEZE_LBRS_ON_PMI|DEBUGCTLMSR_LBR));
+	}
+
 	local_irq_restore(flags);
 }
 

  reply	other threads:[~2015-04-02 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 17:48 House keeping for the perf PMU dump/reset code Andi Kleen
2015-02-27 17:48 ` [PATCH 1/3] perf, x86: Reset more state in PMU reset Andi Kleen
2015-04-02 18:45   ` tip-bot for Andi Kleen [this message]
2015-02-27 17:48 ` [PATCH 2/3] perf, x86: Dump DEBUGCTL in pmu dump Andi Kleen
2015-04-02 18:45   ` [tip:perf/core] perf/x86: Dump DEBUGCTL in PMU dump tip-bot for Andi Kleen
2015-02-27 17:48 ` [PATCH 3/3] perf, x86: Only dump PEBS register when PEBS has been detected Andi Kleen
2015-04-02 18:45   ` [tip:perf/core] perf/x86: " tip-bot for Andi Kleen

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-8882edf735738c949aba4b65d3ec3453066bab12@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome