From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812AbbEHLTr (ORCPT ); Fri, 8 May 2015 07:19:47 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:49760 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbbEHLTo (ORCPT ); Fri, 8 May 2015 07:19:44 -0400 Date: Fri, 8 May 2015 13:19:18 +0200 From: Peter Zijlstra To: Andi Kleen Cc: kan.liang@intel.com, eranian@google.com, acme@infradead.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 8/9] perf, x86: Optimize v4 LBR unfreezing Message-ID: <20150508111918.GE27504@twins.programming.kicks-ass.net> References: <1431039392-12589-1-git-send-email-andi@firstfloor.org> <1431039392-12589-9-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431039392-12589-9-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 07, 2015 at 03:56:31PM -0700, Andi Kleen wrote: > From: Andi Kleen > > In Arch perfmon v4 the GLOBAL_STATUS reset automatically unfreezes > LBRs. So no need to do it manually in the LBR code. Add a check > to skip it. > > Signed-off-by: Andi Kleen > --- > arch/x86/kernel/cpu/perf_event_intel_lbr.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c > index 6c48c97..64d3122 100644 > --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c > +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c > @@ -147,6 +147,13 @@ static void __intel_pmu_lbr_enable(bool pmi) > wrmsrl(MSR_LBR_SELECT, lbr_select); > } > > + /* > + * No need to unfreeze manually, as v4 can do that as part > + * of the GLOBAL_STATUS ack. > + */ > + if (pmi && x86_pmu.version >= 4) > + return; > + But that block above is !pmi, so strictly exclusive with this condition. So why not put this at the start? > rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl); > orig_debugctl = debugctl; > debugctl |= DEBUGCTLMSR_LBR;