Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752122Ab2HTKKZ (ORCPT ); Mon, 20 Aug 2012 06:10:25 -0400 Received: from merlin.infradead.org ([205.233.59.134]:35868 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357Ab2HTKKV convert rfc822-to-8bit (ORCPT ); Mon, 20 Aug 2012 06:10:21 -0400 Message-ID: <1345457400.23018.28.camel@twins> Subject: Re: [PATCH 1/2] pebs, x86: Make sure to really disable PEBS From: Peter Zijlstra To: Andi Kleen Cc: mingo@elte.hu, linux-kernel@vger.kernel.org, Andi Kleen Date: Mon, 20 Aug 2012 12:10:00 +0200 In-Reply-To: <1345306530-25665-1-git-send-email-andi@firstfloor.org> References: <1345306530-25665-1-git-send-email-andi@firstfloor.org> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1350 Lines: 37 On Sat, 2012-08-18 at 09:15 -0700, Andi Kleen wrote: > From: Andi Kleen > > When disabling a PEBS event we need to check the old value > to determine if PEBS was running. Otherwise the last PEBS value > could be kept running. > > Signed-off-by: Andi Kleen > --- > arch/x86/kernel/cpu/perf_event_intel_ds.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c > index e38d97b..db49ab3 100644 > --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c > +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c > @@ -438,9 +438,10 @@ void intel_pmu_pebs_disable(struct perf_event *event) > { > struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); > struct hw_perf_event *hwc = &event->hw; > + u64 old = cpuc->pebs_enabled; > > cpuc->pebs_enabled &= ~(1ULL << hwc->idx); > - if (cpuc->enabled) > + if (old) cpuc->enabled != cpuc->pebs_enabled > wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled); > > hwc->config |= ARCH_PERFMON_EVENTSEL_INT; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/