public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Theodore Tso <tytso@mit.edu>,
	Arjan van de Ven <arjan@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Zhaolei <zhaolei@cn.fujitsu.com>, Li Zefan <lizf@cn.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Masami Hiramatsu <mhiramat@redhat.com>,
	"Frank Ch. Eigler" <fche@elastic.org>,
	Tom Zanussi <tzanussi@gmail.com>,
	Jiaying Zhang <jiayingz@google.com>,
	Michael Rubin <mrubin@google.com>,
	Martin Bligh <mbligh@google.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Neil Horman <nhorman@tuxdriver.com>,
	Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
	Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: [PATCH 2/8] tracing: create automated trace defines
Date: Tue, 14 Apr 2009 16:44:01 -0700	[thread overview]
Message-ID: <49E51FC1.8090306@goop.org> (raw)
In-Reply-To: <20090414172640.796858018@goodmis.org>

How about something like this:

>From f7fa71c046bc383706bf58503c4b75e05e252152 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Date: Tue, 14 Apr 2009 16:41:18 -0700
Subject: [PATCH] tracing: move __DO_TRACE out of line

Mainly simplify linux/tracepoint.h's include dependencies (removes
rcupdate.h), but it can't help with icache locality, since it
definitely moves the code out of line, rather than relying on gcc
to do it.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 4353f3f..1052e33 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -15,7 +15,6 @@
  */
 
 #include <linux/types.h>
-#include <linux/rcupdate.h>
 
 struct module;
 struct tracepoint;
@@ -42,19 +41,20 @@ struct tracepoint {
  * it_func[0] is never NULL because there is at least one element in the array
  * when the array itself is non NULL.
  */
-#define __DO_TRACE(tp, proto, args)					\
-	do {								\
+#define DEFINE_DO_TRACE(name, proto, args)				\
+	void __do_trace_##name(struct tracepoint *tp, TP_PROTO(proto))	\
+	{								\
 		void **it_func;						\
 									\
 		rcu_read_lock_sched_notrace();				\
-		it_func = rcu_dereference((tp)->funcs);			\
+		it_func = rcu_dereference(tp->funcs);			\
 		if (it_func) {						\
 			do {						\
 				((void(*)(proto))(*it_func))(args);	\
 			} while (*(++it_func));				\
 		}							\
 		rcu_read_unlock_sched_notrace();			\
-	} while (0)
+	}
 
 /*
  * Make sure the alignment of the structure in the __tracepoints section will
@@ -63,11 +63,13 @@ struct tracepoint {
  */
 #define DECLARE_TRACE(name, proto, args)				\
 	extern struct tracepoint __tracepoint_##name;			\
+	extern void __do_trace_##name(struct tracepoint *tp,		\
+				      TP_PROTO(proto));			\
 	static inline void trace_##name(proto)				\
 	{								\
 		if (unlikely(__tracepoint_##name.state))		\
-			__DO_TRACE(&__tracepoint_##name,		\
-				TP_PROTO(proto), TP_ARGS(args));	\
+			__do_trace_##name(&__tracepoint_##name,		\
+					  TP_ARGS(args));		\
 	}								\
 	static inline int register_trace_##name(void (*probe)(proto))	\
 	{								\
@@ -151,10 +153,7 @@ extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
  * probe unregistration and the end of module exit to make sure there is no
  * caller executing a probe when it is freed.
  */
-static inline void tracepoint_synchronize_unregister(void)
-{
-	synchronize_sched();
-}
+extern void tracepoint_synchronize_unregister(void);
 
 #define PARAMS(args...) args
 
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 980eb66..1a0502e 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -24,14 +24,17 @@
 
 #undef TRACE_EVENT
 #define TRACE_EVENT(name, proto, args, tstruct, assign, print)	\
+	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
 	DEFINE_TRACE(name)
 
 #undef TRACE_FORMAT
-#define TRACE_FORMAT(name, proto, args, print)	\
+#define TRACE_FORMAT(name, proto, args, print)			\
+	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
 	DEFINE_TRACE(name)
 
 #undef DECLARE_TRACE
-#define DECLARE_TRACE(name, proto, args)	\
+#define DECLARE_TRACE(name, proto, args)			\
+	DEFINE_DO_TRACE(name, TP_PROTO(proto), TP_ARGS(args))	\
 	DEFINE_TRACE(name)
 
 #undef TRACE_INCLUDE
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 1ef5d3a..6ac1f48 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -545,6 +545,12 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter)
 }
 EXPORT_SYMBOL_GPL(tracepoint_iter_reset);
 
+void tracepoint_synchronize_unregister(void)
+{
+	synchronize_sched();
+}
+EXPORT_SYMBOL_GPL(tracepoint_synchronize_unregister);
+
 #ifdef CONFIG_MODULES
 
 int tracepoint_module_notify(struct notifier_block *self,



  reply	other threads:[~2009-04-14 23:44 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 17:23 [PATCH 0/8] [GIT PULL] TRACE_EVENT for modules Steven Rostedt
2009-04-14 17:23 ` [PATCH 1/8] tracing: consolidate trace and trace_event headers Steven Rostedt
2009-04-14 21:51   ` Frederic Weisbecker
2009-04-14 22:04     ` Steven Rostedt
2009-04-14 17:23 ` [PATCH 2/8] tracing: create automated trace defines Steven Rostedt
2009-04-14 23:44   ` Jeremy Fitzhardinge [this message]
2009-04-15  1:45     ` Mathieu Desnoyers
2009-04-15 16:07       ` Jeremy Fitzhardinge
2009-04-16  2:34         ` Mathieu Desnoyers
2009-04-16  2:56           ` Jeremy Fitzhardinge
2009-04-16 23:44             ` Mathieu Desnoyers
2009-04-17  0:03               ` Jeremy Fitzhardinge
2009-04-17  0:13                 ` Mathieu Desnoyers
2009-04-17  0:18                   ` Jeremy Fitzhardinge
2009-04-17  0:28                     ` Mathieu Desnoyers
2009-04-17  0:43                       ` Jeremy Fitzhardinge
2009-04-17  3:05                         ` [PATCH] tracepoints : let subsystem nop-out the tracepoints at build time Mathieu Desnoyers
2009-04-20  7:12               ` [PATCH 2/8] tracing: create automated trace defines Andi Kleen
2009-04-21 15:51                 ` Mathieu Desnoyers
2009-04-21 17:18                   ` Jeremy Fitzhardinge
2009-04-21 17:21                     ` Steven Rostedt
2009-04-21 17:43                       ` Jeremy Fitzhardinge
2009-04-21 20:28                       ` Andi Kleen
2009-04-21 21:17                         ` Steven Rostedt
2009-04-21 21:23                           ` Frank Ch. Eigler
2009-04-21 21:33                             ` Steven Rostedt
2009-04-22  5:47                               ` Mathieu Desnoyers
2009-04-22  6:07                           ` Andi Kleen
2009-04-22  6:24                             ` Steven Rostedt
2009-04-22  7:26                               ` Andi Kleen
2009-04-15  7:04   ` Zhaolei
2009-04-14 17:23 ` [PATCH 3/8] tracing: make trace_seq operations available for core kernel Steven Rostedt
2009-04-14 19:12   ` Peter Zijlstra
2009-04-15  2:19     ` Steven Rostedt
2009-04-14 17:23 ` [PATCH 4/8] tracing/events: move declarations from trace directory to core include Steven Rostedt
2009-04-14 17:23 ` [PATCH 5/8] tracing/events: move the ftrace event tracing code to core Steven Rostedt
2009-04-14 19:23   ` Peter Zijlstra
2009-04-15  2:25     ` Steven Rostedt
2009-04-15  3:40       ` Jiaying Zhang
2009-04-14 17:23 ` [PATCH 6/8] tracing/events: convert event call sites to use a link list Steven Rostedt
2009-04-14 17:23 ` [PATCH 7/8] tracing/events: add export symbols for trace events in modules Steven Rostedt
2009-04-14 17:23 ` [PATCH 8/8] tracing/events: add support for modules to TRACE_EVENT Steven Rostedt
2009-04-15  3:22   ` Rusty Russell
2009-04-14 18:15 ` [PATCH 0/8] [GIT PULL] TRACE_EVENT for modules Ingo Molnar
2009-04-14 18:25   ` Ingo Molnar
2009-04-14 18:21 ` Ingo Molnar
2009-04-14 18:33   ` Steven Rostedt
2009-04-14 18:35     ` Ingo Molnar
2009-04-14 21:04 ` Theodore Tso
2009-04-14 21:23   ` Steven Rostedt
2009-04-14 21:59     ` Steven Rostedt
2009-04-14 21:29   ` Frank Ch. Eigler
2009-04-14 22:00     ` Steven Rostedt
2009-04-16 16:53     ` Christoph Hellwig
2009-04-14 21:48   ` Jeremy Fitzhardinge
2009-04-14 21:55     ` Steven Rostedt
2009-04-14 22:33       ` Jeremy Fitzhardinge
2009-04-15  8:29         ` Ingo Molnar
2009-04-16  2:29           ` Mathieu Desnoyers
2009-04-16 16:52   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49E51FC1.8090306@goop.org \
    --to=jeremy@goop.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=eduard.munteanu@linux360.ro \
    --cc=fche@elastic.org \
    --cc=fweisbec@gmail.com \
    --cc=hch@lst.de \
    --cc=jiayingz@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mbligh@google.com \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=mrubin@google.com \
    --cc=nhorman@tuxdriver.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --cc=tzanussi@gmail.com \
    --cc=zhaolei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox