public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Question about smp_read_barrier_depends() in kernel/marker.c
@ 2008-05-30 12:22 Paul E. McKenney
  2008-05-30 13:44 ` Mathieu Desnoyers
  0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2008-05-30 12:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: mathieu.desnoyers, maneesh, jkennisto

Hello, Mathieu,

I am a bit confused by the smp_read_barrier_depends() in kernel/markers.c.
My (probably naive) view is that they need to move as shown in the patch
below.  Help?

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 marker.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -urpNa -X dontdiff linux-2.6.26-rc4/kernel/marker.c linux-2.6.26-rc4-marker-srbd/kernel/marker.c
--- linux-2.6.26-rc4/kernel/marker.c	2008-05-30 04:39:01.000000000 -0700
+++ linux-2.6.26-rc4-marker-srbd/kernel/marker.c	2008-05-30 05:05:55.000000000 -0700
@@ -133,8 +133,8 @@ void marker_probe_cb(const struct marker
 		 * data. Same as rcu_dereference, but we need a full smp_rmb()
 		 * in the fast path, so put the explicit barrier here.
 		 */
-		smp_read_barrier_depends();
 		multi = mdata->multi;
+		smp_read_barrier_depends();
 		for (i = 0; multi[i].func; i++) {
 			va_start(args, fmt);
 			multi[i].func(multi[i].probe_private, call_private, fmt,
@@ -183,8 +183,8 @@ void marker_probe_cb_noarg(const struct 
 		 * data. Same as rcu_dereference, but we need a full smp_rmb()
 		 * in the fast path, so put the explicit barrier here.
 		 */
-		smp_read_barrier_depends();
 		multi = mdata->multi;
+		smp_read_barrier_depends();
 		for (i = 0; multi[i].func; i++)
 			multi[i].func(multi[i].probe_private, call_private, fmt,
 				&args);
@@ -271,6 +271,7 @@ marker_entry_add_probe(struct marker_ent
 	new[nr_probes].func = probe;
 	new[nr_probes].probe_private = probe_private;
 	entry->refcount = nr_probes + 1;
+	smp_wmb(); /* Ensure struct is initialized before publication. *
 	entry->multi = new;
 	entry->ptype = 1;
 	debug_print_probes(entry);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-30 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30 12:22 Question about smp_read_barrier_depends() in kernel/marker.c Paul E. McKenney
2008-05-30 13:44 ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox