[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151126194106.GH28162@kernel.org>
Date: Thu, 26 Nov 2015 16:41:06 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
lkml <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 2/3] perf: Move exclude_kernel tracepoint check to init
event
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@...nel.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists