Re: [PATCH 01/18] tracing: Add function based events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 06, 2018 at 10:09:17PM -0500, Steven Rostedt wrote:
> On Mon, 5 Feb 2018 10:00:50 -0500
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> 
> > On Mon, 5 Feb 2018 09:24:23 +0100
> > Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> > 
> > 
> > > should this be done under 'func_event_mutex' ?  
> > 
> > Probably.
> 
> I think we only need to add the list.

yep, seems enough

jirka

> 
> > 
> > > 
> > > 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
--
To unsubscribe from this list: send the line "unsubscribe linux-trace-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux