[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090420191755.GA15571@elte.hu>
Date: Mon, 20 Apr 2009 21:17:55 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
mingo@...dmis.org, Frederic Weisbecker <fweisbec@...il.com>,
"H. Peter Anvin" <hpa@...or.com>,
Jeremy Fitzhardinge <jeremy@...p.org>,
Masami Hiramatsu <mhiramat@...hat.com>
Subject: Re: [RFC] Stupid tracepoint ideas
* Steven Rostedt <rostedt@...dmis.org> wrote:
> Mathieu,
>
> You may have tried this in your creation of tracepoints, but I figured I
> would ask before wasting too much time on it.
>
> I'm looking at ways to make tracepoints even lighter weight when disabled.
> And I thought of doing section code. I'm playing with the following idea
> (see below patch) but I'm afraid gcc is allowed to think that the code it
> produces will not move to different sections.
>
> Any thoughts on how we could do something similar to this.
>
> Note, this patch is purely proof-of-concept. I'm fully aware that it is an
> x86 solution only.
>
> -- Steve
>
> [ no Signed-off-by: because this patch is crap ]
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 4353f3f..6953f78 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -65,9 +65,18 @@ struct tracepoint {
> extern struct tracepoint __tracepoint_##name; \
> static inline void trace_##name(proto) \
> { \
> - if (unlikely(__tracepoint_##name.state)) \
> + if (unlikely(__tracepoint_##name.state)) { \
> + asm volatile ("jmp 43f\n" \
> + "42:\n" \
> + ".section .unlikely,\"ax\"\n" \
> + "43:\n" \
> + ::: "memory"); \
> __DO_TRACE(&__tracepoint_##name, \
> - TP_PROTO(proto), TP_ARGS(args)); \
> + TP_PROTO(proto), TP_ARGS(args)); \
> + asm volatile ("jmp 42b\n" \
> + ".previous\n" \
> + ::: "memory"); \
> + } \
> } \
> static inline int register_trace_##name(void (*probe)(proto)) \
does this boot fine? If yes then it would be nice to have a
measurement.
Ingo
--
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