Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1255853 > unrolled thread
| Started by | Wang Nan <wangnan0@huawei.com> |
|---|---|
| First post | 2015-10-26 12:50 +0100 |
| Last post | 2015-10-27 04:30 +0100 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[RFC PATCH v2 0/2] perf tools: Don't set inherit bit for system wide evsel Wang Nan <wangnan0@huawei.com> - 2015-10-26 12:50 +0100
[RFC PATCH v2 2/2] perf tools: Don't set inherit bit for system wide evsel Wang Nan <wangnan0@huawei.com> - 2015-10-26 12:50 +0100
[RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording Wang Nan <wangnan0@huawei.com> - 2015-10-26 13:00 +0100
Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording Adrian Hunter <adrian.hunter@intel.com> - 2015-10-26 13:30 +0100
Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-26 13:50 +0100
Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording Adrian Hunter <adrian.hunter@intel.com> - 2015-10-26 14:10 +0100
Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-27 04:30 +0100
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2015-10-26 12:50 +0100 |
| Subject | [RFC PATCH v2 0/2] perf tools: Don't set inherit bit for system wide evsel |
| Message-ID | <qnOrM-7Hj-9@gated-at.bofh.it> |
Previous version can be found from [1].
To make bpf_perf_event_output() and bpf_perf_event_read() easier to be
used, these two patches set inherit to 0 for system wide evsels.
After applying them, users are possible to pass system wide events to
BPF programs in following command, and don't need to consider the
setting of inherit:
# perf record -a -e evt=cycles -e ./test__map.c/maps.pmu_map.event=evt/ ...
Patch 1/2 set evsel->system_wide for system wide target. I have checked
in current evlist.c and evsel.c. The only behavior change I found is in
evlist.c:
/*
* The system_wide flag causes a selected event to be opened
* always without a pid. Consequently it will never get a
* POLLHUP, but it is used for tracking in combination with
* other events, so it should not need to be polled anyway.
* Therefore don't add it for polling.
*/
if (!evsel->system_wide &&
__perf_evlist__add_pollfd(evlist, fd, idx) < 0) {
perf_evlist__mmap_put(evlist, idx);
return -1;
}
With patch 1/2, __perf_evlist__add_pollfd() won't be called. From the
comment I pasted this modification looks harmless.
[1] http://lkml.kernel.org/r/1445597029-133332-1-git-send-email-wangnan0@huawei.com
Wang Nan (2):
perf tools: Set evsel->system_wide field for global system wide
recording
perf tools: Don't set inherit bit for system wide evsel
tools/perf/util/evsel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--
1.8.3.4
--
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/
[toc] | [next] | [standalone]
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2015-10-26 12:50 +0100 |
| Subject | [RFC PATCH v2 2/2] perf tools: Don't set inherit bit for system wide evsel |
| Message-ID | <qnOrM-7Hj-11@gated-at.bofh.it> |
| In reply to | #1255853 |
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 for system wide evsels 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 <wangnan0@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Li Zefan <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/n/ebpf-0xsuv8wc1uwgj7qfylfolgqs@git.kernel.org --- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 36ecf0e..2a5f0f8 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -736,7 +736,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) evsel->system_wide = opts->target.system_wide; attr->sample_id_all = perf_missing_features.sample_id_all ? 0 : 1; - attr->inherit = !opts->no_inherit; + attr->inherit = !opts->no_inherit && !evsel->system_wide; perf_evsel__set_sample_bit(evsel, IP); perf_evsel__set_sample_bit(evsel, TID); -- 1.8.3.4 -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2015-10-26 13:00 +0100 |
| Subject | [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording |
| Message-ID | <qnOBr-7KR-9@gated-at.bofh.it> |
| In reply to | #1255853 |
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 <wangnan0@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Li Zefan <lizefan@huawei.com> 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; attr->sample_id_all = perf_missing_features.sample_id_all ? 0 : 1; attr->inherit = !opts->no_inherit; -- 1.8.3.4 -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2015-10-26 13:30 +0100 |
| Subject | Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording |
| Message-ID | <qnP4u-8br-3@gated-at.bofh.it> |
| In reply to | #1255861 |
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 <wangnan0@huawei.com> > Cc: Adrian Hunter <adrian.hunter@intel.com> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > Cc: Alexei Starovoitov <ast@plumgrid.com> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> > Cc: Li Zefan <lizefan@huawei.com> > 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. > attr->sample_id_all = perf_missing_features.sample_id_all ? 0 : 1; > attr->inherit = !opts->no_inherit; > > -- 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/
[toc] | [prev] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2015-10-26 13:50 +0100 |
| Subject | Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording |
| Message-ID | <qnPnP-8hS-13@gated-at.bofh.it> |
| In reply to | #1255866 |
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 <wangnan0@huawei.com> >> Cc: Adrian Hunter <adrian.hunter@intel.com> >> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> >> Cc: Alexei Starovoitov <ast@plumgrid.com> >> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> >> Cc: Li Zefan <lizefan@huawei.com> >> 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? If we want to add further config terms we can put it to apply_config_terms(), where we can implement something like: # perf record -e cycles/system-wide/ -e instruction/no-system-wide/ ... But currently I don't have such requirement. Thank you. -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Adrian Hunter <adrian.hunter@intel.com> |
|---|---|
| Date | 2015-10-26 14:10 +0100 |
| Subject | Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording |
| Message-ID | <qnPHd-cN-39@gated-at.bofh.it> |
| In reply to | #1255878 |
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 <wangnan0@huawei.com> >>> Cc: Adrian Hunter <adrian.hunter@intel.com> >>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> >>> Cc: Alexei Starovoitov <ast@plumgrid.com> >>> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> >>> Cc: Li Zefan <lizefan@huawei.com> >>> 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 ? > > If we want to add further config terms we can put it to apply_config_terms(), > where we can implement something like: > > # perf record -e cycles/system-wide/ -e instruction/no-system-wide/ ... > > But currently I don't have such requirement. > > Thank you. > > -- 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/
[toc] | [prev] | [next] | [standalone]
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Date | 2015-10-27 04:30 +0100 |
| Subject | Re: [RFC PATCH v2 1/2] perf tools: Set evsel->system_wide field for global system wide recording |
| Message-ID | <qo37r-8tR-5@gated-at.bofh.it> |
| In reply to | #1255892 |
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 <wangnan0@huawei.com> >>>> Cc: Adrian Hunter <adrian.hunter@intel.com> >>>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> >>>> Cc: Alexei Starovoitov <ast@plumgrid.com> >>>> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> >>>> Cc: Li Zefan <lizefan@huawei.com> >>>> 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 -- 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web