From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
lkml <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 2/3] perf: Move exclude_kernel tracepoint check to init event
Date: Thu, 26 Nov 2015 16:41:06 -0300 [thread overview]
Message-ID: <20151126194106.GH28162@kernel.org> (raw)
In-Reply-To: <1448566489-25922-3-git-send-email-jolsa@kernel.org>
Em Thu, Nov 26, 2015 at 08:34:48PM +0100, Jiri Olsa escreveu:
> We suppress events with attr::exclude_kernel set when
> the event is generated, so following capture will
> give no warning and produce no data:
>
> $ sudo perf record -e sched:sched_switch:u ls
> $ sudo /perf script | wc -l
> 0
>
> Checking the attr::exclude_kernel at the event init
> time and failing right away:
We can as well provide a better warning in the tooling side and don't
even ask this nonsensical combo to the kernel, right?
Arguably the kernel was doing what was asked for, its just that no
sched:sched_switch took place while in user space... ;-)
- Arnaldo
> $ sudo perf record -e sched:sched_switch:u ls
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (sched:sched_switch).
> /bin/dmesg may provide additional information.
> No CONFIG_PERF_EVENTS=y kernel support configured?
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> kernel/events/core.c | 5 -----
> kernel/trace/trace_event_perf.c | 15 +++++++++++++++
> 2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5854fcf7f05a..9fb9d5ef6825 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6938,11 +6938,6 @@ static int perf_tp_event_match(struct perf_event *event,
> {
> if (event->hw.state & PERF_HES_STOPPED)
> return 0;
> - /*
> - * All tracepoints are from kernel-space.
> - */
> - if (event->attr.exclude_kernel)
> - return 0;
>
> if (!perf_tp_filter_match(event, data))
> return 0;
> diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
> index c41463af3298..637268855296 100644
> --- a/kernel/trace/trace_event_perf.c
> +++ b/kernel/trace/trace_event_perf.c
> @@ -182,11 +182,26 @@ static void perf_trace_event_close(struct perf_event *p_event)
> tp_event->class->reg(tp_event, TRACE_REG_PERF_CLOSE, p_event);
> }
>
> +static int perf_trace_event_attr(struct perf_event *event)
> +{
> + /*
> + * All tracepoints are from kernel-space.
> + */
> + if (event->attr.exclude_kernel)
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> static int perf_trace_event_init(struct trace_event_call *tp_event,
> struct perf_event *p_event)
> {
> int ret;
>
> + ret = perf_trace_event_attr(p_event);
> + if (ret)
> + return ret;
> +
> ret = perf_trace_event_perm(tp_event, p_event);
> if (ret)
> return ret;
> --
> 2.4.3
next prev parent reply other threads:[~2015-11-26 19:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 19:34 [PATCHv2 0/3] perf ftrace: Several perf ftrace:function event fixes Jiri Olsa
2015-11-26 19:34 ` [PATCH 1/3] ftrace: Check sample types only for sampling events Jiri Olsa
2015-11-26 19:34 ` [PATCH 2/3] perf: Move exclude_kernel tracepoint check to init event Jiri Olsa
2015-11-26 19:41 ` Arnaldo Carvalho de Melo [this message]
2015-11-26 19:49 ` Jiri Olsa
2015-11-26 20:44 ` Arnaldo Carvalho de Melo
2015-11-26 19:34 ` [PATCH 3/3] perf ftrace: Use ftrace_ops::private to store event pointer Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151126194106.GH28162@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox