Re: [patch] introduce TRACE_EVENT_ABI (was Re: TRACE_EVENT_ABI ?)

From: Frédéric Weisbecker
Date: Wed Sep 23 2009 - 06:58:06 EST


2009/9/23, Arjan van de Ven <arjan@xxxxxxxxxxxxx>:
> From e2c647ae2d3ddc25b804f0419956caf40d89c606 Mon Sep 17 00:00:00 2001
> From: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Date: Mon, 21 Sep 2009 20:14:53 +0200
> Subject: [PATCH] trace: introduce TRACE_EVENT_ABI
>
> Some trace events are suitable to form a stable userspace ABI;
> this patch introduces infrastructure to mark them as such,
> and marks the first few tracepoints this way
>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
> ---
> include/linux/tracepoint.h | 4 ++++
> include/trace/events/power.h | 6 +++---
> include/trace/events/sched.h | 4 ++--
> 3 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 63a3f7a..4cb454f 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -280,6 +280,10 @@ static inline void tracepoint_synchronize_unregister(void)
> * TRACE_EVENT_FN to perform any (un)registration work.
> */
>
> +#define TRACE_EVENT_ABI(name, proto, args, tstruct, assign, print) \
> + TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
> + PARAMS(tstruct), PARAMS(assign), PARAMS(print))
> +


You may probably need to undefine it from trace/define_trace.h
once every cpp magic have been done (ie: once trace/ftrace.h
have been included.)

Because some files include several tracepoint/trace event headers,
then linux/tracepoint.h gets included several times and eventually
TRACE_EVENT_ABI() would be redefined (and then crash).

That's why we have:

#ifdef CONFIG_EVENT_TRACING
#include <trace/ftrace.h>
#endif

#undef TRACE_EVENT
#undef TRACE_EVENT_FN
#undef TRACE_HEADER_MULTI_READ

in define_trace.h: to allow such re-inclusion of tracepoint.h
and avoid redefinitions of TRACE_EVENT and TRACE_EVENT_FN.

So you just need to add:

#undef TRACE_EVENT
#undef TRACE_EVENT_FN
+#undef TRACE_EVENT_ABI
#undef TRACE_HEADER_MULTI_READ


The problem is visible if you build napi that has such
multiple tracepoint headers included in a single C file.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/