lkml.org 
[lkml]   [2018]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 01/18] tracing: Add function based events
On Mon, 5 Feb 2018 10:00:50 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Mon, 5 Feb 2018 09:24:23 +0100
> Jiri Olsa <jolsa@redhat.com> wrote:
>
>
> > should this be done under 'func_event_mutex' ?
>
> Probably.

I think we only need to add the list.

>
> >
> > I tried and crashed the system by running 2 scripts with:
> >
> > echo 'ip_rcv(u64 skb, u64 dev)' > /sys/kernel/debug/tracing/function_events
> > echo 'SyS_openat(int dfd, string buf, x32 flags, x32 mode)' >> /sys/kernel/debug/tracing/function_events
> > echo 'SyS_open(x8[32] buf, x32 flags, x32 mode)' >> /sys/kernel/debug/tracing/function_events
> >
>

There's no reason that we can't have more than one function event
attached to the same function. I'm adding this:

diff --git a/kernel/trace/trace_event_ftrace.c b/kernel/trace/trace_event_ftrace.c
index b145639eac45..928168fc2025 100644
--- a/kernel/trace/trace_event_ftrace.c
+++ b/kernel/trace/trace_event_ftrace.c
@@ -1275,12 +1275,6 @@ static int create_function_event(int argc, char **argv)
if (state != FUNC_STATE_END)
goto fail;

- ret = -EALREADY;
- list_for_each_entry(fe, &func_events, list) {
- if (strcmp(fe->func, func_event->func) == 0)
- goto fail;
- }
-
ret = ftrace_set_filter(&func_event->ops, func_event->func,
strlen(func_event->func), 0);
if (ret < 0)
@@ -1290,7 +1284,9 @@ static int create_function_event(int argc, char **argv)
if (ret < 0)
goto fail;

+ mutex_lock(&func_event_mutex);
list_add_tail(&func_event->list, &func_events);
+ mutex_unlock(&func_event_mutex);
return 0;
fail:
free_func_event(func_event);
-- Steve

\
 
 \ /
  Last update: 2018-02-07 04:10    [W:0.154 / U:5.132 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site