From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753508AbbJZJ2v (ORCPT ); Mon, 26 Oct 2015 05:28:51 -0400 Received: from mga09.intel.com ([134.134.136.24]:15840 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753219AbbJZJ2u (ORCPT ); Mon, 26 Oct 2015 05:28:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,200,1444719600"; d="scan'208";a="835522127" Subject: Re: [RFC PATCH] perf tools: Don't set inherit bit for system wide evsel To: "Wangnan (F)" , Arnaldo Carvalho de Melo , pi3orama References: <1445597029-133332-1-git-send-email-wangnan0@huawei.com> <20151023135141.GD27006@kernel.org> <3E5B2C7C-BD19-4B61-AEDC-D1E2CFE0D7D2@163.com> <20151023161749.GF27006@kernel.org> <562DED7D.2080306@huawei.com> Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Peter Zijlstra , Li Zefan From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <562DF19B.2080608@intel.com> Date: Mon, 26 Oct 2015 11:25:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <562DED7D.2080306@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/10/15 11:08, Wangnan (F) wrote: > > > On 2015/10/24 0:17, Arnaldo Carvalho de Melo wrote: >> Em Fri, Oct 23, 2015 at 09:58:20PM +0800, pi3orama escreveu: >>> >>> 发自我的 iPhone >>> >>>> 在 2015年10月23日,下午9:51,Arnaldo Carvalho de Melo >>>> 写道: >>>> >>>> Em Fri, Oct 23, 2015 at 10:43:49AM +0000, Wang Nan escreveu: >>>>> Inherit bit is useless for a system wide evsel [1]. Further kernel >>>>> improvements are giving more constrain [2] on inherit events. This >>>>> patch set inherit bit to 0 to avoid potential constrains. >>>>> >>>>> [1] >>>>> http://lkml.kernel.org/r/20151022124142.GQ17308@twins.programming.kicks-ass.net >>>>> >>>>> [2] >>>>> http://lkml.kernel.org/r/1445559014-4667-1-git-send-email-ast@kernel.org >>>>> >>>>> Signed-off-by: Wang Nan >>>>> Cc: Arnaldo Carvalho de Melo >>>>> Cc: Alexei Starovoitov >>>>> Cc: Peter Zijlstra >>>>> Cc: Li Zefan >>>>> Cc: pi3orama@163.com >>>>> Link: >>>>> http://lkml.kernel.org/n/ebpf-0tgilipxoo6fiebcxu3ft866@git.kernel.org >>>>> --- >>>>> >>>>> evsel->system_wide doesn't correct reflect whether this evsel is system >>>>> wide or not, so checks pid when invoking perf_event_open, and it is >>>>> always correct. >>>> Can't we do this at perf_evlist__config() or perf_evsel__config() time? >>> perf_evlist_config() is excluded because perf record doesn't use it. >> Yeah, we need to make it use it :-\ > > Its my fault that perf record *does* use perf_evlist__config(), but 'perf stat' > doesn't. > >> >>>> We have record_opts at perf_evsel__config() time and I think we should >>>> leave changing the attr at perf_evsel__open() time for feature >>>> fallbacks, i.e. something we will only know when trying to use, which is >>>> different from this inherit-on-syswide case, that we know far in advance >>>> we will not need. >>> I tried to set this bit based on evsel->system_wide but it seems not >>> reliable >>> as it should be, so I was wondering whether it is designed for other use. >>> I will look >>> into this next week. > > evsel->system_wide is introduced by commit > bf8e8f4b832972c76d64ab2e2837a48397144887 > (perf evlist: Add 'system_wide' option), but Adrian only introduced a new field > into perf, doesn't really make it active. Until now the only user of it is > arch/x86/util/intel-pt.c, but I'm not very sure the reason for IPT to use that > field. > > If I understand correctly, it should be okay for a normal system wide evsel > to have > this var set. I'll try another RFC for it. evsel->system_wide is for mixing evsels that aren't system-wide with ones that are. It might work to set it for all system-wide evsels but you will have to check the code and test it, because that would be using it in a new way that has never been tested.