Re: [PATCH 04/10][RFC] tracing: Remove per event trace registering

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Rostedt
Date: Thursday, April 29, 2010 - 7:06 am

On Thu, 2010-04-29 at 09:36 -0400, Mathieu Desnoyers wrote:


The problem is, the cast is now performed in a C file for all events.
There's no way to know what to cast it to there. This is out of the
automation of the macro.

We use to have the cast check by creating code that would create the
"register_trace_##call", and the typecheck was doing by passing the data
to this function. But we removed this code out of the per event, it was
adding lots of text footprint, and moved it to one single function that
handles all events. It is just expected that the callback created
matches the function it was done.

If you are overly paranoid, we could create a special function that
tests that the callback format that is created matches the tracepoint
that is created, and make it so GCC sees that nothing calls it and
removes it at final link. But I still see this as a waste.


The tracepoint is created in include/linux/tracepoint.h:

#define TRACE_EVENT(name, proto, args, struct, assign, print)	\
	DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))

The callback is created in include/trace/ftrace.h:

#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, args, tstuct, assign, print)	\
	DECLARE_EVENT_CLASS(name,				\
				PARAMS(proto),			\
				PARAMS(args),			\
				PARAMS(tstruct),		\
				PARAMS(assign),			\
				PARAMS(print));			\
	DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));

#undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\
									\
static notrace void							\
ftrace_raw_event_##call(proto,						\
			struct ftrace_event_call *event_call)		\
[...]


Thus the "proto" field of the TRACE_EVENT() is used to make both the
tracepoint and the callback. We add the struct ftrace_event_call
*event_call which is the data we pass to the callback.

Now, where this gets called is in kernel/trace/trace_events.c:

	tracepoint_probe_register(call->name,
				  call->class->probe,
				  call);

This is where we lose the typecheck. So my question is... where do you
want to put in a check?

-- Steve

	


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Wed Apr 28, 1:44 pm)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Wed Apr 28, 5:05 pm)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Steven Rostedt, (Thu Apr 29, 7:06 am)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Thu Apr 29, 7:55 am)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Fri Apr 30, 10:09 am)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Fri Apr 30, 12:06 pm)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Fri Apr 30, 1:07 pm)
Re: [PATCH 04/10][RFC] tracing: Remove per event trace reg ..., Mathieu Desnoyers, (Fri Apr 30, 2:02 pm)