All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mathieu.desnoyers@polymtl.ca, maneesh@linux.vnet.ibm.com,
	jkennisto@us.ibm.com
Subject: Question about smp_read_barrier_depends() in kernel/marker.c
Date: Fri, 30 May 2008 05:22:06 -0700	[thread overview]
Message-ID: <20080530122206.GA23396@linux.vnet.ibm.com> (raw)

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);

             reply	other threads:[~2008-05-30 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 12:22 Paul E. McKenney [this message]
2008-05-30 13:44 ` Question about smp_read_barrier_depends() in kernel/marker.c Mathieu Desnoyers

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=20080530122206.GA23396@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=jkennisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@linux.vnet.ibm.com \
    --cc=mathieu.desnoyers@polymtl.ca \
    /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.