From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932101AbbJ0DYT (ORCPT ); Mon, 26 Oct 2015 23:24:19 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:60950 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752193AbbJ0DYR (ORCPT ); Mon, 26 Oct 2015 23:24:17 -0400 Message-ID: <562EEE39.5030604@huawei.com> Date: Tue, 27 Oct 2015 11:23:37 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Adrian Hunter , , CC: , , , Arnaldo Carvalho de Melo , Peter Zijlstra Subject: Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording References: <1445859720-146146-1-git-send-email-wangnan0@huawei.com> <1445859720-146146-2-git-send-email-wangnan0@huawei.com> <562E1B6F.2020202@intel.com> <562E1EEB.2030703@huawei.com> <562E2452.104@intel.com> In-Reply-To: <562E2452.104@intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/10/26 21:02, Adrian Hunter wrote: > On 26/10/15 14:39, Wangnan (F) wrote: >> >> On 2015/10/26 20:24, Adrian Hunter wrote: >>> On 26/10/15 13:41, Wang Nan wrote: >>>> evsel->system_wide is introduced by commit bf8e8f4b832972c76d64ab2e2837 >>>> (perf evlist: Add 'system_wide' option), which is used for mixing evsels >>>> that aren't system-wide with ones that are [1]. However, for global >>>> system wide recording (perf record -a ...), evsel->system_wide is set >>>> to false, which is confusion. >>>> >>>> This patch set evsel->system_wide to true if the target.system_wide is >>>> set, which makes evsel->system_wide a reliable way to describe whether >>>> itself is system_wide or not. >>>> >>>> [1] http://lkml.kernel.org/r/562DF19B.2080608@intel.com >>>> >>>> Signed-off-by: Wang Nan >>>> Cc: Adrian Hunter >>>> 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-qm3gtwidc1o5ktjd9tgjex25@git.kernel.org >>>> --- >>>> tools/perf/util/evsel.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c >>>> index 3ac4ee9c..36ecf0e 100644 >>>> --- a/tools/perf/util/evsel.c >>>> +++ b/tools/perf/util/evsel.c >>>> @@ -734,6 +734,7 @@ void perf_evsel__config(struct perf_evsel *evsel, >>>> struct record_opts *opts) >>>> int track = evsel->tracking; >>>> bool per_cpu = opts->target.default_per_cpu && >>>> !opts->target.per_thread; >>>> + evsel->system_wide = opts->target.system_wide; >>> Well that breaks the way evsel->system_wide is used i.e. it is a parameter >>> to the evsel and here you just overwrote it. >> Currently the only user of evsel->system_wide is IPT: >> >> auxtrace_record__options -> intel_pt_recording_options >> >> and it only set it to true. >> >> So I think changing to this should make it safe: >> >> evsel->system_wide = (evsel->system_wide || opt->target.system_wide); >> >> Thought? > That would work although it looks like a kludge. > > Have you looked at properly validating opts->no_inherit ? > > Also, aren't you neglecting target->cpu_list ? I need this because Alexei's bpf_perf_event_output() helper needs perf side support, and it only accept no-inherit perf event. I have already made a patch[1] to support setting inherit bit per-event, so even without this and next patch I can continue my work on bpf output. I'd like to rethink this patch after I finish perf support for bpf output. Thank you. [1] http://lkml.kernel.org/g/1445847884-143981-1-git-send-email-wangnan0@huawei.com