All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Steven Rostedt <srostedt@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	hpa@zytor.com, mingo@redhat.com, rostedt@goodmis.org,
	srostedt@redhat.com, josh@joshtriplett.org, tglx@linutronix.de
Subject: [tip:perf/core] tracing/rcu: Add trace_##name##__rcuidle() static tracepoint for inside rcu_idle_exit() sections
Date: Fri, 17 Feb 2012 05:47:40 -0800	[thread overview]
Message-ID: <tip-2fbb90db1b8fcc78f43830f1a009f3af243c5f42@git.kernel.org> (raw)
In-Reply-To: <1328563113.2200.39.camel@gandalf.stny.rr.com>

Commit-ID:  2fbb90db1b8fcc78f43830f1a009f3af243c5f42
Gitweb:     http://git.kernel.org/tip/2fbb90db1b8fcc78f43830f1a009f3af243c5f42
Author:     Steven Rostedt <srostedt@redhat.com>
AuthorDate: Tue, 7 Feb 2012 09:32:43 -0500
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Mon, 13 Feb 2012 08:23:21 -0500

tracing/rcu: Add trace_##name##__rcuidle() static tracepoint for inside rcu_idle_exit() sections

Added is a new static inline function that lets *any* tracepoint be used
inside a rcu_idle_exit() section. And this also solves the problem where
the same tracepoint may be used inside a rcu_idle_exit() section as well
as outside of one.

I added a new tracepoint function with a "_rcuidle" extension. All
tracepoints can be used with either the normal "trace_foobar()"
function, or the "trace_foobar_rcuidle()" function when inside a
rcu_idle_exit() section.

All tracepoints defined by TRACE_EVENT() or any of the derivatives
will have a "_rcuidle()" function also defined. When a tracepoint is
used within an rcu_idle_exit() section, the "_rcuidle()" version must
be used. This denotes that the tracepoint is within rcu_idle_exit()
and it allows the rcu read locks within the tracepoint to still
be valid, as this version takes us out of rcu_idle_exit().

Another nice aspect about this patch is that "static inline"s are not
compiled into text when not used. So only the tracepoints that actually
use the _rcuidle() version will have them defined in the actual text
that is booted.

Link: http://lkml.kernel.org/r/1328563113.2200.39.camel@gandalf.stny.rr.com>

Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/linux/tracepoint.h |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index df0a779..fc36da9 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -114,7 +114,7 @@ static inline void tracepoint_synchronize_unregister(void)
  * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
  * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
  */
-#define __DO_TRACE(tp, proto, args, cond)				\
+#define __DO_TRACE(tp, proto, args, cond, prercu, postrcu)		\
 	do {								\
 		struct tracepoint_func *it_func_ptr;			\
 		void *it_func;						\
@@ -122,6 +122,7 @@ static inline void tracepoint_synchronize_unregister(void)
 									\
 		if (!(cond))						\
 			return;						\
+		prercu;							\
 		rcu_read_lock_sched_notrace();				\
 		it_func_ptr = rcu_dereference_sched((tp)->funcs);	\
 		if (it_func_ptr) {					\
@@ -132,6 +133,7 @@ static inline void tracepoint_synchronize_unregister(void)
 			} while ((++it_func_ptr)->func);		\
 		}							\
 		rcu_read_unlock_sched_notrace();			\
+		postrcu;						\
 	} while (0)
 
 /*
@@ -139,7 +141,7 @@ static inline void tracepoint_synchronize_unregister(void)
  * not add unwanted padding between the beginning of the section and the
  * structure. Force alignment to the same alignment as the section start.
  */
-#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args)	\
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
 	extern struct tracepoint __tracepoint_##name;			\
 	static inline void trace_##name(proto)				\
 	{								\
@@ -147,7 +149,17 @@ static inline void tracepoint_synchronize_unregister(void)
 			__DO_TRACE(&__tracepoint_##name,		\
 				TP_PROTO(data_proto),			\
 				TP_ARGS(data_args),			\
-				TP_CONDITION(cond));			\
+				TP_CONDITION(cond),,);			\
+	}								\
+	static inline void trace_##name##_rcuidle(proto)		\
+	{								\
+		if (static_branch(&__tracepoint_##name.key))		\
+			__DO_TRACE(&__tracepoint_##name,		\
+				TP_PROTO(data_proto),			\
+				TP_ARGS(data_args),			\
+				TP_CONDITION(cond),			\
+				rcu_idle_exit(),			\
+				rcu_idle_enter());			\
 	}								\
 	static inline int						\
 	register_trace_##name(void (*probe)(data_proto), void *data)	\
@@ -190,9 +202,11 @@ static inline void tracepoint_synchronize_unregister(void)
 	EXPORT_SYMBOL(__tracepoint_##name)
 
 #else /* !CONFIG_TRACEPOINTS */
-#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args)	\
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
 	static inline void trace_##name(proto)				\
 	{ }								\
+	static inline void trace_##name##_rcuidle(proto)		\
+	{ }								\
 	static inline int						\
 	register_trace_##name(void (*probe)(data_proto),		\
 			      void *data)				\

  parent reply	other threads:[~2012-02-17 13:48 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02  0:42 [PATCH RFC idle] Make arm, sh, and x86 stop using RCU when idle Paul E. McKenney
2012-02-02  0:43 ` [PATCH RFC idle 1/3] x86: Avoid invoking RCU when CPU is idle Paul E. McKenney
2012-02-02  0:43   ` [PATCH RFC idle 2/3] arm: " Paul E. McKenney
2012-02-02  0:43     ` Paul E. McKenney
2012-02-02  2:48     ` Rob Herring
2012-02-02  2:48       ` Rob Herring
2012-02-02  4:40       ` Paul E. McKenney
2012-02-02  4:40         ` Paul E. McKenney
2012-02-02  3:49     ` Nicolas Pitre
2012-02-02  3:49       ` Nicolas Pitre
2012-02-02  4:44       ` Paul E. McKenney
2012-02-02  4:44         ` Paul E. McKenney
2012-02-02 17:13         ` Nicolas Pitre
2012-02-02 17:13           ` Nicolas Pitre
2012-02-02 17:43           ` Paul E. McKenney
2012-02-02 17:43             ` Paul E. McKenney
2012-02-02 18:31             ` Nicolas Pitre
2012-02-02 18:31               ` Nicolas Pitre
2012-02-02 19:07               ` Paul E. McKenney
2012-02-02 19:07                 ` Paul E. McKenney
2012-02-02 22:20                 ` Kevin Hilman
2012-02-02 22:20                   ` Kevin Hilman
2012-02-02 22:49                   ` Rob Herring
2012-02-02 22:49                     ` Rob Herring
2012-02-02 23:03                     ` Steven Rostedt
2012-02-02 23:03                       ` Steven Rostedt
2012-02-02 23:27                       ` Paul E. McKenney
2012-02-02 23:27                         ` Paul E. McKenney
2012-02-02 23:51                         ` Paul E. McKenney
2012-02-02 23:51                           ` Paul E. McKenney
2012-02-03  2:45                         ` Steven Rostedt
2012-02-03  2:45                           ` Steven Rostedt
2012-02-03  6:04                           ` Paul E. McKenney
2012-02-03  6:04                             ` Paul E. McKenney
2012-02-03 18:55                             ` Steven Rostedt
2012-02-03 18:55                               ` Steven Rostedt
2012-02-03 19:40                               ` Paul E. McKenney
2012-02-03 19:40                                 ` Paul E. McKenney
2012-02-03 20:02                                 ` Steven Rostedt
2012-02-03 20:02                                   ` Steven Rostedt
2012-02-03 20:23                                   ` Paul E. McKenney
2012-02-03 20:23                                     ` Paul E. McKenney
2012-02-06 21:18                                 ` [PATCH][RFC] tracing/rcu: Add trace_##name##__rcuidle() static tracepoint for inside rcu_idle_exit() sections Steven Rostedt
2012-02-06 21:18                                   ` Steven Rostedt
2012-02-06 23:38                                   ` Paul E. McKenney
2012-02-06 23:38                                     ` Paul E. McKenney
2012-02-07 12:32                                     ` Steven Rostedt
2012-02-07 12:32                                       ` Steven Rostedt
2012-02-07 14:11                                       ` Paul E. McKenney
2012-02-07 14:11                                         ` Paul E. McKenney
2012-02-08 13:57                                         ` Frederic Weisbecker
2012-02-08 13:57                                           ` Frederic Weisbecker
2012-02-07 14:40                                       ` Josh Triplett
2012-02-07 14:40                                         ` Josh Triplett
     [not found]                                   ` <20120206220502.GA21340@leaf>
2012-02-07  0:36                                     ` Steven Rostedt
2012-02-07  0:36                                       ` Steven Rostedt
2012-02-17 13:47                                   ` tip-bot for Steven Rostedt [this message]
     [not found]                           ` <20120203025350.GF13456@leaf>
2012-02-03  6:06                             ` [PATCH RFC idle 2/3] arm: Avoid invoking RCU when CPU is idle Paul E. McKenney
2012-02-03  6:06                               ` Paul E. McKenney
2012-02-02 23:39                       ` Rob Herring
2012-02-02 23:39                         ` Rob Herring
2012-02-03 18:41                     ` Kevin Hilman
2012-02-03 18:41                       ` Kevin Hilman
2012-02-03 19:26                       ` Paul E. McKenney
2012-02-03 19:26                         ` Paul E. McKenney
2012-02-03 19:36                       ` Steven Rostedt
2012-02-03 19:36                         ` Steven Rostedt
2012-02-04 14:21                         ` Paul E. McKenney
2012-02-04 14:21                           ` Paul E. McKenney
2012-02-06 19:32                           ` Steven Rostedt
2012-02-06 19:32                             ` Steven Rostedt
2012-02-02 23:03                   ` Paul E. McKenney
2012-02-02 23:03                     ` Paul E. McKenney
2012-02-03 19:12                     ` Kevin Hilman
2012-02-03 19:12                       ` Kevin Hilman
2012-02-03 19:26                       ` Paul E. McKenney
2012-02-03 19:26                         ` Paul E. McKenney
2012-02-02  0:43   ` [PATCH RFC idle 3/3] sh: " Paul E. McKenney
2012-02-02  0:43     ` Paul E. McKenney
2012-02-02  1:54   ` [PATCH RFC idle 1/3] x86: " Frederic Weisbecker
2012-02-02  4:55     ` Paul E. McKenney
2012-02-02  0:48 ` [PATCH RFC idle] Make arm, sh, and x86 stop using RCU when idle Josh Triplett
2012-02-02  1:14   ` Paul E. McKenney
2012-02-02  2:29 ` Paul Mundt
2012-02-02  4:58   ` Paul E. McKenney

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=tip-2fbb90db1b8fcc78f43830f1a009f3af243c5f42@git.kernel.org \
    --to=srostedt@redhat.com \
    --cc=hpa@zytor.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.