Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1374311
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events |
| Date | 2016-04-08 17:30 +0200 |
| Message-ID | <rlGwb-5UD-27@gated-at.bofh.it> (permalink) |
| References | <rlGcO-5Mb-13@gated-at.bofh.it> <rlGcP-5Mb-45@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Fri, Apr 08, 2016 at 03:07:22PM +0000, Wang Nan escreveu:
> Before this patch, strange error message is provided if passed a
> non-tracepoint event to 'perf trace':
>
> # perf trace -a --ev cycles sleep 1
> Failed to set filter "common_pid != 27500" on event cycles with 22 (Invalid argument)
>
> This is because 'perf trace' accepts all valid events during cmdline
> parsing, but in fact user can only provide tracepoints, because it
> needs filter.
>
> This patch validate evlist, report error earlier:
>
> # ./perf trace -a --ev cycles sleep 1
> Only support tracepoint events!
Humm, perhaps we should instead refrain from setting filters to non
tracepoint events? I.e. I don't see why we whouldn't support, say,
software events...
/me trying some now, i.e.:
# trace --ev minor-faults --no-syscalls
But it has some issues...
- Arnaldo
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Li Zefan <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
> tools/perf/builtin-trace.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 11290b5..6fbed86 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2680,6 +2680,17 @@ out_enomem:
> goto out;
> }
>
> +static int validate_evlist(struct perf_evlist *evlist)
> +{
> + struct perf_evsel *evsel;
> +
> + evlist__for_each(evlist, evsel) {
> + if (evsel->attr.type != PERF_TYPE_TRACEPOINT)
> + return -EINVAL;
> + }
> + return 0;
> +}
> +
> static int trace__run(struct trace *trace, int argc, const char **argv)
> {
> struct perf_evlist *evlist = trace->evlist;
> @@ -3273,6 +3284,11 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
> argc = parse_options_subcommand(argc, argv, trace_options, trace_subcommands,
> trace_usage, PARSE_OPT_STOP_AT_NON_OPTION);
>
> + if (validate_evlist(trace.evlist)) {
> + pr_err("Only support tracepoint events!\n");
> + return -EINVAL;
> + }
> +
> if (trace.trace_pgfaults) {
> trace.opts.sample_address = true;
> trace.opts.sample_time = true;
> --
> 1.8.3.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] perf bpf: Add __bpf_stdout__ support Wang Nan <wangnan0@huawei.com> - 2016-04-08 17:10 +0200
[PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events Wang Nan <wangnan0@huawei.com> - 2016-04-08 17:10 +0200
Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 17:30 +0200
Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events "Wangnan (F)" <wangnan0@huawei.com> - 2016-04-08 18:20 +0200
Re: [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 19:40 +0200
[PATCH 2/4] perf trace: Print content of bpf-output event Wang Nan <wangnan0@huawei.com> - 2016-04-08 17:10 +0200
Re: [PATCH 2/4] perf trace: Print content of bpf-output event "Wangnan (F)" <wangnan0@huawei.com> - 2016-04-08 18:00 +0200
Re: [PATCH 2/4] perf trace: Print content of bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 19:30 +0200
[PATCH 3/4] perf bpf: Clone bpf stdout events in multiple bpf scripts Wang Nan <wangnan0@huawei.com> - 2016-04-08 17:20 +0200
Re: [PATCH 3/4] perf bpf: Clone bpf stdout events in multiple bpf scripts Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 19:40 +0200
[tip:perf/core] perf bpf: Clone bpf stdout events in multiple bpf scripts tip-bot for Wang Nan <tipbot@zytor.com> - 2016-04-13 09:30 +0200
[PATCH 4/4] perf bpf: Automatically create bpf-output event __bpf_stdout__ Wang Nan <wangnan0@huawei.com> - 2016-04-08 17:20 +0200
Re: [PATCH 4/4] perf bpf: Automatically create bpf-output event __bpf_stdout__ Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-08 20:00 +0200
[tip:perf/core] perf bpf: Automatically create bpf-output event __bpf_stdout__ tip-bot for Wang Nan <tipbot@zytor.com> - 2016-04-13 09:30 +0200
csiph-web