Skip to contentSkip to conversation

Tracepoints kill rcupdate header dependency

PATCH In review [email protected] 2 participants 7 messages Apr 17, 2009

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/3 rcupdate header remove whitespace

In reply to [email protected]

Janitor-style whitespace cleanup. Will need to copy this header elsewhere anyway.

CC "Paul E. McKenney" <[email protected]>
---
 include/linux/rcupdate.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
Index: linux.trees.git/include/linux/rcupdate.h
===================================================================
@@ -18,7 +18,7 @@
  * Copyright IBM Corporation, 2001
  *
  * Author: Dipankar Sarma <[email protected]>
- * 
+ *
  * Based on the original work by Paul McKenney <[email protected]>
  * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
  * Papers:
Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#0 lore raw

cover Tracepoints kill rcupdate header dependency

Here is a patch to remove the tracepoint rcupdate dependency by splitting the read-side primitives of rcupdate.h into a sub rcupdate_defines.h header. That should make, at least, pvops tracing easier.

It applies on top of current tip/tracing/ftrace tree.

Mathieu

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#2 lore raw

PATCH 2/3 RCU move trace defines to rcupdate_defines.h

Given tracepoint.h need to include the minimal set of headers, split some tracing-specific RCU defines from the global rcupdate.h header.

CC Jeremy Fitzhardinge <[email protected]>
CC "Paul E. McKenney" <[email protected]>
CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Christoph Hellwig <[email protected]>
---
 include/linux/rcupdate.h         |  127 ------------------------------
 include/linux/rcupdate_defines.h |  163 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+), 126 deletions(-)
include/linux/rcupdate.h +2 -126
Index: linux.trees.git/include/linux/rcupdate.h
===================================================================
@@ -40,6 +40,7 @@
 #include <linux/seqlock.h>
 #include <linux/lockdep.h>
 #include <linux/completion.h>
+#include <linux/rcupdate_defines.h>
 
 /**
  * struct rcu_head - callback structure for use with RCU
@@ -70,132 +71,7 @@ extern int rcu_scheduler_active;
        (ptr)->next = NULL; (ptr)->func = NULL; \
 } while (0)
 
-/**
- * rcu_read_lock - mark the beginning of an RCU read-side critical section.
- *
- * When synchronize_rcu() is invoked on one CPU while other CPUs
- * are within RCU read-side critical sections, then the
- * synchronize_rcu() is guaranteed to block until after all the other
- * CPUs exit their critical sections.  Similarly, if call_rcu() is invoked
- * on one CPU while other CPUs are within RCU read-side critical
- * sections, invocation of the corresponding RCU callback is deferred
- * until after the all the other CPUs exit their critical sections.
- *
- * Note, however, that RCU callbacks are permitted to run concurrently
- * with RCU read-side critical sections.  One way that this can happen
- * is via the following sequence of events: (1) CPU 0 enters an RCU
- * read-side critical section, (2) CPU 1 invokes call_rcu() to register
- * an RCU callback, (3) CPU 0 exits the RCU read-side critical section,
- * (4) CPU 2 enters a RCU read-side critical section, (5) the RCU
- * callback is invoked.  This is legal, because the RCU read-side critical
- * section that was running concurrently with the call_rcu() (and which
- * therefore might be referencing something that the corresponding RCU
- * callback would free up) has completed before the corresponding
- * RCU callback is invoked.
- *
- * RCU read-side critical sections may be nested.  Any deferred actions
- * will be deferred until the outermost RCU read-side critical section
- * completes.
- *
- * It is illegal to block while in an RCU read-side critical section.
- */
-#define rcu_read_lock() __rcu_read_lock()
-
-/**
- * rcu_read_unlock - marks the end of an RCU read-side critical section.
- *
- * See rcu_read_lock() for more information.
- */
-
-/*
- * So where is rcu_write_lock()?  It does not exist, as there is no
- * way for writers to lock out RCU readers.  This is a feature, not
- * a bug -- this property is what provides RCU's performance benefits.
- * Of course, writers must coordinate with each other.  The normal
- * spinlock primitives work well for this, but any other technique may be
- * used as well.  RCU does not care how the writers keep out of each
- * others' way, as long as they do so.
- */
-#define rcu_read_unlock() __rcu_read_unlock()
-
-/**
- * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section
- *
- * This is equivalent of rcu_read_lock(), but to be used when updates
- * are being done using call_rcu_bh(). Since call_rcu_bh() callbacks
- * consider completion of a softirq handler to be a quiescent state,
- * a process in RCU read-side critical section must be protected by
- * disabling softirqs. Read-side critical sections in interrupt context
- * can use just rcu_read_lock().
- *
- */
-#define rcu_read_lock_bh() __rcu_read_lock_bh()
-
-/*
- * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
- *
- * See rcu_read_lock_bh() for more information.
- */
-#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
-
-/**
- * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section
- *
- * Should be used with either
- * - synchronize_sched()
- * or
- * - call_rcu_sched() and rcu_barrier_sched()
- * on the write-side to insure proper synchronization.
- */
-#define rcu_read_lock_sched() preempt_disable()
-#define rcu_read_lock_sched_notrace() preempt_disable_notrace()
-
-/*
- * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
- *
- * See rcu_read_lock_sched for more information.
- */
-#define rcu_read_unlock_sched() preempt_enable()
-#define rcu_read_unlock_sched_notrace() preempt_enable_notrace()
-
-
-
-/**
- * rcu_dereference - fetch an RCU-protected pointer in an
- * RCU read-side critical section.  This pointer may later
- * be safely dereferenced.
- *
- * Inserts memory barriers on architectures that require them
- * (currently only the Alpha), and, more importantly, documents
- * exactly which pointers are protected by RCU.
- */
-
-#define rcu_dereference(p)     ({ \
-				typeof(p) _________p1 = ACCESS_ONCE(p); \
-				smp_read_barrier_depends(); \
-				(_________p1); \
-				})
-
-/**
- * rcu_assign_pointer - assign (publicize) a pointer to a newly
- * initialized structure that will be dereferenced by RCU read-side
- * critical sections.  Returns the value assigned.
- *
- * Inserts memory barriers on architectures that require them
- * (pretty much all of them other than x86), and also prevents
- * the compiler from reordering the code that initializes the
- * structure after the pointer assignment.  More importantly, this
- * call documents which pointers will be dereferenced by RCU read-side
- * code.
- */
-
-#define rcu_assign_pointer(p, v) \
-	({ \
-		if (!__builtin_constant_p(v) || \
-		    ((v) != NULL)) \
-			smp_wmb(); \
-		(p) = (v); \
-	})
+/* See linux/rcupdate_defines.h for read-side locking primitives */
 
 /* Infrastructure to implement the synchronize_() primitives. */
 
include/linux/rcupdate_defines.h new file +163 -0

163 lines not on this page · raw message

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#6 lore raw

PATCH 3/3 tracepoints : remove rcupdate.h dependency

In reply to [email protected]

Use the slimmer rcupdate_defines.h instead of the fat rcupdate.h.

CC Jeremy Fitzhardinge <[email protected]>
CC "Paul E. McKenney" <[email protected]>
CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Christoph Hellwig <[email protected]>
---
 include/linux/tracepoint.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/tracepoint.h +5 -5
Index: linux.trees.git/include/linux/tracepoint.h
===================================================================
@@ -15,7 +15,7 @@
  */
 
 #include <linux/types.h>
-#include <linux/rcupdate.h>
+#include <linux/rcupdate_defines.h>
 
 struct module;
 struct tracepoint;
@@ -150,11 +150,11 @@ extern int tracepoint_get_iter_range(str
  * tracepoint_synchronize_unregister must be called between the last tracepoint
  * probe unregistration and the end of module exit to make sure there is no
  * caller executing a probe when it is freed.
+ * Using a define rather than a static inline to make sure tracepoint.h does not
+ * depend on rcupdate.h. rcupdate.h must be included whenever
+ * tracepoint_synchronize_unregister() is used.
  */
-static inline void tracepoint_synchronize_unregister(void)
-{
-	synchronize_sched();
-}
+#define tracepoint_synchronize_unregister() synchronize_sched()
 
 #define PARAMS(args...) args
 
Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#3 lore raw

Re: [patch 2/3] RCU move trace defines to rcupdate_defines.h

In reply to [email protected]
Quoted 2 lines · * [email protected] <[email protected]> wrote:
 include/linux/rcupdate.h         |  127 ------------------------------
 include/linux/rcupdate_defines.h |  163 +++++++++++++++++++++++++++++++++++++++

Looks good to me (if Paul accepts it too), but please use the standard convention we use in other places for 'light' headers:
rcupdate_types.h.

Ingo

#4 lore raw

Re: [patch 2/3] RCU move trace defines to rcupdate_defines.h

Quoted 11 lines · * Ingo Molnar ([email protected]) wrote:
Quoted 2 lines · * [email protected] <[email protected]> wrote:
 include/linux/rcupdate.h         |  127 ------------------------------
 include/linux/rcupdate_defines.h |  163 +++++++++++++++++++++++++++++++++++++++

Looks good to me (if Paul accepts it too), but please use the standard convention we use in other places for 'light' headers:
rcupdate_types.h.

Ingo

Given there were not "types" declared per-se, I thought _defines was more appropriate. But I don't mind, as long as we separate the heavy from the "light" header. I'll repost with _types.h.

Mathieu

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#5 lore raw

Re: [patch 2/3] RCU move trace defines to rcupdate_defines.h

Quoted 11 lines · Mathieu Desnoyers
Quoted 10 lines · * Ingo Molnar ([email protected]) wrote:
Quoted 2 lines · * [email protected] <[email protected]> wrote:
 include/linux/rcupdate.h         |  127 ------------------------------
 include/linux/rcupdate_defines.h |  163 +++++++++++++++++++++++++++++++++++++++

Looks good to me (if Paul accepts it too), but please use the standard convention we use in other places for 'light' headers:
rcupdate_types.h.

Quoted 5 lines
Quoted 1 line

Ingo

Given there were not "types" declared per-se, I thought _defines was more appropriate. But I don't mind, as long as we separate the heavy from the "light" header. I'll repost with _types.h.

Ok - but it's really up to Paul - i'll wait for his take.

Ingo