From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753109AbbC0MLF (ORCPT ); Fri, 27 Mar 2015 08:11:05 -0400 Received: from casper.infradead.org ([85.118.1.10]:40866 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752558AbbC0MLB (ORCPT ); Fri, 27 Mar 2015 08:11:01 -0400 Date: Fri, 27 Mar 2015 13:10:52 +0100 From: Peter Zijlstra To: Stephane Eranian Cc: "Liang, Kan" , Andi Kleen , LKML Subject: Re: [PATCH 1/1] perf/x86: filter branches for PEBS event Message-ID: <20150327121052.GD23123@twins.programming.kicks-ass.net> References: <1427393603-3533-1-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Mar 26, 2015 at 12:40:14PM -0700, Stephane Eranian wrote: > You are addressing one of the problems of this routine. But I think > there is a more serious issue which is not addressed here. The > intel_shared_regs_constraints() assumes that the associated event is > necessarily unconstrained: > > __intel_shared_reg_get_constraints() > { > struct event_constraint *c = &emptyconstraint; > ... > } emptyconstraint != unconstrained. Note how that function only returns emptyconstraint if its rejecting the event, otherwise it returns NULL such that we continue calling x86_get_event_constraint(). > This is true for offcore_response, but for LBR this may not always be the case. > I may want to use LBR on the L1D_PEND_MISS event and it would need to > be on counter 2. > But I believe that the current code could place it on counter 0 simply > because you return if shared_reg_get_constraint() is successful, but > it looks only at the LBR constraint not the event constraint. I think > in the presence of LBR, you always need to call share_get_reg() and > x86_get_event_constraint(). Which, I think it does.